[SE] Make Kernel movable

Summary:
Kernel is basically just a smart pointer to the underlying
implementation, so making it movable prevents having to store a
std::unique_ptr to it.

Reviewers: jlebar

Subscribers: jprice, parallel_libs-commits

Differential Revision: https://reviews.llvm.org/D24150

llvm-svn: 280437
This commit is contained in:
Jason Henline
2016-09-02 00:22:05 +00:00
parent 3bd6d7fb78
commit dc2dff6c68
3 changed files with 12 additions and 72 deletions

View File

@@ -18,7 +18,6 @@
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <memory>
#include <vector>
#include "streamexecutor/StreamExecutor.h"
@@ -111,7 +110,7 @@ int main() {
se::Device *Device = getOrDie(Platform->getDevice(0));
// Load the kernel onto the device.
std::unique_ptr<cg::SaxpyKernel> Kernel =
cg::SaxpyKernel Kernel =
getOrDie(Device->createKernel<cg::SaxpyKernel>(cg::SaxpyLoaderSpec));
// Allocate memory on the device.
@@ -124,7 +123,7 @@ int main() {
se::Stream Stream = getOrDie(Device->createStream());
Stream.thenCopyH2D<float>(HostX, X)
.thenCopyH2D<float>(HostY, Y)
.thenLaunch(ArraySize, 1, *Kernel, A, X, Y)
.thenLaunch(ArraySize, 1, Kernel, A, X, Y)
.thenCopyD2H<float>(X, HostX);
// Wait for the stream to complete.
se::dieIfError(Stream.blockHostUntilDone());