summaryrefslogtreecommitdiffstats
path: root/parallel-libs/streamexecutor/lib/unittests
diff options
context:
space:
mode:
authorJason Henline <jhen@google.com>2016-09-06 17:07:22 +0000
committerJason Henline <jhen@google.com>2016-09-06 17:07:22 +0000
commit18ea094df15dfb8b41d4798bb1cbb14c434fa98d (patch)
treeedddbf24d4d2a42def796de6dab5080b9ab610ca /parallel-libs/streamexecutor/lib/unittests
parentdf050fd58566e43153f6506842ce179fd4ce4e67 (diff)
downloadbcm5719-llvm-18ea094df15dfb8b41d4798bb1cbb14c434fa98d.tar.gz
bcm5719-llvm-18ea094df15dfb8b41d4798bb1cbb14c434fa98d.zip
[SE] Remove Platform*Handle classes
Summary: As pointed out by jprice, these classes don't serve a purpose. Instead, we stay consistent with the way memory is managed and let the Stream and Kernel classes directly hold opaque handles to device Stream and Kernel instances, respectively. Reviewers: jprice, jlebar Subscribers: parallel_libs-commits Differential Revision: https://reviews.llvm.org/D24213 llvm-svn: 280719
Diffstat (limited to 'parallel-libs/streamexecutor/lib/unittests')
-rw-r--r--parallel-libs/streamexecutor/lib/unittests/SimpleHostPlatformDevice.h12
-rw-r--r--parallel-libs/streamexecutor/lib/unittests/StreamTest.cpp12
2 files changed, 12 insertions, 12 deletions
diff --git a/parallel-libs/streamexecutor/lib/unittests/SimpleHostPlatformDevice.h b/parallel-libs/streamexecutor/lib/unittests/SimpleHostPlatformDevice.h
index 184c2d7f273..b54b31dd457 100644
--- a/parallel-libs/streamexecutor/lib/unittests/SimpleHostPlatformDevice.h
+++ b/parallel-libs/streamexecutor/lib/unittests/SimpleHostPlatformDevice.h
@@ -34,9 +34,7 @@ class SimpleHostPlatformDevice : public streamexecutor::PlatformDevice {
public:
std::string getName() const override { return "SimpleHostPlatformDevice"; }
- streamexecutor::Expected<
- std::unique_ptr<streamexecutor::PlatformStreamHandle>>
- createStream() override {
+ streamexecutor::Expected<const void *> createStream() override {
return nullptr;
}
@@ -69,7 +67,7 @@ public:
return streamexecutor::Error::success();
}
- streamexecutor::Error copyD2H(streamexecutor::PlatformStreamHandle *S,
+ streamexecutor::Error copyD2H(const void *StreamHandle,
const void *DeviceHandleSrc,
size_t SrcByteOffset, void *HostDst,
size_t DstByteOffset,
@@ -80,8 +78,8 @@ public:
return streamexecutor::Error::success();
}
- streamexecutor::Error copyH2D(streamexecutor::PlatformStreamHandle *S,
- const void *HostSrc, size_t SrcByteOffset,
+ streamexecutor::Error copyH2D(const void *StreamHandle, const void *HostSrc,
+ size_t SrcByteOffset,
const void *DeviceHandleDst,
size_t DstByteOffset,
size_t ByteCount) override {
@@ -92,7 +90,7 @@ public:
}
streamexecutor::Error
- copyD2D(streamexecutor::PlatformStreamHandle *S, const void *DeviceHandleSrc,
+ copyD2D(const void *StreamHandle, const void *DeviceHandleSrc,
size_t SrcByteOffset, const void *DeviceHandleDst,
size_t DstByteOffset, size_t ByteCount) override {
std::memcpy(static_cast<char *>(const_cast<void *>(DeviceHandleDst)) +
diff --git a/parallel-libs/streamexecutor/lib/unittests/StreamTest.cpp b/parallel-libs/streamexecutor/lib/unittests/StreamTest.cpp
index 4f42bbe8e72..3a0f4e6fdd2 100644
--- a/parallel-libs/streamexecutor/lib/unittests/StreamTest.cpp
+++ b/parallel-libs/streamexecutor/lib/unittests/StreamTest.cpp
@@ -34,11 +34,11 @@ const auto &getDeviceValue =
class StreamTest : public ::testing::Test {
public:
StreamTest()
- : Device(&PDevice),
- Stream(llvm::make_unique<se::PlatformStreamHandle>(&PDevice)),
- HostA5{0, 1, 2, 3, 4}, HostB5{5, 6, 7, 8, 9},
- HostA7{10, 11, 12, 13, 14, 15, 16}, HostB7{17, 18, 19, 20, 21, 22, 23},
- Host5{24, 25, 26, 27, 28}, Host7{29, 30, 31, 32, 33, 34, 35},
+ : DummyPlatformStream(1), Device(&PDevice),
+ Stream(&PDevice, &DummyPlatformStream), HostA5{0, 1, 2, 3, 4},
+ HostB5{5, 6, 7, 8, 9}, HostA7{10, 11, 12, 13, 14, 15, 16},
+ HostB7{17, 18, 19, 20, 21, 22, 23}, Host5{24, 25, 26, 27, 28},
+ Host7{29, 30, 31, 32, 33, 34, 35},
DeviceA5(getOrDie(Device.allocateDeviceMemory<int>(5))),
DeviceB5(getOrDie(Device.allocateDeviceMemory<int>(5))),
DeviceA7(getOrDie(Device.allocateDeviceMemory<int>(7))),
@@ -50,6 +50,8 @@ public:
}
protected:
+ int DummyPlatformStream; // Mimicking a platform where the platform stream
+ // handle is just a stream number.
se::test::SimpleHostPlatformDevice PDevice;
se::Device Device;
se::Stream Stream;
OpenPOWER on IntegriCloud