#pragma once #include #include #include #include namespace saw { namespace rmt { struct Sycl {}; } template<> class remote; /** * 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>{}; } }; template<> struct remote_address { private: remote* ctx_; SAW_FORBID_COPY(remote_address); SAW_FORBID_MOVE(remote_address); public: remote_address(remote& r_ctx): ctx_{&r_ctx} {} }; template<> class remote { private: SAW_FORBID_COPY(remote); SAW_FORBID_MOVE(remote); public: /** * Default constructor */ remote(){} /** * For now we don't need to specify the location since * we just create a default. */ conveyor>> resolve_address(){ return heap>(*this); } /** * Spin up a rpc server */ template conveyor> listen(const remote_address&){ return {}; } }; }