diff options
Diffstat (limited to 'modules/remote-hip/c++/device.tmpl.hpp')
-rw-r--r-- | modules/remote-hip/c++/device.tmpl.hpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/modules/remote-hip/c++/device.tmpl.hpp b/modules/remote-hip/c++/device.tmpl.hpp new file mode 100644 index 0000000..4777660 --- /dev/null +++ b/modules/remote-hip/c++/device.tmpl.hpp @@ -0,0 +1,25 @@ +namespace saw { +namespace impl { +template<typename Schema, typename Encoding> +struct hip_copy_to_device { + static error_or<void> apply(data<Schema, Encoding>& from, data<Schema, Encoding>** to){ + static_assert(always_false<Schema,Encoding>, "Unsupported case."); + return make_void(); + } +}; + +template<typename T, uint64_t N, typename Encoding> +struct hip_copy_to_device<schema::Primitive<T,N>, Encoding> { + using Schema = schema::Primitive<T,N>; + static error_or<void> apply(data<Schema, Encoding>& from, data<Schema,Encoding>** to){ + hipError_t malloc_err = hipMalloc(to, sizeof(data<Schema,Encoding>)); + // HIP_CHECK(malloc_err); + + hipError_t copy_err = hipMemcpy(*to, &from, sizeof(data<Schema,Encoding>), hipMemcpyHostToDevice); + // HIP_CHECK(copy_err); + + return make_void(); + } +}; +} +} |