From 2d9cd68ba5f79453487b0f6be4d984a0d556077a Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Mon, 19 Jan 2026 16:23:49 +0100 Subject: Sycl changes and CT multiply --- modules/codec/c++/data.hpp | 4 ++++ modules/remote-sycl/c++/device.hpp | 10 ++++++---- modules/remote-sycl/c++/remote.hpp | 4 +++- modules/remote-sycl/tests/data_ref.cpp | 25 +++++++++++++++++++------ modules/remote-sycl/tests/remote.cpp | 25 ------------------------- modules/remote-sycl/tests/remote.foo | 25 +++++++++++++++++++++++++ 6 files changed, 57 insertions(+), 36 deletions(-) delete mode 100644 modules/remote-sycl/tests/remote.cpp create mode 100644 modules/remote-sycl/tests/remote.foo diff --git a/modules/codec/c++/data.hpp b/modules/codec/c++/data.hpp index 585501b..a06acdf 100644 --- a/modules/codec/c++/data.hpp +++ b/modules/codec/c++/data.hpp @@ -365,6 +365,10 @@ public: constexpr data> get_dims() const { return {std::array{D...}}; } + + constexpr data flat_dims() const { + return {ct_multiply::value}; + } private: constexpr uint64_t get_flat_index(const data>& i) const { uint64_t s = 0; diff --git a/modules/remote-sycl/c++/device.hpp b/modules/remote-sycl/c++/device.hpp index 05bb17a..6667711 100644 --- a/modules/remote-sycl/c++/device.hpp +++ b/modules/remote-sycl/c++/device.hpp @@ -22,13 +22,16 @@ public: * Copy data to device */ template - error_or>> copy_to_device(const data& host_data){ + error_or>> copy_to_device(const data& host_data, data>& sycl_data){ + return data>{host_data}; } template error_or>> allocate_on_device(const data::MetaSchema, Encoding>& host_meta){ - return copy_to_device(data{host_meta}); + data host_data{host_meta}; + data> sycl_dat{host_data}; + return sycl_dat; } /** @@ -44,8 +47,7 @@ public: }); cmd_queue_.wait(); */ - acpp::sycl::host_accessor result{dev_data.get_handle()}; - return result[0]; + return make_error("device::copy_to_host"); } /** diff --git a/modules/remote-sycl/c++/remote.hpp b/modules/remote-sycl/c++/remote.hpp index 65f645e..ef11d50 100644 --- a/modules/remote-sycl/c++/remote.hpp +++ b/modules/remote-sycl/c++/remote.hpp @@ -1,6 +1,8 @@ #pragma once #include "common.hpp" +#include "transfer.hpp" +#include "rpc.hpp" namespace saw { @@ -72,7 +74,7 @@ public: } /** - * Spin up data server + * Spin up a data server */ template error_or>> data_listen(remote_address& dev){ diff --git a/modules/remote-sycl/tests/data_ref.cpp b/modules/remote-sycl/tests/data_ref.cpp index e92c693..7f5bb1b 100644 --- a/modules/remote-sycl/tests/data_ref.cpp +++ b/modules/remote-sycl/tests/data_ref.cpp @@ -10,14 +10,23 @@ using namespace saw::schema; SAW_TEST("Data Ref Basics"){ using namespace saw; - acpp::sycl::queue sycl_q; + device dev; + acpp::sycl::queue& sycl_q = dev.get_handle(); constexpr uint64_t dat_size = 1000u; - data, encode::Sycl> dat{{{dat_size}},sycl_q}; + data, encode::Native> dat{{{dat_size}}}; + auto eo_syc_dat = dev.template allocate_on_device,encode::Native>({{dat_size}}); + SAW_EXPECT(eo_syc_dat.is_value(), "Couldn't allocate on device"); + auto& sycl_dat = eo_syc_dat.get_value(); - data>, encode::Sycl> dat_ref{dat}; - auto dat_ptr = dat_ref.get_internal_data(); + { + auto eov = dev.copy_to_device(dat,sycl_dat); + SAW_EXPECT_EOV(eov); + } + + data>, encode::Sycl> sdat_ref{sycl_dat}; + auto dat_ptr = sdat_ref.get_internal_data(); sycl_q.parallel_for(dat_size, [=](acpp::sycl::id<1> idx){ size_t i = idx[0]; @@ -25,8 +34,12 @@ SAW_TEST("Data Ref Basics"){ dat_ptr[i] = {i}; }).wait(); - for(uint64_t i = 0u; i < dat_size; ++i){ - SAW_EXPECT(dat_ptr[i].get() == i, std::string{"Unexpected value: "} + std::to_string(i)); + { + auto eov = dev.copy_to_host(sycl_dat,dat); + SAW_EXPECT_EOV(eov); + } + for(saw::data i = 0u; i < saw::data{dat_size}; ++i){ + SAW_EXPECT(dat.at({i}) == i, std::string{"Unexpected value: "} + std::to_string(i.get())); } } } diff --git a/modules/remote-sycl/tests/remote.cpp b/modules/remote-sycl/tests/remote.cpp deleted file mode 100644 index e580f17..0000000 --- a/modules/remote-sycl/tests/remote.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include - -#include "../c++/remote.hpp" - -namespace { -namespace sch { -using namespace saw::schema; -} - -SAW_TEST("Remote Basics"){ - using namespace saw; - - remote sycl_rmt; - - auto eo_sycl_addr = sycl_rmt.parse_address(); - SAW_EXPECT(eo_sycl_addr.is_value(),"Couldn't parse address"); - auto& sycl_addr = eo_sycl_addr.get_value(); - - - auto eo_dat_srv = sycl_rmt.data_listen(sycl_addr); - SAW_EOV_EXPECT(eo_dat_srv); - - auto& dat_srv = eo_dat_srv.get_value(); -} -} diff --git a/modules/remote-sycl/tests/remote.foo b/modules/remote-sycl/tests/remote.foo new file mode 100644 index 0000000..698c333 --- /dev/null +++ b/modules/remote-sycl/tests/remote.foo @@ -0,0 +1,25 @@ +#include + +#include "../c++/remote.hpp" + +namespace { +namespace sch { +using namespace saw::schema; +} + +SAW_TEST("Remote Basics"){ + using namespace saw; + + remote sycl_rmt; + + auto eo_sycl_addr = sycl_rmt.parse_address(); + SAW_EXPECT(eo_sycl_addr.is_value(),"Couldn't parse address"); + auto& sycl_addr = eo_sycl_addr.get_value(); + + + auto eo_dat_srv = sycl_rmt.data_listen,saw::encode::Native>(*sycl_addr); + SAW_EOV_EXPECT(eo_dat_srv); + + auto& dat_srv = eo_dat_srv.get_value(); +} +} -- cgit v1.2.3