[SE] Add getName method to Device class

Reviewers: jhen

Subscribers: parallel_libs-commits

Differential Revision: https://reviews.llvm.org/D24240

llvm-svn: 280872
This commit is contained in:
Jason Henline 2016-09-07 22:26:20 +00:00
parent eade17271a
commit fe51c2f7b4
2 changed files with 7 additions and 0 deletions

View File

@ -30,6 +30,9 @@ public:
explicit Device(PlatformDevice *PDevice);
virtual ~Device();
/// Gets the name of this device.
std::string getName() const { return PDevice->getName(); }
/// Creates a kernel object for this device.
template <typename KernelT>
Expected<typename std::enable_if<std::is_base_of<KernelBase, KernelT>::value,

View File

@ -74,6 +74,10 @@ public:
using llvm::ArrayRef;
using llvm::MutableArrayRef;
TEST_F(DeviceTest, GetName) {
EXPECT_EQ(Device.getName(), "SimpleHostPlatformDevice");
}
TEST_F(DeviceTest, AllocateAndFreeDeviceMemory) {
se::Expected<se::GlobalDeviceMemory<int>> MaybeMemory =
Device.allocateDeviceMemory<int>(10);