LLVM Clang Lands Initial SPIR-V Toolchain Support
Written by Michael Larabel in LLVM on 23 December 2021 at 01:38 PM EST. 2 Comments
LLVM --
An exciting LLVM development has landed in time for Christmas! Complementary to the LLVM SPIR-V back-end work that could soon be mainlined, Clang has now merged the initial SPIR-V toolchain support. This allows going from Clang to the SPIR-V intermediate representation that is conformant to the OpenCL environment specification -- such as for compiling OpenCL kernels into SPIR-V.

Without the LLVM SPIR-V back-end itself being merged yet, the Clang SPIR-V toolchain relies upon the external LLVM to SPIR-V translator (llvm-spirv) for the conversion process. Once that big SPIR-V back-end is merged and in good standing, it can transition to using that within the LLVM code-base rather than requiring the external llvm-spirv tool.

This toolchain support allows generating SPIR-V binaries for 32-bit or 64-bit targets. The SPIR-V generation targets the OpenCL Environment Specification while could be extended for Vulkan, etc.


Targeting SPIR-V is now possible from mainline Clang.


With the external llvm-spirv doing much of the heavy lifting, the Clang toolchain support is just over 200 lines of code and had been under review since October while now will be part of LLVM 14.0 next year.

With the HIPSPV code being merged this month too for going from AMD HIP to SPIR-V, December has been a great month so far for the open-source LLVM stack.
Related News
About The Author
Author picture

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter or contacted via MichaelLarabel.com.

Popular News This Week