summaryrefslogtreecommitdiff
path: root/modules/remote-sycl/c++
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2024-05-22 17:22:18 +0200
committerClaudius "keldu" Holeksa <mail@keldu.de>2024-05-22 17:22:18 +0200
commit97ec4b9edfa88302878b523baf09674503d19fab (patch)
tree1703c491303dcc8d23decdeef858a52fe6c67c0e /modules/remote-sycl/c++
parent875ce0328d1d919d639797972e4cf60c6715503f (diff)
Progress in fixing remote-sycl and ammended minor parts in echo_client
Diffstat (limited to 'modules/remote-sycl/c++')
-rw-r--r--modules/remote-sycl/c++/SConscript24
-rw-r--r--modules/remote-sycl/c++/remote.hpp32
2 files changed, 36 insertions, 20 deletions
diff --git a/modules/remote-sycl/c++/SConscript b/modules/remote-sycl/c++/SConscript
index e902c22..29b7ca4 100644
--- a/modules/remote-sycl/c++/SConscript
+++ b/modules/remote-sycl/c++/SConscript
@@ -10,29 +10,29 @@ Import('env')
dir_path = Dir('.').abspath
# Environment for base library
-dev_opencl_env = env.Clone();
+dev_sycl_env = env.Clone();
-dev_opencl_env.sources = sorted(glob.glob(dir_path + "/*.cpp"))
-dev_opencl_env.headers = sorted(glob.glob(dir_path + "/*.hpp"))
+dev_sycl_env.sources = sorted(glob.glob(dir_path + "/*.cpp"))
+dev_sycl_env.headers = sorted(glob.glob(dir_path + "/*.hpp"))
-env.sources += dev_opencl_env.sources;
-env.headers += dev_opencl_env.headers;
+env.sources += dev_sycl_env.sources;
+env.headers += dev_sycl_env.headers;
## Shared lib
objects_shared = []
-dev_opencl_env.add_source_files(objects_shared, dev_opencl_env.sources, shared=True);
-env.library_shared = dev_opencl_env.SharedLibrary('#build/forstio-remote-opencl', [objects_shared]);
+dev_sycl_env.add_source_files(objects_shared, dev_sycl_env.sources, shared=True);
+env.library_shared = dev_sycl_env.SharedLibrary('#build/forstio-remote-sycl', [objects_shared]);
## Static lib
objects_static = []
-dev_opencl_env.add_source_files(objects_static, dev_opencl_env.sources, shared=False);
-env.library_static = dev_opencl_env.StaticLibrary('#build/forstio-remote-opencl', [objects_static]);
+dev_sycl_env.add_source_files(objects_static, dev_sycl_env.sources, shared=False);
+env.library_static = dev_sycl_env.StaticLibrary('#build/forstio-remote-sycl', [objects_static]);
# Set Alias
-env.Alias('library_remote_opencl', [env.library_shared, env.library_static]);
+env.Alias('library_remote_sycl', [env.library_shared, env.library_static]);
-env.targets += ['library_remote_opencl'];
+env.targets += ['library_remote_sycl'];
# Install
env.Install('$prefix/lib/', [env.library_shared, env.library_static]);
-env.Install('$prefix/include/forstio/remote/opencl/', [dev_opencl_env.headers]);
+env.Install('$prefix/include/forstio/remote/sycl/', [dev_sycl_env.headers]);
diff --git a/modules/remote-sycl/c++/remote.hpp b/modules/remote-sycl/c++/remote.hpp
index 86799b6..d4b114a 100644
--- a/modules/remote-sycl/c++/remote.hpp
+++ b/modules/remote-sycl/c++/remote.hpp
@@ -36,6 +36,16 @@ public:
*/
conveyor<data<T,Encoding>> on_receive(); /// Stopped here
};
+
+template<typename T, uint64_t D>
+class data<schema::Array<T,D>, encode::Native<rmt::Sycl>> {
+private:
+ cl::sycl::buffer<typename native_data_type<T>::type, D> device_data_;
+
+ static_assert(D==1u, "For now we only support 1D Arrays");
+public:
+};
+
namespace impl {
template<typename Iface, typename Encoding>
@@ -53,8 +63,10 @@ struct rpc_id_map_helper<schema::Interface<Members...>, Encoding> {
*/
template<typename Iface, typename Encoding>
class rpc_server<Iface, Encoding, rmt::Sycl> {
+public:
+ using InterfaceCtxT = cl::sycl::queue*;
+ using InterfaceT = interface<Iface, Encoding, InterfaceCtxT>;
private:
- using IfaceCtx = cl::sycl::queue*;
/**
* Command queue for the sycl backend
*/
@@ -63,14 +75,14 @@ private:
/**
* The interface including the relevant context class.
*/
- interface<Iface, Encoding, IfaceCtx> cl_interface_;
+ interface<Iface, Encoding, InterfaceCtxT> cl_interface_;
/**
*
*/
impl::rpc_id_map_helper<Iface, Encoding> storage_;
public:
- rpc_server(interface<Iface, Encoding, IfaceCtx> cl_iface):
+ rpc_server(interface<Iface, Encoding, InterfaceCtxT> cl_iface):
cmd_queue_{},
cl_interface_{std::move(cl_iface)},
storage_{}
@@ -87,9 +99,9 @@ public:
template<string_literal Name>
error_or<
id<
- typename schema_member_type<Name, Iface>::type::ValueType::ResponseT
+ typename schema_member_type<Name, Iface>::type::ResponseT
>
- > call(data_or_id<typename schema_member_type<Name, Iface>::type::ValueType::RequestT, Encoding> input){
+ > call(data_or_id<typename schema_member_type<Name, Iface>::type::RequestT, Encoding> input){
auto eod = cl_interface_.template call<Name>(std::move(input), &cmd_queue_);
@@ -97,7 +109,9 @@ public:
return std::move(eod.get_error());
}
- return id<typename schema_member_type<Name, Iface>::type::ValueType::ResponseT>{};
+ // using ResponseTMap = id_map<data<>>
+
+ return id<typename schema_member_type<Name, Iface>::type::ResponseT>{};
}
};
@@ -139,8 +153,10 @@ public:
* Spin up a rpc server
*/
template<typename Iface, typename Encoding>
- conveyor<rpc_server<Iface, Encoding, rmt::Sycl>> listen(const remote_address<rmt::Sycl>&){
- return {};
+ rpc_server<Iface, Encoding, rmt::Sycl> listen(const remote_address<rmt::Sycl>&, typename rpc_server<Iface, Encoding, rmt::Sycl>::InterfaceT iface){
+ using RpcServerT = rpc_server<Iface, Encoding, rmt::Sycl>;
+ using InterfaceT = typename RpcServerT::InterfaceT;
+ return {std::move(iface)};
}
};