[RFC][OpenCL] Changing default version for OpenCL kernel compilation to OpenCL 1.2


I would like to change the default version for OpenCL C kernels compilation
when ‘-std’/’-cl-std’ flag is not passed to clang.

The default version is currently - OpenCL 1.0. However, traditionally clang uses
recent popular versions for C/C++ languages. I, therefore, suggest aligning with
this strategy and use OpenCL 1.2 as a default version instead.

This means that the following command:

‘clang test.cl’

would be equivalent to the command

‘clang -cl-std=CL1.2 test.cl’


‘clang -std=CL1.2 test.cl’

The main reason to use OpenCL 1.2 instead of OpenCL 2.0 (which is a more recent
stable version) is that OpenCL 1.2 still appears to be the most widely adopted
among all devices supporting the OpenCL standard.

As a comparison, currently clang uses the following defaults for:

  • (.cpp) -std=c++14
  • (.c) -std=c17

Let me know if you have any feedback or other suggestions for this proposal.

Kind regards,