Search code examples
clangopencl

Can the Clang version of OpenCL be specified?


An OpenCL program I originally wrote for an AMD GPU (RX 570) fails the runtime compilation on the Nvidia card (RTX 3060, latest drivers) with the message <kernel>:28:5: error: use of unknown builtin '__builtin_mul_overflow'.

Through the preprocessor macros I found the OpenCL code now gets compiled with Clang 3.4. According to the documentation, this version did not yet support __builtin_mul_overflow(), which was introduced in Clang 3.8.

Is it possible to specify OpenCL to use a newer Clang version? Or are the latest Nvidia drivers indeed limited to such an old compiler?


Solution

  • Unfortunately you can't control which compiler the OpenCL driver uses. You could try conditionally compiling the code to account for different compilers, but that's about it.