Khronos’ OpenCL, SYCL, and SPIR-V Standards Find Growing Synergy with LLVM’s Compiler Community
OpenCL Tooling Subgroup Working for Closer Interaction with LLVM
The Khronos® OpenCL™ working group recently created a new Tooling Subgroup with the aim of improving the tools ecosystem for this widely-used open standard for heterogeneous computation—in particular, boosting the development of tooling components that can be shared by multiple vendors. Subgroup members have been meeting regularly to coordinate the overall direction for OpenCL tools, with an emphasis on strengthening the development of tools in open source, particularly by encouraging collaboration between the OpenCL and LLVM communities.
The OpenCL Tooling Subgroup is focused on several areas of cooperation with LLVM, such as: adding C++ support for OpenCL to the upstream LLVM Clang compiler; working with the Clang community to improve generic C++ support for accelerators and heterogeneous devices; and integration of SPIR-V™ support into the LLVM flow.
The Tooling Subgroup has also put a lot of emphasis on improving the SPIRV-LLVM Translator. A primary goal has been to port a new structure that can be built outside of the LLVM source tree, leading to the creation of a new repository, which is currently maintained and built against the LLVM latest daily revision.
OpenCL working group members are also working hard to ensure support for all OpenCL C language versions in the Clang compiler OpenCL frontend and to maintain the libclc OpenCL libraries.
Khronos Involvement in the LLVM Developers Meeting
Khronos Group members recently returned from the bi-annual LLVM Developers' Meeting in San Jose in October 2018, where multiple projects that Khronos maintains were being discussed in talks, roundtables, and the keynote presentation. A common thread among the discussions was improving common tooling components to foster increased tool interoperability.
During the Developers’ Meeting, there was a well-attended roundtable on SPIR-V support, with many representatives from Khronos in attendance. The conversation centered around the addition of a SPIR-V backend to LLVM, which may be added in the future instead of continuing with the current translator tool.
The keynote of LLVM was presented by Michael Wong, Khronos SYCL™ chair, ISO C++ Directions Group member, and Codeplay VP of R&D, and focused on the future direction of C++. He likened implementing heterogeneous C++ to battling the Four Horsemen of the Apocalypse, with four key attributes making up the Horsemen: 1) Data Movement; 2) Data Locality; 3) Data Layout; 4) Data Affinity.
With the upcoming addition of the Concurrency, Networking, and Parallelism technical specifications, C++, for the first time, is becoming a standard platform for writing applications that can execute across a wide range of architectures, including multi-core and many-core CPUs, GPUs, DSPs, and FPGAs. This has exciting implications for the field of machine learning, where growing support for open standards that support parallelism are providing a viable alternative to closed-source options that can leverage multiple compute units in heterogeneous computing solutions.
The SYCL standard from the Khronos Group is a strong candidate for the implementation of this upcoming C++ standard. One of the key concepts of SYCL is that the language used must be standard C++, with no extensions or added directives, excepting only those C++ features that cannot be executed on an OpenCL device—usually because of parallel hardware limitations. The SYCL standard can run on any accelerator system that supports OpenCL 1.2 and above.
Also mentioned in Michael’s keynote was the relevance of SPIR-V for supporting separate compilation to GPU-specific binaries and SYCL leveraging ParallelSTL in utilizing both CPU and GPU resources.
Also at the LLVM meeting, Intel presented their OpenCL compiler stack for CPU, talking about different compilation paths, including the classic online/OpenCL 2.1 SPIR-V path vs. OpenCL 1.2/2.0 with device-side enqueue and generic address spaces. They wrapped up their talk with some proposals of integrating additional OpenCL functionality directly into LLVM.
Finally, the meeting included a talk from Arm covering possible IR extensions for parallel SPMD-like programs in the compute and graphics domains: https://llvm.org/devmtg/2018-10/talk-abstracts.html#talk8.
Join the Conversation
Khronos is excited to deepen its interaction with the parallel software developer community and to help extend LLVM to effectively handle parallelism. We welcome any interested companies to join Khronos to have a voice and vote in both the direction of OpenCL’s evolution and to influence how Khronos’ work in OpenCL, SYCL, and SPIR-V interact and influence LLVM. Find out more at: https://www.khronos.org/members/.