OpenCL template kernel

With CUDA I can have templatized kernels. Does anybody know if that is or will be supported for OpenCL? A quick scan of the OpenCL spec did not find anything.

No, OpenCL doesn’t support templates.

It’s a huge disappointment, since they’re so useful in CUDA.

You can see from some of the Nvidia code examples that the way to work around it is to make a wrapper around your source code, and inject your own macro-like substitutions using string insertion and concatenation, then compile that newly assembled string.

That process likely made your eyes bug out incredulously… but it’s the best way right now to get efficienct variations based on the same code framework.