opencv: CL_INVALID_WORK_GROUP_SIZE issue

I have short test program trying to use OpenCL version of functions …

cv::ocl::setUseOpenCL(true); // enable || disable OpenCL in the processing of UMat

UMat img,gray;
imread("lena30.jpg", 1).copyTo(img);

cvtColor(TIimg, TIgray, COLOR_BGR2GRAY);
GaussianBlur(TIgray, TIgray, Size(5, 5), 1.25);
Canny(TIgray, TIgray, 0, 30);

Unfortunately at runtime test program complains on workgroupsize…

[ INFO:0] Successfully initialized OpenCL cache directory: /home/root/.cache/opencv/3.4.1/opencl_cache/
[ INFO:0] Preparing OpenCL cache configuration for context: 
OpenCL error CL_INVALID_WORK_GROUP_SIZE (-54) during call: clEnqueueNDRangeKernel('stage1_with_sobel', dims=2, globalsize=512x512x1, localsize=32x32x1) sync=false

How can I set workgroups size and other opencl params before function execution?

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Comments: 15 (3 by maintainers)

Most upvoted comments

Max work group size = 1024

I believe problem comes from here. OpenCV tries to occupy all available resources, but there are other limitations (like local memory size), which prevent that.

Take a look on similar issue: #13108.

Please try to override this line to something like:

maxWorkGroupSize_ = 256;

(or 128, or 64)

looks like maxWorkGroupSize 1024 is correct value for Vivante hardware.

is it possible to set work groups size dynamically from wirhin application code

no. maxWorkGroupSize_ gathering directly from OpenCL driver.

rebuilding OpenCV with updated value don’t take a much time, since only one file required to recompile, and few to link.