1
votes

I'm getting CL_INVALID_WORK_GROUP_SIZE, but my local work size is 299 and my max supported WORK_GROUP_SIZE is 1024.

According to the documentation:

CL_INVALID_WORK_GROUP_SIZE if local_work_size is specified and number of work-items specified by global_work_size is not evenly divisable by size of work-group given by local_work_size or does not match the work-group size specified for kernel using the attribute((reqd_work_group_size(X, Y, Z))) qualifier in program source.

in my case I have

size_t globalWorkSize[2] = { 299, 299 };
size_t localWorkSize[2] = { 299, 299 };
mErr = clEnqueueNDRangeKernel(mCmdQueue, mKernel[0], 2, nullptr,
                globalWorkSize, localWorkSize, 0, nullptr, nullptr);

It seems to me I have 299^2 work groups of 1 work item each, I don't get where the problem is to be honest.

The question is why am I getting that error?

1
Possible duplicate of CL_INVALID_WORK_GROUP_SIZE error - Mgetz
You local worksize is actually 299*299 which is greater than 1024, you are trying to enqueue 1 workgroup of size 299*299. You should also check CL_KERNEL_WORK_GROUP_SIZE which could be less than the CL_DEVICE_MAX_WORK_GROUP_SIZE. - kanna
@kanna has the right answer. Both those values apply to the total number of work-items in a group, not just one dimension. You'll need to make your group smaller. - pmdj
@kanna - make that an answer (it is correct). - Dithermaster

1 Answers

2
votes

You are trying to enqueue 1 workgroup of size 299*299 which is greater than 1024 i.e. CL_DEVICE_MAX_WORK_GROUP_SIZE.

Also based on the kernel device might not be able to run CL_DEVICE_MAX_WORK_GROUP_SIZE in a workgroup. Correct approach is to make sure local work size is less than or equal to CL_KERNEL_WORK_GROUP_SIZE which could be less than CL_DEVICE_MAX_WORK_GROUP_SIZE.