From 5202f24921e2136b284eadb54783519fb38967a3 Mon Sep 17 00:00:00 2001 From: Claudius 'keldu' Holeksa Date: Wed, 21 Aug 2024 17:22:17 +0200 Subject: Trying to fix the old storage approach --- modules/remote-sycl/benchmarks/mixed_precision.cpp | 12 ++++++------ modules/remote-sycl/benchmarks/mixed_precision.hpp | 1 + modules/remote-sycl/c++/data.hpp | 6 +++--- modules/remote-sycl/c++/device.hpp | 16 ++++++++-------- modules/remote-sycl/c++/rpc.hpp | 22 +++++++++++----------- 5 files changed, 29 insertions(+), 28 deletions(-) (limited to 'modules') diff --git a/modules/remote-sycl/benchmarks/mixed_precision.cpp b/modules/remote-sycl/benchmarks/mixed_precision.cpp index e804f4e..8c6d4c9 100644 --- a/modules/remote-sycl/benchmarks/mixed_precision.cpp +++ b/modules/remote-sycl/benchmarks/mixed_precision.cpp @@ -119,9 +119,9 @@ int main(int argc, char** argv){ float64_host_data.at(i) = static_cast(gen_num); float32_host_data.at(i) = static_cast(gen_num); } - data mixed_device_data{mixed_host_data}; - data float64_device_data{float64_host_data}; - data float32_device_data{float32_host_data}; + data> mixed_device_data{mixed_host_data}; + data> float64_device_data{float64_host_data}; + data> float32_device_data{float32_host_data}; sycl_iface.template call<"float64_32">(mixed_device_data, &(device.get_handle())); sycl_iface.template call<"float64">(float64_device_data, &(device.get_handle())); @@ -157,9 +157,9 @@ int main(int argc, char** argv){ float32_host_data.at(i) = static_cast(gen_num); } - data mixed_device_data{mixed_host_data}; - data float64_device_data{float64_host_data}; - data float32_device_data{float32_host_data}; + data> mixed_device_data{mixed_host_data}; + data> float64_device_data{float64_host_data}; + data> float32_device_data{float32_host_data}; sycl_iface.template call<"float64_32">(mixed_device_data, &(device.get_handle())); device.get_handle().wait(); diff --git a/modules/remote-sycl/benchmarks/mixed_precision.hpp b/modules/remote-sycl/benchmarks/mixed_precision.hpp index 784b9b5..cd8f9ec 100644 --- a/modules/remote-sycl/benchmarks/mixed_precision.hpp +++ b/modules/remote-sycl/benchmarks/mixed_precision.hpp @@ -1,5 +1,6 @@ #pragma once +#include "../c++/device.hpp" #include "../c++/remote.hpp" namespace sch { diff --git a/modules/remote-sycl/c++/data.hpp b/modules/remote-sycl/c++/data.hpp index d939a53..7481d53 100644 --- a/modules/remote-sycl/c++/data.hpp +++ b/modules/remote-sycl/c++/data.hpp @@ -9,12 +9,12 @@ namespace saw { * Most of the times this will be a root object. */ template -class data { +class data> { private: - cl::sycl::buffer> data_; + cl::sycl::buffer> data_; uint64_t size_; public: - data(const data& data__): + data(const data& data__): data_{&data__, 1u}, size_{data__.size()} {} diff --git a/modules/remote-sycl/c++/device.hpp b/modules/remote-sycl/c++/device.hpp index 3561da7..6d4dbbf 100644 --- a/modules/remote-sycl/c++/device.hpp +++ b/modules/remote-sycl/c++/device.hpp @@ -21,21 +21,21 @@ public: /** * Copy data to device */ - template - error_or> copy_to_device(const data& host_data){ - return data{host_data}; + template + error_or>> copy_to_device(const data& host_data){ + return data>{host_data}; } - template - error_or> allocate_on_device(const data::MetaSchema, Encoding, Storage>& host_meta){ - return copy_to_device(data{host_meta}); + template + error_or>> allocate_on_device(const data::MetaSchema, Encoding>& host_meta){ + return copy_to_device(data{host_meta}); } /** * Copy data to host */ - template - error_or> copy_to_host(data& dev_data){ + template + error_or> copy_to_host(data>& dev_data){ /** data host_data; cmd_queue_.submit([&](cl::sycl::handler& h){ diff --git a/modules/remote-sycl/c++/rpc.hpp b/modules/remote-sycl/c++/rpc.hpp index 780f7a0..65e2df5 100644 --- a/modules/remote-sycl/c++/rpc.hpp +++ b/modules/remote-sycl/c++/rpc.hpp @@ -118,14 +118,14 @@ struct rpc_iface_type_helper,schema::Me /** * Rpc Client class for the Sycl backend. */ -template -class rpc_client { +template +class rpc_client { public: private: /** * Server this client is tied to */ - rpc_server* srv_; + rpc_server* srv_; /** * TransferClient created from the internal RPC data server @@ -136,7 +136,7 @@ private: * Generated some sort of id for the request. */ public: - rpc_client(rpc_server& srv): + rpc_client(rpc_server& srv): srv_{&srv}, data_client_{srv_->data_server} {} @@ -149,7 +149,7 @@ public: id< typename schema_member_type::type::ResponseT > - > call(const data_or_id::type::RequestT, Encoding, Storage>& input){ + > call(const data_or_id::type::RequestT, Encoding>& input){ auto next_free_id = srv_->template next_free_id::type::ResponseT>(); return srv_->template call(input, next_free_id); } @@ -160,10 +160,10 @@ public: * Rpc Server class for the Sycl backend. */ template -class rpc_server { +class rpc_server { public: using InterfaceCtxT = cl::sycl::queue*; - using InterfaceT = interface; + using InterfaceT = interface, InterfaceCtxT>; private: /** @@ -218,18 +218,18 @@ public: id< typename schema_member_type::type::ResponseT > - > call(data_or_id::type::RequestT, Encoding, storage::Default> input, id::type::ResponseT> rpc_id){ + > call(data_or_id::type::RequestT, Encoding> input, id::type::ResponseT> rpc_id){ using FuncT = typename schema_member_type::type; /** * Object needed if and only if the provided data type is not an id */ - own> dev_tmp_inp = nullptr; + own>> dev_tmp_inp = nullptr; /** * First check if it's data or an id. * If it's an id, check if it's registered within the storage and retrieve it. */ - auto eoinp = [&,this]() -> error_or* > { + auto eoinp = [&,this]() -> error_or>* > { if(input.is_id()){ // storage_.maps auto eov = data_server_->template find(input.get_id()); @@ -246,7 +246,7 @@ public: } auto& val = eov.get_value(); - dev_tmp_inp = heap>(std::move(val)); + dev_tmp_inp = heap>>(std::move(val)); device_->get_handle().wait(); return dev_tmp_inp.get(); } -- cgit v1.2.3