summaryrefslogtreecommitdiff
path: root/modules/remote-sycl/c++
diff options
context:
space:
mode:
Diffstat (limited to 'modules/remote-sycl/c++')
-rw-r--r--modules/remote-sycl/c++/data.hpp10
-rw-r--r--modules/remote-sycl/c++/device.hpp10
2 files changed, 17 insertions, 3 deletions
diff --git a/modules/remote-sycl/c++/data.hpp b/modules/remote-sycl/c++/data.hpp
index 42bc3b1..e436e72 100644
--- a/modules/remote-sycl/c++/data.hpp
+++ b/modules/remote-sycl/c++/data.hpp
@@ -21,10 +21,18 @@ public:
return data_;
}
+ const auto& get_handle() const {
+ return data_;
+ }
+
template<cl::sycl::access::mode AccessMode>
auto access(cl::sycl::handler& h){
return data_.template get_access<AccessMode>(h);
}
+
+ template<cl::sycl::access::mode AccessMode>
+ auto access(cl::sycl::handler& h) const {
+ return data_.template get_access<AccessMode>(h);
+ }
};
-
}
diff --git a/modules/remote-sycl/c++/device.hpp b/modules/remote-sycl/c++/device.hpp
index 46644b4..5e63a1d 100644
--- a/modules/remote-sycl/c++/device.hpp
+++ b/modules/remote-sycl/c++/device.hpp
@@ -28,8 +28,14 @@ public:
* Copy data to host
*/
template<typename Schema, typename Encoding, typename Storage>
- error_or<data<Schema, Encoding, Storage>> copy_to_host(const data<Schema, Encoding, rmt::Sycl>& dev_data){
- return {};
+ error_or<data<Schema, Encoding, Storage>> copy_to_host(data<Schema, Encoding, rmt::Sycl>& dev_data){
+ data<Schema,Encoding, Storage> host_data;
+ cmd_queue_.submit([&](cl::sycl::handler& h){
+ auto acc_buff = dev_data.template access<cl::sycl::access::mode::read>(h);
+ h.copy(acc_buff, &host_data);
+ });
+ cmd_queue_.wait();
+ return host_data;
}
/**