diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-10-12 15:42:56 +0200 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-10-12 15:42:56 +0200 |
| commit | 4bce6c96d0c49161b840796b277baab7972c0214 (patch) | |
| tree | 5883f6988dea5e5002e55756931ce922cbc5d806 /modules/remote-sycl/c++ | |
| parent | af87db21b8c72d16e4f63aba9fcfecd48167e71d (diff) | |
| download | forstio-forstio-4bce6c96d0c49161b840796b277baab7972c0214.tar.gz | |
Fixed and added Array for sycl
Diffstat (limited to 'modules/remote-sycl/c++')
| -rw-r--r-- | modules/remote-sycl/c++/common.hpp | 1 | ||||
| -rw-r--r-- | modules/remote-sycl/c++/data.hpp | 36 | ||||
| -rw-r--r-- | modules/remote-sycl/c++/remote.hpp | 4 |
3 files changed, 39 insertions, 2 deletions
diff --git a/modules/remote-sycl/c++/common.hpp b/modules/remote-sycl/c++/common.hpp index 3859dad..822dae5 100644 --- a/modules/remote-sycl/c++/common.hpp +++ b/modules/remote-sycl/c++/common.hpp @@ -2,6 +2,7 @@ #include <forstio/remote/remote.hpp> #include <forstio/codec/data.hpp> +#include <forstio/codec/schema_hash.hpp> #include <forstio/codec/id_map.hpp> #include <AdaptiveCpp/CL/sycl.hpp> diff --git a/modules/remote-sycl/c++/data.hpp b/modules/remote-sycl/c++/data.hpp index 7763952..91f74f8 100644 --- a/modules/remote-sycl/c++/data.hpp +++ b/modules/remote-sycl/c++/data.hpp @@ -41,4 +41,40 @@ public: return data_.template get_access<AccessMode>(h); } }; + +template<typename Sch, uint64_t Dim> +class data<schema::Array<Sch, Dim>, encode::Sycl<encode::Native>> { +public: + using Schema = schema::Array<Sch,Dim>; +private: + cl::sycl::buffer<data<Sch, encode::Native>> data_; + data<schema::UInt64, encode::Native> size_; +public: + data(const data<Schema, encode::Native>& host_data__): + data_{&host_data__.at({0u}),host_data__.size().get()}, + size_{host_data__.size()} + {} + + auto& get_handle() { + return data_; + } + + const auto& get_handle() const { + return data_; + } + + data<schema::UInt64, encode::Native> size() const { + return size_; + } + + 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++/remote.hpp b/modules/remote-sycl/c++/remote.hpp index fd2f64a..65f645e 100644 --- a/modules/remote-sycl/c++/remote.hpp +++ b/modules/remote-sycl/c++/remote.hpp @@ -31,9 +31,9 @@ private: std::array<uint64_t,3> data; template<typename Schema, typename Encoding> - static key_t create(const remote_address<rmt::Loopback>& addr){ + static key_t create(const remote_address<rmt::Sycl>& addr){ key_t k; - k.data = std::array<uint64_t,3>{addr.get_address_id().get(), schema_hash<Schema>::apply(), schema_hash<Encoding>::apply()}; + k.data = std::array<uint64_t,3>{addr.get_device_id(), schema_hash<Schema>::apply(), schema_hash<Encoding>::apply()}; return k; } |
