NIR-To-TGSI Support Added To Mesa 20.3

Written by Michael Larabel in Mesa on 20 October 2020 at 03:17 PM EDT. 4 Comments
MESA
Mesa 20.3 has merged a long work-in-progress patch series providing support for going from the modern NIR intermediate representation to TGSI as the conventional Gallium3D IR.

The NIR-To-TGSI translation layer has been in the works for most of the year with hopes of using that to eventually kill the Mesa state tracker GLSL-to-TGSI code that is quite large and crusty. While RadeonSI, Iris, and the other larger Gallium3D drivers are making use of NIR for a while now, this NIR-to-TGSI path can help other Gallium3D drivers like Softpipe that still rely on TGSI. If getting rid of the GLSL-to-TGSI path, GLSL shaders would ultimately go through NIR and then translated to TGSI.

This can allow for better optimizations and ultimately better performance. This translation layer allows these other Gallium3D drivers to make use of NIR optimizations and all the attention it receives these days where as the TGSI-specific work is largely untouched.

Eric Anholt of Google who has been working on this support commented of the immediate benefits for TGSI-based Gallium3D drivers, "I've seen it reduce instruction count massively in compute, geometry, and UBO-loading shaders, but even a bit in trivial texturing shaders like glmark2!"

This patch also goes on to explain, "The goal is to replace glsl_to_tgsi.cpp and its supporting code (~10k LOC). This code ends up being smaller because NIR has many lowering passes that help it map better to TGSI than GLSL IR does. As a benefit, this brings NIR optimizations to TGSI-only drivers. Many of the softpipe shaders I've looked at end up being significantly shorter."

Mesa 20.3 remains under active development and should be out as stable in early December.
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