AMD Lands Support For Vendor Flavored SPIR-V Within LLVM

Written by Michael Larabel in LLVM on 7 June 2024 at 10:12 AM EDT. 8 Comments
LLVM
SPIR-V used by the likes of OpenGL, OpenCL, and Vulkan is a common intermediate representation (IR) / intermediate language for consumption by device drivers. With code now merged into LLVM, AMD has introduced the notion of vendor "flavored" SPIR-V for containing extra information pertinent to the GPU device/driver being targeted.

Alex Voicu of AMD's ROCm team has introduced to LLVM the notion of vendor-flavored SPIR-V and goes through in implementing an AMDGCN-flavored SPIR-V to be consumed by the LLVM AMDGPU compiler back-end. This vendor flavored SPIR-V is intentionally device/back-end specific and knowingly "forfeiting absolute genericity to obtain greater expressiveness for target features."

The merge commit message clarifies:
"This is still SPIRV, albeit relaxed in terms of preconditions & constrained in terms of postconditions, and only guaranteed to be usable on AMDGCN targets (it is still possible to obtain pristine portable SPIRV through usage of the flavoured target, though)."

With the AMDGCN flavored SPIR-V, inline AMDGCN Assembly is supported in conjunction with the SPV_INTEL_inline_assembly extension, AMDGCN target-specific built-ins are supported, and the SPIR-V feature set better matches the particular AMDGCN target. Further patches around this vendor-flavored SPIR-V are being worked on. It will be interesting to see how AMD ultimately intends to utilize this flavored SPIR-V and the net benefits in the end for better performance and features in not being limited to the default SPIR-V restrictions.

More details via this LLVM pull request that was merged today into the LLVM 19 codebase.
Related News
About The Author
Michael Larabel

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, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week