#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 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,cl::sycl::queue*> cl_iface { [&](data>& in, cl::sycl::queue* cmd) -> error_or { cmd->submit([&](cl::sycl::handler& h){ auto acc_buff = in.template access(h); auto si = host_data.template get<"doubles">().size(); h.parallel_for(cl::sycl::range<1>(si.get()), [=] (cl::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; }); }); /* cmd->submit([&](cl::sycl::handler& h){ auto acc_buff = in.template access(h); h.copy(acc_buff, &host_data); }); */ /** cl::sycl::host_accessor result{in.get_handle()}; std::cout<().get()<().get()<>(); auto& device = *our_device; cl_iface.template call <"foo">(device_data, &(device.get_handle())); device.get_handle().wait(); } }