LLVM Clang Lands Initial SPIR-V Toolchain Support

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.
2 Comments