I've read, that OpenCL kernels are grouped like OpenGL compute shaders. That means, that you can define how many invocations should be executed within a workgroup. These invocations which are in the same workgroup, can communicate with so called shared variables.

In OpenCL there is the CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE also called warp size. Which is 32 for my GPU. That means, when allocating less than 32 invocations per workgroup (OpenCL), your GPU is not fully used. As far as I understood, it has to do with hardware specifications. Where 32 cores on my GPU are grouped together as a warp and also executed together. When allocating less than 32 invocations, the rest of the cores within that hardware group are not used or idle.

Do I have the same restrictions on OpenGL compute shaders? My GPU has 3072 shader units, when executing a post processing algorithm on OpenGL compute shader, does it make sense to allocate the workgroup size to be a multiple of 32? Even, when no interaction between neighboring pixels exists?

For example we have a 1024 x 1024 rgb32f image, and we only want to apply some calculation to it ... we could define workgroup size to be x,y,z = 1. and execute 1024 x 1024 x 1 workgroups. Or, we can define workgroup size to be x = 32 and y,z = 1 and execute 32 x 1024 x 1 workgroups.

maybe your answer is: Yes of cause, it is hardware specified... but I also think about the shader compiler... maybe it is trying to perfectly spread the work to the cores.

  • $\begingroup$ Here is a link that has some nice perf tips. It is AMD specific, but many of the other vendors have similar tips (specific to compute shaders not the entire guide) The compute recommendations are near the bottom of the page. gpuopen.com/performance $\endgroup$
    – pmw1234
    Nov 2, 2022 at 14:48

1 Answer 1


The hardware is the same either way, and the execution models are the same. It's the underlying execution model and hardware that creates this effect. So they will be the same for OpenGL compute shaders and OpenCL.

  • $\begingroup$ so using 32x1x1 invocation per workgroup should be faster than using 1x1x1invocations $\endgroup$
    – Thomas
    Nov 2, 2022 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.