RFC: Adding support for an OpenCL 3.0 compatible C++ for OpenCL 2021

Hi, all!

As OpenCL C 3.0 is getting support in clang there is a wish to expand C++ for
OpenCL to be compatible with OpenCL 3.0 as well. Being able to support OpenCL
3.0 is important in making C++ for OpenCL a viable option for as many platforms
as possible.

Arm is therefore proposing adding a new version of C++ for OpenCL which will
add support for OpenCL 3.0. This version will aim to be backwards compatible
with OpenCL C 3.0. This will involve a new language version of C++ for OpenCL,
currently called C++ for OpenCL 2021 in the draft of the new documentation [1].

----- Implementation Details -----

As the biggest changes in OpenCL 3.0 are making some 2.0 features optional, and
a lot of work as already been done in clang to support OpenCL C 3.0 [2] there
shouldn’t be a need for any big conceptual changes in clang as a result of this
work. Our hope is to reuse the work done for OpenCL C 3.0 and apply similar
logic to C++ mode.

Most of the work is expected to be related to making the ‘generic’ address space
optional. Currently this address space is used for several implicitly generated
constructors and operators, so these will need to be adjusted.

This should still be able to leverage work done for OpenCL C 3.0. For example
this has already dealt with detecting when the ‘generic’ address space is
available. This can then be used to adjust the current C++ for OpenCL
implementation without requiring large scale changes.


Were you aware of OpenACC as well?


Hi Phil,

Not sure if you mean anything specifically. As far as I am aware upstream clang doesn’t have support for OpenACC directives.

The current list of supported accelerator technologies in clang includes OpenCL, SYCL, OpenMP, CUDA and HIP.



Ah ok thanks, I’ll look it up.