The C++ for OpenCL Programming Language

preview_player
Показать описание
This video was presented at the online version of IWOCL / SYCLcon 2020.

Authors: Anastasia Stulova, Neil Hickey, Sven van Haastregt, Marco Antognini and Kevin Petit (Arm)

Additional Information and Slides:

Presentation Abstract
The OpenCL programming model has traditionally been C based. On the host side however, C++ gained quite a lot of popularity lately, with C++ bindings becoming available [1]. The kernel side language has been primarily C99 based for a very long time up until last year when in Clang 9 experimental support of C++ for OpenCL has been released [2].
The main motivation for adding this language mode is to allow developers to leverage modern C++ features when writing complex applications for GPUs and other accelerators. In contrast to the OpenCL C++ language released under public Khronos specification in 2015, C++ for OpenCL does not break backwards compatibility with OpenCL C and therefore opens up a gradual transition path for existing applications and allows reusing existing libraries written in OpenCL C. It works just the same way as C and C++.

The C++ for OpenCL language combines C++17 and OpenCL C v2.0. It can be used to compile kernel code to SPIR-V that can then be loaded by OpenCL v2.0 compatible drivers with some limitations. However, driver updates are also planned in the future to allow taking full advantage of C++ functionality.

In this presentation we explain the main design philosophy and features of the new language along with its restrictions. The documentation is open and it is hosted on the Khronos github repository [3]. It is available for everyone to contribute to. We plan to explain how Clang and other open source tools can be used to compile the code written in the new language and how the compiled output can be used with existing OpenCL capable devices. In the conclusion we will also draw a comparison with other similar languages, such as SYCL or CUDA, and try to provide some recommendations of language choice depending on use cases.

Additionally, we will present some early experiments with the new language used for OpenCL applications and invite developers for evaluation and feedback about future directions for this development.

IWOCL Newsletter
Рекомендации по теме
Комментарии
Автор

Thank you for this excellent overview of C++ for OpenCL Anastasia! I look forward to finding a project to apply it to. Also, thanks for your contributions to LLVM.

Dithermaster
Автор

I'm super excited for this!
And therefore a bit sad that CreateProgramWithIL is optional in OpenCL 3.0, because then Nvidia will probably never support it. (And I don't want to maintain a seperate Vulkan layer, or CUDA implementation just for Nvidia devices)

andreaslegomovies