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/tests/sycl_basics.foo | 77 +++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 modules/remote-sycl/tests/sycl_basics.foo (limited to 'modules/remote-sycl/tests/sycl_basics.foo') 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