Is it possible to get the warp/wavefront size in runtime?
(I need it inside the kernel so a predefined macro would be great, but if it’s only possible to find this value at the host side than I can pass it to the kernel at compilation time.)
Thanks in advance,
I don’t think these concepts exist in OpenCL. While I accept that in some underlying hardware
they will exist, they are not universal. If you desperately need them AND you know you will only
ever use NVIDIA or AMD cards then you can assume the warp size is 32 for NVIDIA and I think
the wavefront size is 64 for AMD. You can test before starting your kernel which platfom you
are using by looking at the clGetDeviceInfo() and set the value appropriately.
Saying all that, I would avoid developing codes that require this information.
The information can be usually be retrieved from the CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE parameter in the clGetKernelWorkGroupInfo(). Although this is theoretically kernel+device specific, I found that on NVIDIA and AMD GPUs it always returns the GPU warp/wavefront size.