[SE] Make Stream movable
Summary: The example code makes it clear that this is a much better design decision. Reviewers: jlebar Subscribers: jprice, parallel_libs-commits Differential Revision: https://reviews.llvm.org/D24142 llvm-svn: 280397
This commit is contained in:
@@ -121,13 +121,13 @@ int main() {
|
||||
getOrDie(Device->allocateDeviceMemory<float>(ArraySize));
|
||||
|
||||
// Run operations on a stream.
|
||||
std::unique_ptr<se::Stream> Stream = getOrDie(Device->createStream());
|
||||
Stream->thenCopyH2D<float>(HostX, X)
|
||||
se::Stream Stream = getOrDie(Device->createStream());
|
||||
Stream.thenCopyH2D<float>(HostX, X)
|
||||
.thenCopyH2D<float>(HostY, Y)
|
||||
.thenLaunch(ArraySize, 1, *Kernel, A, X, Y)
|
||||
.thenCopyD2H<float>(X, HostX);
|
||||
// Wait for the stream to complete.
|
||||
se::dieIfError(Stream->blockHostUntilDone());
|
||||
se::dieIfError(Stream.blockHostUntilDone());
|
||||
|
||||
// Process output data in HostX.
|
||||
std::vector<float> ExpectedX = {4, 47, 90, 133};
|
||||
|
||||
Reference in New Issue
Block a user