diff --git a/include/ircd/cl.h b/include/ircd/cl.h index 209a8fdfc..991bd0a9a 100644 --- a/include/ircd/cl.h +++ b/include/ircd/cl.h @@ -76,6 +76,7 @@ struct ircd::cl::data data(const size_t, const const_buffer &); // device ro data(const mutable_buffer &, const bool wonly = false); // host rw data(const const_buffer &); // host ro + data(data &, const pair &); // subbuffer data(const data &) = delete; data() = default; data(data &&) noexcept; diff --git a/ircd/cl.cc b/ircd/cl.cc index c7afd2e9d..850001283 100644 --- a/ircd/cl.cc +++ b/ircd/cl.cc @@ -1246,6 +1246,20 @@ ircd::cl::data::data(const const_buffer &buf) throw_on_error(err); } +ircd::cl::data::data(data &master, + const pair &slice) +{ + cl_mem_flags flags {0}; + + cl_buffer_region region {0}; + region.origin = slice.second; + region.size = slice.first; + + int err {CL_SUCCESS}; + handle = clCreateSubBuffer(cl_mem(master.handle), flags, CL_BUFFER_CREATE_TYPE_REGION, ®ion, &err); + throw_on_error(err); +} + ircd::cl::data::data(data &&o) noexcept :handle{std::move(o.handle)}