[Parallel_libs-commits] [parallel-libs] r280872 - [SE] Add getName method to Device class
Jason Henline via Parallel_libs-commits
parallel_libs-commits at lists.llvm.org
Wed Sep 7 15:26:21 PDT 2016
Author: jhen
Date: Wed Sep 7 17:26:20 2016
New Revision: 280872
URL: http://llvm.org/viewvc/llvm-project?rev=280872&view=rev
Log:
[SE] Add getName method to Device class
Reviewers: jhen
Subscribers: parallel_libs-commits
Differential Revision: https://reviews.llvm.org/D24240
Modified:
parallel-libs/trunk/streamexecutor/include/streamexecutor/Device.h
parallel-libs/trunk/streamexecutor/lib/unittests/DeviceTest.cpp
Modified: parallel-libs/trunk/streamexecutor/include/streamexecutor/Device.h
URL: http://llvm.org/viewvc/llvm-project/parallel-libs/trunk/streamexecutor/include/streamexecutor/Device.h?rev=280872&r1=280871&r2=280872&view=diff
==============================================================================
--- parallel-libs/trunk/streamexecutor/include/streamexecutor/Device.h (original)
+++ parallel-libs/trunk/streamexecutor/include/streamexecutor/Device.h Wed Sep 7 17:26:20 2016
@@ -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,
Modified: parallel-libs/trunk/streamexecutor/lib/unittests/DeviceTest.cpp
URL: http://llvm.org/viewvc/llvm-project/parallel-libs/trunk/streamexecutor/lib/unittests/DeviceTest.cpp?rev=280872&r1=280871&r2=280872&view=diff
==============================================================================
--- parallel-libs/trunk/streamexecutor/lib/unittests/DeviceTest.cpp (original)
+++ parallel-libs/trunk/streamexecutor/lib/unittests/DeviceTest.cpp Wed Sep 7 17:26:20 2016
@@ -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);
More information about the Parallel_libs-commits
mailing list