From 039dd61d291060010a11a3f7bb1addfa7eb77bfd Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Fri, 31 May 2024 14:19:32 +0200 Subject: Working on getting sycl to work --- modules/remote-sycl/.nix/derivation.nix | 4 +++- modules/remote-sycl/c++/remote.hpp | 2 +- modules/remote-sycl/examples/sycl_basic.cpp | 18 +++++++++++++++--- modules/remote-sycl/examples/sycl_basic_kernel.cpp | 16 +++++++++++++--- modules/remote-sycl/tests/SConscript | 4 +++- 5 files changed, 35 insertions(+), 9 deletions(-) (limited to 'modules/remote-sycl') diff --git a/modules/remote-sycl/.nix/derivation.nix b/modules/remote-sycl/.nix/derivation.nix index 2b00ada..65c408c 100644 --- a/modules/remote-sycl/.nix/derivation.nix +++ b/modules/remote-sycl/.nix/derivation.nix @@ -6,6 +6,7 @@ , forstio , openmp , opensycl +, python3 , ocl-icd , build_examples ? "false" @@ -22,7 +23,8 @@ in stdenv.mkDerivation { nativeBuildInputs = [ scons - clang-tools + clang-tools + python3 ]; buildInputs = [ diff --git a/modules/remote-sycl/c++/remote.hpp b/modules/remote-sycl/c++/remote.hpp index 003dd0e..dbbefcb 100644 --- a/modules/remote-sycl/c++/remote.hpp +++ b/modules/remote-sycl/c++/remote.hpp @@ -116,7 +116,7 @@ public: return std::move(eov.get_error()); } return eov.get_value(); - }else { + } else { return &input.get_data(); } }(); diff --git a/modules/remote-sycl/examples/sycl_basic.cpp b/modules/remote-sycl/examples/sycl_basic.cpp index abea738..64ec1fe 100644 --- a/modules/remote-sycl/examples/sycl_basic.cpp +++ b/modules/remote-sycl/examples/sycl_basic.cpp @@ -1,4 +1,5 @@ #include "./sycl_basic.hpp" +#include int main(){ saw::remote remote_ctx; @@ -20,15 +21,26 @@ int main(){ auto rpc_server = listen_basic_sycl(remote_ctx, *rmt_addr); + saw::id next_id{0u}; { - auto eov = rpc_server.template call<"increment">(saw::id{1u}); + auto eov = rpc_server.template call<"increment">(saw::data{1u}); if(eov.is_error()){ + auto& err = eov.get_error(); + std::cerr<<"Error: "<(next_id); + if(eov.is_error()){ + auto& err = eov.get_error(); + std::cerr<<"Error: "<, rmt::Sycl> listen_basic_sycl(remote& ctx, remote_address& addr){ +saw::rpc_server, saw::rmt::Sycl> listen_basic_sycl(saw::remote& ctx, saw::remote_address& addr){ saw::interface, cl::sycl::queue*> iface{ [](saw::data in, cl::sycl::queue* q) -> saw::data { - return {in.get() + 1u}; + uint64_t inr = in.get(); + cl::sycl::buffer d_inc{ &inr, 1u }; + q->submit([&](cl::sycl::handler& h){ + auto a_inc = d_inc.get_access(h); + + h.parallel_for(cl::sycl::range<1>(1u), [=] (cl::sycl::id<1> it){ + a_inc[0] += 1u; + }); + }); + q->wait(); + return {inr}; } }; - auto rpc_server = remote_ctx.template listen>(*rmt_addr, std::move(iface)); + auto rpc_server = ctx.template listen>(addr, std::move(iface)); return rpc_server; } diff --git a/modules/remote-sycl/tests/SConscript b/modules/remote-sycl/tests/SConscript index f8ffc92..3a9a2cf 100644 --- a/modules/remote-sycl/tests/SConscript +++ b/modules/remote-sycl/tests/SConscript @@ -12,6 +12,8 @@ dir_path = Dir('.').abspath # Environment for base library test_cases_env = env.Clone(); +test_cases_env['CXX'] = 'syclcc'; + test_cases_env.Append(LIBS=['forstio-test']); test_cases_env.sources = sorted(glob.glob(dir_path + "/*.cpp")) @@ -28,4 +30,4 @@ test_cases_env.program = test_cases_env.Program('#bin/tests', [objects_static, e env.Alias('test', test_cases_env.program); env.Alias('check', test_cases_env.program); -env.targets += ['test','check']; +# env.targets += ['test','check']; -- cgit v1.2.3