OpenCL C++ on OpenCL 1.2 devices - is it possible?


Is it possible to use OpenCL C++ on accelerator/kernel side with devices that support only OpenCL 1.1 and OpenCL 1.2?

1 Like

It’s possible in theory. Caveat: I haven’t tried this in practice!

Here’s what you’d need:

  1. A compiler to compile the C++ kernel code to SPIR-V. I think you will have better luck with the recent community-driven “C++ for OpenCL” than the OpenCL 2.2 “OpenCL C++”. More information about “C++ for OpenCL” can be found in this excellent IWOCL 2020 presentation from Anastasia Stulova.

  2. An OpenCL 1.2 implementation that supports the extension cl_khr_il_program, to consume and execute the code you compiled to SPIR-V.

There may be some restrictions on what you can and cannot do in yoru C++ for OpenCL program in order to conform to the limitations of OpenCL 1.2, particularly regarding the generic address space.

Good luck!