Less is more with OpenCL 3.0: Implementing the 2.x spec was tricky – so now everything beyond 1.2 is optional
Cross-platform software acceleration API should be easier to jump on
The Khronos Group has pushed out the Open CL 3.0 provisional specification, a major update to the cross-platform API used for accelerating software performance by using the concurrent programming capabilities of GPUs and CPUs.
OpenCL is part of a family of projects that also includes SPIR-V, an intermediate representation that targets both Vulkan (cross-platform GPU graphics API) and OpenCL drivers, and SYCL (C++ template libraries to simplify OpenCL coding).
The ability to do general-purpose computing on GPUs, which are optimised for parallel processing, as well as easily taking advantage of multi-threading on a CPU, can make a massive difference in performance, not only at the high end in supercomputers, but also on PCs and mobiles. That said, even OpenCL 1.2, released in 2011, appears to be good enough for many developers.
"OpenCL 1.2 has proven itself as the baseline needed by all vendors and markets," said Neil Trevett, president of the Khronos Group. Therefore, OpenCL 3.0 [PDF] "makes all functionality beyond version 1.2 optional". While this may seem like a backward step, the idea is that a broad range of devices can have OpenCL 3.0-compliant drivers, and that developers will query for additional features, such as those introduced in OpenCL 2.x, using them only if they are available. This also means it is easy for implementers to "upgrade" drivers, simply by adding any missing OpenCL 2.x queries.
The change is a reaction to issues with the "monolithic" OpenCL 2.x specifications, which were a deterrent to adoption since it was challenging to implement everything. Khronos even suggests in its presentation that implementers "may choose to drop OpenCL 2.x features if not relevant to target markets, to reduce costs and increase quality."
The risk is that OpenCL 1.2 is now set in stone as a base API and developers may be reluctant to move beyond it.
OpenCL C, a specification for C programming language extensions to support parallel programming, has been updated to OpenCL C 3.0. The OpenCL C++ language, however, has been abandoned in favour of C++ for OpenCL, a Clang project which is also compatible with OpenCL C and outputs SPIR-V.
New features in OpenCL 3.0 include asynchronous DMA (Direct Memory Access) extensions, aimed at improving support for embedded processors which implement DMA.
Usage of OpenCL is increasing, says Khronos. According to its presentation, Adobe's Premiere Rush video editing application has 200,000 lines of OpenCL code, and the popular [email protected] project uses OpenCL. An analysis of open-source GitHub repositories shows around 9,500 OpenCL projects, double the number compared to three years ago (though that statistic does not look so good if you consider that the total number of GitHub repositories has also more than doubled over that period). The group additionally highlighted the work with Microsoft and Collabora to enable OpenCL on DirectX 12, and invited support for a potential new project to enable OpenCL on Apple's Metal API for graphics programming on iOS and macOs.
With OpenCL 3.0, less is more: the key feature is to make the specification modular so that future enhancements can be introduced gradually and implemented by a subset of drivers according to what is appropriate for the targeted devices. This means that adoption of OpenCL 3.0 should in theory be quick, because of the ease of migrating OpenCL 1.2 drivers, even if actual functionality is little changed. ®