diff --git a/include/ircd/cl.h b/include/ircd/cl.h index 9d00172ee..ecf079d7e 100644 --- a/include/ircd/cl.h +++ b/include/ircd/cl.h @@ -64,6 +64,10 @@ struct ircd::cl::data void *handle {nullptr}; public: + uint flags() const; + size_t size() const; + char *ptr() const; // host only + data(const size_t, const mutable_buffer &, const bool wonly = false); // device rw data(const size_t, const const_buffer &); // device ro data(const mutable_buffer &, const bool wonly = false); // host rw diff --git a/ircd/cl.cc b/ircd/cl.cc index 8f2290e67..d5a01777d 100644 --- a/ircd/cl.cc +++ b/ircd/cl.cc @@ -813,6 +813,36 @@ catch(const std::exception &e) return; } +char * +ircd::cl::data::ptr() +const +{ + assert(handle); + + char buf[sizeof(void *)] {0}; + return info(clGetMemObjectInfo, cl_mem(mutable_cast(handle)), CL_MEM_SIZE, buf); +} + +size_t +ircd::cl::data::size() +const +{ + assert(handle); + + char buf[sizeof(size_t)] {0}; + return info(clGetMemObjectInfo, cl_mem(mutable_cast(handle)), CL_MEM_SIZE, buf); +} + +uint +ircd::cl::data::flags() +const +{ + assert(handle); + + char buf[sizeof(uint)] {0}; + return info(clGetMemObjectInfo, cl_mem(mutable_cast(handle)), CL_MEM_FLAGS, buf); +} + // // cl::work (event) //