From fe51c2f7b406f7b1f0e5a69218cc016877c87026 Mon Sep 17 00:00:00 2001 From: Jason Henline Date: Wed, 7 Sep 2016 22:26:20 +0000 Subject: [PATCH] [SE] Add getName method to Device class Reviewers: jhen Subscribers: parallel_libs-commits Differential Revision: https://reviews.llvm.org/D24240 llvm-svn: 280872 --- parallel-libs/streamexecutor/include/streamexecutor/Device.h | 3 +++ parallel-libs/streamexecutor/lib/unittests/DeviceTest.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/parallel-libs/streamexecutor/include/streamexecutor/Device.h b/parallel-libs/streamexecutor/include/streamexecutor/Device.h index e431a45b8664..97741282ff0a 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 Expected::value, diff --git a/parallel-libs/streamexecutor/lib/unittests/DeviceTest.cpp b/parallel-libs/streamexecutor/lib/unittests/DeviceTest.cpp index 08f870d00ba3..5b16c3c865c8 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> MaybeMemory = Device.allocateDeviceMemory(10);