The Khronos™ Group today announced the ratification and public release of the OpenCL™ 2.1 provisional specification viewable at www.khronos.org/opencl/ so developers and implementers can provide feedback before finalization at the OpenCL forums. Comments can be made via https://www.khronos.org/opencl/opencl_feedback_forum.
The OpenCL 2.1 C++ kernel language is a static subset of C++14 that provides lambda functions, classes, templates, operator overloading, and many other C++ features to free developers from low-level coding details. OpenCL C++ enables reusable device libraries and containers for easily sharable code that includes templates and enables meta-programming.
In addition to the introduction of the OpenCL C++ shading language, OpenCL 2.1 brings enhancements to the OpenCL API, including:
- Subgroups, that expose hardware threading, are bought into core, together with additional subgroup query operations for increased flexibility;
- clCloneKernel enables copying of kernel objects and state for safe implementation of copy constructors in wrapper classes;
- Low-latency device timer queries support alignment of profiling between device and host code.
- Support for the new Khronos SPIR-V™ intermediate language in core for kernel language flexibility, sharing of common compiler front-ends, and the ability to ship kernels without exposing source code.
Khrnonos claims OpenCL 2.1 preserves “backwards compatibility and being able to ship on any OpenCL 2.0-capable hardware”.
SPIR-V (Standard Portable Intermediate Representation)
Important for commercial codes, OpenCL 2.1 will incorporate support for the new SPIR-V open standard, cross-API intermediate language that natively represents parallel compute and graphics. SPIR-V exposes the machine model for OpenCL 1.2, 2.0, 2.1 and Vulkan – including full flow control, and graphics and parallel constructs not supported in LLVM. SPIR-V also supports OpenCL 1.2, 2.0, 2.1 kernel languages as well as the GLSL shader language for Vulkan (under development).
See the following articles to learn more about using SPIR to protect their codes:
- Commercial OpenCL! SPIR 2.0 Protects IP Yet Allows Powerful, Portable, Source Code Free Kernels
- Try Intel’s OpenCL 2.0 SDK With SPIR
SPIR-V can split the compiler chain across multiple vendors’ products, enabling high-level language front-ends to emit programs in a standardized intermediate form to be ingested by Vulkan or OpenCL drivers. For hardware vendors, ingesting SPIR-V eliminated the need to build a high-level language source compiler into device drivers, significantly reducing driver complexity, and will enable a broad range of language and framework front-ends to run on diverse hardware architectures.
For developers, using SPIR-V means that kernel source code no longer has to be directly exposed, kernel load times can be accelerated and developers can choose the use of a common language front-end, improving kernel reliability and portability across multiple hardware implementations.