Experimental Patches Add NIR As Alternate IR To Gallium3D
Written by Michael Larabel in Mesa on 19 October 2015 at 04:13 PM EDT. 10 Comments
MESA --
Rob Clark has published a set of eight patches for review that add support for NIR as an alternate intermediate representation (IR) under Gallium3D.

While Gallium3D drivers would still need to implement TGSI -- the default IR of Gallium -- these eight new patches would expose NIR as an alternate IR for drivers capable of consuming this new intermediate representation. Intel and others have been developing NIR for over the past year and within the i965 Mesa driver it's used by default while the other drivers to experiment over this time have included Freedreno and the VC4 Raspberry Pi driver.

With the patches, for supported code-paths it would be possible for going from GLSL IR to NIR and bypass TGSI completely, but again just for what's supported. Rob Clark explained, "the intention is that drivers can ask for an IR
other than TGSI. And what they actually get will be either TGSI or their preferred IR. Drivers will have to always handle the TGSI case, so the intention isn't to port all the different state trackers (or internally generated shaders, etc)."

Rob's focus is obviously around first with his Freedreno driver, the open-source driver implementation for Qualcomm Adreno GPUs. He further explained about the current patches, "Currently only the direct GLSL [to] NIR path is implemented for vertex shaders, which results in a huge hack at the end of the series. It isn't ever intended for drivers to mix/match glsl [to] nir vs glsl [to] tgsi [to] nir across shader stages. But this is sufficient for now for me to debug other issues."

More details via this patch series. With not everyone liking TGSI, another option that's been worked on over the years has been LunarGLASS and other LunarG-led efforts to use LLVM IR as the intermediate representation, but all of that work also remains out-of-tree.
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 10,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.

Related Mesa News
Popular News This Week