summaryrefslogtreecommitdiffstats
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
commitfe51c2f7b406f7b1f0e5a69218cc016877c87026 (patch)
treeddc51e0bef1c778b606d2f5d257445623d985f5d /parallel-libs
parenteade17271a04176fc6a450db7723933c23a8bec7 (diff)
downloadbcm5719-llvm-fe51c2f7b406f7b1f0e5a69218cc016877c87026.tar.gz
bcm5719-llvm-fe51c2f7b406f7b1f0e5a69218cc016877c87026.zip
[SE] Add getName method to Device class
Reviewers: jhen Subscribers: parallel_libs-commits Differential Revision: https://reviews.llvm.org/D24240 llvm-svn: 280872
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);
OpenPOWER on IntegriCloud