New and Enhanced OpenCL Open Source Tools & Resources

Today marks the start of the 7th Annual International Workshop on OpenCL (IWOCL). Khronos is excited to participate in the annual gathering of OpenCL, SYCL, and SPIR developers, researchers, and suppliers. There are many talks planned on the evolution and advancement of OpenCL, including a Khronos Advisory Panel BOF chaired by Khronos President and Khronos OpenCL Working Group Chair, Neil Trevett.

Over the past few months, the recently formed Khronos OpenCL Tooling Subgroup has been focused on developing and enhancing open source tools and components. These tools, targeted at embedded systems and heterogeneous computation applications, will be accessible to everyone in the OpenCL ecosystem. In a recent blog post, the OpenCL Tooling Subgroup discussed its activities to strengthen collaboration with the LLVM community. Today, the Subgroup shares more details about some of these tools and resources for OpenCL open standard for heterogeneous parallel compute:

  1. clspv compiler

    An open-source prototype compiler, clspv, cross-compiles a subset of OpenCL C to Vulkan compute shader SPIR-V to enable OpenCL C kernels to be executed on a Vulkan run-time. This compiler makes heavy use of LLVM technology to first generate SPIR code from Clang and then finesse it into SPIR-V for Vulkan use, with a number of LLVM passes being used for performing the transformation. This prototype compiler shares similar goals to Khronos’ Vulkan Portability Initiative which, in July 2018, started developing extension specifications, open-source library code and language tools, and conformance tests to define the set of Vulkan capabilities that can be made universally available across all major platforms that only have Direct3D and Metal native drivers using cross-compilation and layered libraries.
  1. OpenCL C and C++ for OpenCL in Clang

    The Clang project provides a compiler frontend and tooling infrastructure for languages in the C family (C, C++, Objective C/C++, OpenCL, CUDA, and RenderScript) for the LLVM project. The OpenCL Tooling Sub Group has been actively working on frontend support for all OpenCL C language versions in Clang. Recently, experimental support for C++ in OpenCL has started to be implemented in Clang 9.0 supporting features from both OpenCL C 2.0 and C++17. This new OpenCL language mode can be activated by passing -std=c++ to Clang. Standard OpenCL C code can be processed with this new mode, as well as the additional C++ features. This work enables existing OpenCL C applications to incrementally transition to using C++ capabilities. The C++ for OpenCL in Clang frontend is compatible with any OpenCL 2.0 drivers with SPIR-V ingestion. Developers are invited to start using the project and provide initial feedback, including through using Compiler Explorer.

    LLVM passes are enabled to prevent the wrong optimization for SPMD execution and optimize the use of language address spaces. OpenCL support in Clang/LLVM includes full AMD GPU backend support for compute and graphics. The SPIR target used to perform target agnostic compilation into LLVM IR is inherited from the older SPIR format but is currently being evolved by the upstream community to be widely used by various tools as an LLVM-based interoperability format—functioning as a bridge to LLVM to and from other tooling components, including translation to SPIR-V with the SPIRV-LLVM Translator (described below).
  1. libclc (OpenCL libs implementation) part of LLVM ecosystem
    libclc is an open source, BSD/MIT dual-licensed implementation of the library for the OpenCL C programming language, as specified by the OpenCL 1.1 Specification. Designed to be portable and extensible, libclc is intended to be used with the Clang compiler's OpenCL frontend.
  1. SPIRV-LLVM Translator

    The SPIR-LLVM Translator exists as a library and a stand-alone tool for bi-directional translation between SPIR-V and LLVM IR. The translator can be built with the latest (nightly) package of LLVM. It enables the generation of a SPIR-V module from OpenCL source code via LLVM IR generated by Clang and also enables the import of a SPIR-V module generated by another front end in order to optimize it using the LLVM toolchain.

The OpenCL Working Group and the OpenCL Tooling Subgroup are always seeking ways to improve their its offerings to the industry, and developer input and feedback is vital. If you have any comments or questions, please join us on the OpenCL channel of the Khronos Developers Slack at khr.io/slack or via OpenCL’s GitHub repository. If you are interested in joining Khronos to participate directly in the OpenCL Working Group, please visit https://www.khronos.org/members/.

Khronos, EGL, glTF, NNEF, OpenVG, OpenVX, OpenXR, SPIR, SPIR-V, SYCL, Vulkan and WebGL are trademarks or registered trademarks of The Khronos Group Inc. OpenCL is a trademark of Apple Inc. and OpenGL and OpenML are registered trademarks and the OpenGL ES and OpenGL SC logos are trademarks of Hewlett Packard Enterprise used under license by Khronos. All other product names, trademarks, and/or company names are used solely for identification and belong to their respective owners.
Authored by

Comments