NIR Continues Successfully Serving The Needs Of Mesa, Better Suited Than LLVM

Written by Michael Larabel in Mesa on 29 January 2022 at 07:15 AM EST. 13 Comments
Prominent Mesa developer Jason Ekstrand who formerly led Intel's "ANV" Vulkan driver effort and being one of their open-source driver developers originally involved with the NIR intermediate representation work wrote a detailed and excellent blog post outlining its successes eight years running. While it still gets brought up into discussions from time to time (including quite recently stemming from a RISC-V graphics thread) why Mesa doesn't use LLVM IR or SPIR-V directly as its intermediate representation, NIR continues as a striking success and used by all major Mesa drivers.

Ekstrand's post recaps the history of NIR within Mesa and reiterating the known issues around using LLVM for graphics drivers -- namely the issues that have been encountered by AMD with their RadeonSI driver with distribution/packaging issues and the hassle of maintaining the shader compiler in a separate source tree with a separate release schedule and no API guarantees. Plus LLVM isn't as suited for GPUs as NIR is, which was designed from the ground-up for graphics. Ekstrand also points out that while LLVM can allow some code sharing, it isn't necessarily a great amount with much device-specific code still needed beyond some basic optimizations, etc.

NIR overall has been a splendid effort for Mesa that is now used across all of the prominent open-source Mesa drivers. Ekstrand does acknowledge though there is room for improvement still especially with getting some new features in order around ray-tracing and OpenCL-style compute. In any case, Mesa is likely to stick with NIR for the foreseeable future. I was hearing from Intel about their Mesa drivers potentially moving to their LLVM-based IGC compiler but haven't heard anything on the matter recently, so we'll see, but in any case NIR continues going strong.

Read Ekstrand's detailed NIR piece over on his blog.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of 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 automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via

Popular News This Week