From 2116b46f784aa9bc0dcbb1b6bfc22183d979b919 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Tue, 18 Nov 2025 21:40:34 +0100 Subject: Sycl tests rewrite --- modules/remote-sycl/c++/data.hpp | 5 +- modules/remote-sycl/tests/data_ref.cpp | 2 +- modules/remote-sycl/tests/sycl_basics.cpp | 77 ------------------------------- modules/remote-sycl/tests/sycl_basics.foo | 77 +++++++++++++++++++++++++++++++ 4 files changed, 81 insertions(+), 80 deletions(-) delete mode 100644 modules/remote-sycl/tests/sycl_basics.cpp create mode 100644 modules/remote-sycl/tests/sycl_basics.foo diff --git a/modules/remote-sycl/c++/data.hpp b/modules/remote-sycl/c++/data.hpp index e057766..149e3f2 100644 --- a/modules/remote-sycl/c++/data.hpp +++ b/modules/remote-sycl/c++/data.hpp @@ -118,7 +118,7 @@ class data>, encode::Sycl> { public: using Schema = schema::Ref>; private: - data* internal_data_ptr_; + data* internal_data_ptr_; data, Encode> dims_; data size_; @@ -148,7 +148,7 @@ private: std::is_same_v>, "Unsupported type" ); - assert(data_.size() == get_full_size()); + assert(size_ == get_full_size()); uint64_t s = 0; uint64_t stride = 1; @@ -172,3 +172,4 @@ private: return s; } }; +} diff --git a/modules/remote-sycl/tests/data_ref.cpp b/modules/remote-sycl/tests/data_ref.cpp index 03afb8f..61a2c8e 100644 --- a/modules/remote-sycl/tests/data_ref.cpp +++ b/modules/remote-sycl/tests/data_ref.cpp @@ -13,6 +13,6 @@ SAW_TEST("Data Ref Basics"){ acpp::sycl::queue sycl_q; data, encode::Sycl> dat{{{100u}},sycl_q}; - } + } diff --git a/modules/remote-sycl/tests/sycl_basics.cpp b/modules/remote-sycl/tests/sycl_basics.cpp deleted file mode 100644 index 970f4d6..0000000 --- a/modules/remote-sycl/tests/sycl_basics.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#include - -#include "../c++/device.hpp" -#include "../c++/data.hpp" -#include "../c++/remote.hpp" - -namespace { -namespace schema { -using namespace saw::schema; - -using TestStruct = Struct< - Member, - Member, - Member, "doubles"> ->; - -using Foo = Interface< - Member, "foo"> ->; -} -SAW_TEST("SYCL Basics"){ - using namespace saw; - - acpp::sycl::queue q; - data> host_data; -} - -/* -SAW_TEST("SYCL Test Setup"){ - using namespace saw; - - data host_data; - host_data.template get<"foo">() = 321; - host_data.template get<"bar">() = 50.0; - host_data.template get<"doubles">() = {1024u}; - - saw::event_loop loop; - saw::wait_scope wait{loop}; - - remote rmt; - saw::own> rmt_addr{}; - - rmt.resolve_address().then([&](auto addr){ - rmt_addr = std::move(addr); - }).detach(); - - wait.poll(); - SAW_EXPECT(rmt_addr, "Remote Address class hasn't been filled"); - - data> device_data{host_data}; - - interface,acpp::sycl::queue*> cl_iface { -[&](data>& in, acpp::sycl::queue* cmd) -> error_or { - - cmd->submit([&](acpp::sycl::handler& h){ - - auto acc_buff = in.template access(h); - - auto si = host_data.template get<"doubles">().size(); - - h.parallel_for(acpp::sycl::range<1>(si.get()), [=] (acpp::sycl::id<1> it){ - acc_buff[0u].template get<"foo">() = acc_buff[0u].template get<"doubles">().size(); - auto& dbls = acc_buff[0u].template get<"doubles">(); - dbls.at(it[0u]) = it[0u] * 2.0; - }); - }); - return saw::void_t{}; - } - }; - auto our_device = share>(); - auto& device = *our_device; - - cl_iface.template call <"foo">(device_data, &(device.get_handle())); - device.get_handle().wait(); -} -*/ -} diff --git a/modules/remote-sycl/tests/sycl_basics.foo b/modules/remote-sycl/tests/sycl_basics.foo new file mode 100644 index 0000000..970f4d6 --- /dev/null +++ b/modules/remote-sycl/tests/sycl_basics.foo @@ -0,0 +1,77 @@ +#include + +#include "../c++/device.hpp" +#include "../c++/data.hpp" +#include "../c++/remote.hpp" + +namespace { +namespace schema { +using namespace saw::schema; + +using TestStruct = Struct< + Member, + Member, + Member, "doubles"> +>; + +using Foo = Interface< + Member, "foo"> +>; +} +SAW_TEST("SYCL Basics"){ + using namespace saw; + + acpp::sycl::queue q; + data> host_data; +} + +/* +SAW_TEST("SYCL Test Setup"){ + using namespace saw; + + data host_data; + host_data.template get<"foo">() = 321; + host_data.template get<"bar">() = 50.0; + host_data.template get<"doubles">() = {1024u}; + + saw::event_loop loop; + saw::wait_scope wait{loop}; + + remote rmt; + saw::own> rmt_addr{}; + + rmt.resolve_address().then([&](auto addr){ + rmt_addr = std::move(addr); + }).detach(); + + wait.poll(); + SAW_EXPECT(rmt_addr, "Remote Address class hasn't been filled"); + + data> device_data{host_data}; + + interface,acpp::sycl::queue*> cl_iface { +[&](data>& in, acpp::sycl::queue* cmd) -> error_or { + + cmd->submit([&](acpp::sycl::handler& h){ + + auto acc_buff = in.template access(h); + + auto si = host_data.template get<"doubles">().size(); + + h.parallel_for(acpp::sycl::range<1>(si.get()), [=] (acpp::sycl::id<1> it){ + acc_buff[0u].template get<"foo">() = acc_buff[0u].template get<"doubles">().size(); + auto& dbls = acc_buff[0u].template get<"doubles">(); + dbls.at(it[0u]) = it[0u] * 2.0; + }); + }); + return saw::void_t{}; + } + }; + auto our_device = share>(); + auto& device = *our_device; + + cl_iface.template call <"foo">(device_data, &(device.get_handle())); + device.get_handle().wait(); +} +*/ +} -- cgit v1.2.3