From 7479b39379bcf79dfa73a61643538832c2571c49 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Fri, 17 May 2024 18:14:41 +0200 Subject: Trying to get rpc interaction with iface working --- modules/remote-sycl/c++/remote.hpp | 87 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 84 insertions(+), 3 deletions(-) (limited to 'modules/remote-sycl/c++/remote.hpp') diff --git a/modules/remote-sycl/c++/remote.hpp b/modules/remote-sycl/c++/remote.hpp index 0d10ba7..70c8032 100644 --- a/modules/remote-sycl/c++/remote.hpp +++ b/modules/remote-sycl/c++/remote.hpp @@ -1,6 +1,8 @@ #pragma once #include +#include +#include #include @@ -12,12 +14,91 @@ struct Sycl {}; template<> class remote; -template -class rpc_server { +/** + * Remote data class for the Sycl backend. + */ +template +class remote_data { private: + id id_; + id_map* map_; +public: + /** + * Main constructor + */ + remote_data(const id& id, id_map>& map): + id_{id}, + map_{&map} + {} + + /** + * Request data asynchronously + */ + conveyor> on_receive(); /// Stopped here +}; +namespace impl { + +template +struct rpc_id_map_helper { + static_assert(always_false, "Only support Interface schema types."); +}; + +template +struct rpc_id_map_helper, Encoding> { + std::tuple>...> maps; +}; +} +/** + * Rpc Server class for the Sycl backend. + */ +template +class rpc_server { +private: + using IfaceCtx = cl::sycl::queue*; + /** + * Command queue for the sycl backend + */ cl::sycl::queue cmd_queue_; + + /** + * The interface including the relevant context class. + */ + interface cl_interface_; + + /** + * + */ + impl::rpc_id_map_helper storage_; public: + rpc_server(interface cl_iface): + cmd_queue_{}, + cl_interface_{std::move(cl_iface)}, + storage_{} + {} + template + remote_data request_data(id dat){ + return {data, std::get>>(storage_.maps)}; + } + + /** + * rpc call + */ + template + error_or< + id< + typename schema_member_type::type::ValueType::ResponseT + > + > call(data_or_id::type::ValueType::RequestT, Encoding> input){ + + auto eod = cmd_queue_.template call(std::move(input), &cmd_queue_); + + if(eod.is_error()){ + return std::move(eod.get_error()); + } + + return id::type::ValueType::ResponseT>{}; + } }; @@ -59,7 +140,7 @@ public: */ template conveyor> listen(const remote_address&){ - + return {}; } }; -- cgit v1.2.3