Skip to content

Commit e4fff03

Browse files
jenshannoschwalmTurboGit
authored andcommitted
Fix reading of OpenCL max work group dimension
According to OpenCL specs this is an unsigned int instead of size_t, so we should read that.
1 parent 818055e commit e4fff03

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/common/opencl.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,6 @@ static gboolean _opencl_device_init(dt_opencl_t *cl,
524524
char *deviceversion = NULL;
525525
size_t deviceversion_size;
526526

527-
size_t infoint;
528527
size_t *infointtab = NULL;
529528
cl_device_type type;
530529
cl_bool image_support = 0;
@@ -838,10 +837,12 @@ static gboolean _opencl_device_init(dt_opencl_t *cl,
838837
" COMPUTE UNITS: %d\n", cl->dev[dev].compute_units);
839838
dt_print_nts(DT_DEBUG_OPENCL,
840839
" MAX WORK GROUP SIZE: %zu\n", cl->dev[dev].workgroup_size);
840+
841+
cl_uint max_item_dimension = 0;
841842
(cl->dlocl->symbols->dt_clGetDeviceInfo)(devid, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS,
842-
sizeof(infoint), &infoint, NULL);
843+
sizeof(max_item_dimension), &max_item_dimension, NULL);
843844
dt_print_nts(DT_DEBUG_OPENCL,
844-
" MAX WORK ITEM DIMENSIONS: %zu\n", infoint);
845+
" MAX WORK ITEM DIMENSIONS: %d\n", max_item_dimension);
845846

846847
size_t infointtab_size;
847848
err = dt_opencl_get_device_info(cl, devid, CL_DEVICE_MAX_WORK_ITEM_SIZES,
@@ -850,7 +851,7 @@ static gboolean _opencl_device_init(dt_opencl_t *cl,
850851
{
851852
dt_print_nts(DT_DEBUG_OPENCL,
852853
" MAX WORK ITEM SIZES: [ ");
853-
for(size_t i = 0; i < infoint; i++)
854+
for(size_t i = 0; i < max_item_dimension; i++)
854855
dt_print_nts(DT_DEBUG_OPENCL, "%zu ", infointtab[i]);
855856
free(infointtab);
856857
infointtab = NULL;

0 commit comments

Comments
 (0)