diff options
author | Claudius 'keldu' Holeksa <mail@keldu.de> | 2024-09-11 13:43:18 +0200 |
---|---|---|
committer | Claudius 'keldu' Holeksa <mail@keldu.de> | 2024-09-11 13:43:18 +0200 |
commit | df7574bf64b014e152d100a224d29ecdda32a7b2 (patch) | |
tree | 8f500104d34504108690a82b600610b1ef1c7cfd /modules/remote-hip/c++/device.tmpl.hpp | |
parent | 9c8f45cba18d284bcc8a5be10c43fe981e1a2cbc (diff) |
Remote Hip example work
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(); + } +}; +} +} |