Skip to main content

Khronos Blog

Significant New OpenCL Open Source Tools and Resources to be Discussed at Annual LLVM Developers Meeting

The OpenCL™ working group at Khronos® continues to deepen our collaboration with the LLVM community, and we are pleased to share a number of exciting developments, many of which will be discussed at the upcoming LLVM Developers Meeting.

In October 2021, the LLVM Compiler Infrastructure Project released Clang 13 with enhanced support for the OpenCL C and C++ for OpenCL kernel languages, including:

  • Addition of significant OpenCL C 3.0 functionality.
  • A distinct file extension (.clcpp) for the files containing C++ for OpenCL sources.
  • Addition by default of all OpenCL built-in function declarations during parsing, enabling Clang to compile full OpenCL without additional or hidden flags.
  • Support for new OpenCL extensions including cl_khr_integer_dot_product and cl_khr_extended_bit_ops.
  • Simplification of the OpenCL extension pragma in kernel sources.

For more details please visit the release documentation at

Compiler Explorer is a widely used web-based interactive compiler for dozens of popular languages including C, C++, and Rust, with inspection of the compiled output through a web browser without the need for installed tools. OpenCL support has now been added to Compiler Explorer, with full syntax highlighting of OpenCL C and C++ for OpenCL kernel language sources and inspection of compiled output in SPIR-V or vendor assembly syntax, speeding code inspection for OpenCL developers and enabling code snippets to be shared more conveniently. Developers are invited to evaluate this feature:

Compiler Explorer Compiling OpenCL Kernels into SPIR-V

The libclcxx project has now been bootstrapped as a new open source project to gather C++ for OpenCL libraries. The first experimental library is <type_traits> that contains all standard C++ and new OpenCL-specific type traits, enhancing the power of metaprogramming algorithms by leveraging existing C++ libraries and libcxx from the LLVM project. More details about this work will be presented at the LLVM Developers Meeting. New OpenCL libraries with C++ features can be ported from existing implementations or written from scratch. Public contributions are invited and encouraged from the OpenCL developer community.

Khronos has made substantial investments in strengthening the SPIR-V backend for LLVM and the OpenCL Working Group is pleased to release early results from testing that provide insights into compilation coverage using the OpenCL conformance test suite and LLVM’s tests. Work in the past months has been dedicated to the overall design of LLVM’s new backend and its integration with the Clang frontend, with particular focus on parsing OpenCL kernel language sources. Khronos will soon finalize this design and commence integration into the upstream LLVM repository. To speed progress, a special panel is going to take place at the LLVM Developers Meeting to discuss the overall design and formulate a concrete list of actions.

Meanwhile, the development of SPIRV-LLVM-Translator continues at full speed. Over the past months, several features have been added including cl_khr_integer_dot_product and vendor extensions, and multiple refactorings have reduced compilation time.

The upcoming LLVM Developers Meeting takes place on November 16-19 2021, and includes multiple significant OpenCL-related talks and discussions. We invite all interested developers to register at and participate in:

  • “OpenCL support in clang status: OpenCL C 3.0, improvements and future directions” talk by Anton Zabaznov on Nov 18, 9:30 - 10:00 AM PT
  • “libclcxx: C++ libraries for OpenCL”, talk by Ole Marius Strohm, Ishfaq Wardag, and Anastasia Stulova on Nov 17, 9:30 - 10:30 AM PT
  • “SPIR-V support in LLVM and Clang” panel with panelists Vyacheslav Zakharin, Konrad Trifunovic, Anastasia Stulova, Victor Lomuller, and Alexey Bader on Nov 19 9:30 - 10:30 AM PT

All developers are invited to use and experiment with these new OpenCL tooling features and provide feedback via OpenCL’s GitHub. We look forward to hearing from you!