From df7789cbef7ffa9658c61525edf75bebaa6398ff Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Wed, 26 Jun 2024 14:41:18 +0200 Subject: Got double free :/ --- modules/remote-sycl/c++/data.hpp | 10 +++++++++- modules/remote-sycl/c++/device.hpp | 10 ++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) (limited to 'modules/remote-sycl/c++') 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 auto access(cl::sycl::handler& h){ return data_.template get_access(h); } + + template + auto access(cl::sycl::handler& h) const { + return data_.template get_access(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 - error_or> copy_to_host(const data& dev_data){ - return {}; + error_or> copy_to_host(data& dev_data){ + data host_data; + cmd_queue_.submit([&](cl::sycl::handler& h){ + auto acc_buff = dev_data.template access(h); + h.copy(acc_buff, &host_data); + }); + cmd_queue_.wait(); + return host_data; } /** -- cgit v1.2.3