summaryrefslogtreecommitdiff
path: root/parallel-libs
diff options
context:
space:
mode:
authorJason Henline <jhen@google.com>2016-09-07 22:26:20 +0000
committerJason Henline <jhen@google.com>2016-09-07 22:26:20 +0000
commit5b8895105bddb9d0eb3159e082e972fc833096c6 (patch)
tree2313f6a1687f2a981661734208fb7c30e884eede /parallel-libs
parentf085c57ad3a9315ebb442561fff74f51a784f03b (diff)
[SE] Add getName method to Device class
Reviewers: jhen Subscribers: parallel_libs-commits Differential Revision: https://reviews.llvm.org/D24240
Diffstat (limited to 'parallel-libs')
-rw-r--r--parallel-libs/streamexecutor/include/streamexecutor/Device.h3
-rw-r--r--parallel-libs/streamexecutor/lib/unittests/DeviceTest.cpp4
2 files changed, 7 insertions, 0 deletions
diff --git a/parallel-libs/streamexecutor/include/streamexecutor/Device.h b/parallel-libs/streamexecutor/include/streamexecutor/Device.h
index e431a45b866..97741282ff0 100644
--- a/parallel-libs/streamexecutor/include/streamexecutor/Device.h
+++ b/parallel-libs/streamexecutor/include/streamexecutor/Device.h
@@ -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,
diff --git a/parallel-libs/streamexecutor/lib/unittests/DeviceTest.cpp b/parallel-libs/streamexecutor/lib/unittests/DeviceTest.cpp
index 08f870d00ba..5b16c3c865c 100644
--- a/parallel-libs/streamexecutor/lib/unittests/DeviceTest.cpp
+++ b/parallel-libs/streamexecutor/lib/unittests/DeviceTest.cpp
@@ -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);