Permalink
Browse files

opencl: add functionality to query CL_KERNEL_WORK_GROUP_SIZE

  • Loading branch information...
1 parent b0b4cd7 commit fbfe645dcb65ce843c5c43d34d4eff405ef755a4 @upegelow upegelow committed Apr 6, 2012
Showing with 17 additions and 0 deletions.
  1. +1 −0 src/common/dlopencl.c
  2. +9 −0 src/common/opencl.c
  3. +7 −0 src/common/opencl.h
View
@@ -126,6 +126,7 @@ int dt_dlopencl_init(const char *name, dt_dlopencl_t **ocl)
success = success && dt_gmodule_symbol(module, "clGetEventProfilingInfo", (void (**)(void))&d->symbols->dt_clGetEventProfilingInfo);
success = success && dt_gmodule_symbol(module, "clGetKernelInfo", (void (**)(void))&d->symbols->dt_clGetKernelInfo);
success = success && dt_gmodule_symbol(module, "clEnqueueBarrier", (void (**)(void))&d->symbols->dt_clEnqueueBarrier);
+ success = success && dt_gmodule_symbol(module, "clGetKernelWorkGroupInfo", (void (**)(void))&d->symbols->dt_clGetKernelWorkGroupInfo);
if (!success) dt_print(DT_DEBUG_OPENCL, "[opencl_init] could not load all required symbols from library\n");
d->have_opencl = success;
View
@@ -498,6 +498,15 @@ int dt_opencl_get_work_group_limits(const int dev, size_t *sizes, size_t *workgr
}
+int dt_opencl_get_kernel_work_group_size(const int dev, const int kernel, size_t *kernelworkgroupsize)
+{
+ dt_opencl_t *cl = darktable.opencl;
+ if(!cl->inited || dev < 0) return -1;
+ if(kernel < 0 || kernel >= DT_OPENCL_MAX_KERNELS) return -1;
+
+ return (cl->dlocl->symbols->dt_clGetKernelWorkGroupInfo)(cl->dev[dev].kernel[kernel], cl->dev[dev].devid, CL_KERNEL_WORK_GROUP_SIZE, sizeof(size_t), kernelworkgroupsize, NULL);
+}
+
int dt_opencl_set_kernel_arg(const int dev, const int kernel, const int num, const size_t size, const void *arg)
{
View
@@ -134,6 +134,9 @@ int dt_opencl_get_max_work_item_sizes(const int dev, size_t *sizes);
/** return max size per dimension in sizes[3] and max total size in workgroupsize */
int dt_opencl_get_work_group_limits(const int dev, size_t *sizes, size_t *workgroupsize, unsigned long *localmemsize);
+/** return max workgroup size for a specifc kernel */
+int dt_opencl_get_kernel_work_group_size(const int dev, const int kernel, size_t *kernelworkgroupsize);
+
/** attach arg. */
int dt_opencl_set_kernel_arg(const int dev, const int kernel, const int num, const size_t size, const void *arg);
@@ -262,6 +265,10 @@ static inline int dt_opencl_get_work_group_limits(const int dev, size_t *sizes,
{
return -1;
}
+static inline int dt_opencl_get_kernel_work_group_size(const int dev, const int kernel, size_t *kernelworkgroupsize)
+{
+ return -1;
+}
static inline int dt_opencl_set_kernel_arg(const int dev, const int kernel, const size_t size, const void *arg)
{
return -1;

0 comments on commit fbfe645

Please sign in to comment.