diff --git a/include/ircd/cl.h b/include/ircd/cl.h index 991bd0a9a..9cc294c40 100644 --- a/include/ircd/cl.h +++ b/include/ircd/cl.h @@ -111,6 +111,12 @@ struct ircd::cl::kern void *handle {nullptr}; public: + std::array compile_group_size(void *dev = nullptr) const; + size_t preferred_group_size_multiple(void *dev = nullptr) const; + size_t group_size(void *dev = nullptr) const; + size_t local_mem_size(void *dev = nullptr) const; + size_t stack_mem_size(void *dev = nullptr) const; + void arg(const int, data &); void arg(const int, const const_buffer &); template void arg(const int, const T &); diff --git a/ircd/cl.cc b/ircd/cl.cc index 57a7db317..e22baec47 100644 --- a/ircd/cl.cc +++ b/ircd/cl.cc @@ -939,6 +939,56 @@ ircd::cl::kern::arg(const int i, call(clSetKernelArg, cl_kernel(handle), i, ircd::size(buf), ircd::data(buf)); } +std::array +ircd::cl::kern::compile_group_size(void *const dev) +const +{ + char buf[24]; + const auto handle(cl_kernel(this->handle)); + constexpr auto flag(CL_KERNEL_COMPILE_WORK_GROUP_SIZE); + return info>(clGetKernelWorkGroupInfo, handle, cl_device_id(dev), flag, buf); +} + +size_t +ircd::cl::kern::preferred_group_size_multiple(void *const dev) +const +{ + char buf[16]; + const auto handle(cl_kernel(this->handle)); + constexpr auto flag(CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE); + return info(clGetKernelWorkGroupInfo, handle, cl_device_id(dev), flag, buf); +} + +size_t +ircd::cl::kern::group_size(void *const dev) +const +{ + char buf[16]; + const auto handle(cl_kernel(this->handle)); + constexpr auto flag(CL_KERNEL_WORK_GROUP_SIZE); + return info(clGetKernelWorkGroupInfo, handle, cl_device_id(dev), flag, buf); +} + +size_t +ircd::cl::kern::local_mem_size(void *const dev) +const +{ + char buf[16]; + const auto handle(cl_kernel(this->handle)); + constexpr auto flag(CL_KERNEL_LOCAL_MEM_SIZE); + return info(clGetKernelWorkGroupInfo, handle, cl_device_id(dev), flag, buf); +} + +size_t +ircd::cl::kern::stack_mem_size(void *const dev) +const +{ + char buf[16]; + const auto handle(cl_kernel(this->handle)); + constexpr auto flag(CL_KERNEL_PRIVATE_MEM_SIZE); + return info(clGetKernelWorkGroupInfo, handle, cl_device_id(dev), flag, buf); +} + // // code //