AMD AI Compiler Engineer Lands A Generic MLIR To SPIR-V Pass In LLVM 19

Written by Michael Larabel in LLVM on 22 June 2024 at 08:40 AM EDT. 8 Comments
LLVM
Merged on Friday to LLVM 19 Git is a generic MLIR to SPIR-V pass for lowering the Multi-Level Intermediate Representation down into SPIR-V as the intermediate representation consumed by OpenGL / OpenCL / Vulkan drivers.

This generic MLIR to SPIR-V pass for LLVM is intended to yield better coverage of upstream compilation to SPIR-V and enables writing simple kernels by hand. The MLIR hybrid IR continues seeing much industry interest and adoption for this intermediate representation. AMD and others have worked on MLIR to SPIR-V conversion while now there is a generic upstream pass within LLVM. Once capable enough, MLIR to SPIR-V can open up some interesting possibilities around Vulkan compute and machine learning.

Angel Zhang of AMD who is currently serving as an AI compiler engineer submitted this generic MLIR to SPIR-V pass for upstream:
"This PR implements a MVP version of an MLIR lowering pipeline to SPIR-V. The goal of adding this pipeline is to have a better test coverage of SPIR-V compilation upstream, and enable writing simple kernels by hand. The dialects supported in this version include arith, vector (only 1-D vectors with size 2,3,4,8 or 16), scf, ub, index, func and math. New test cases for the pass are also included in this PR."

Future plans call for adding conversion patterns for other dialects like GPU and tensor, among other improvements.

LLVM MLIR to SPIR-V


It will be interesting to see where this upstream MLIR to SPIR-V work leads.
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