Gallium Clover With SPIR-V & NIR Opening Up New Compute Options Inside Mesa

Written by Michael Larabel in Mesa on 1 October 2018 at 05:08 AM EDT. 6 Comments
MESA
One of the XDC2018 talks I was most looking forward to was the presentation by Red Hat's Karol Herbst and Rob Clark on their work with SPIR-V/NIR support inside Mesa for the context of OpenCL/compute support, which includes getting GPGPU computing on the Nouveau and Freedreno drivers.

Longtime Nouveau contributor Karol Herbst joined Red Hat almost one year ago and for much of that time he's been working on NIR support for SPIR-V, getting Nouveau's NIR support up to the quality of TGSI IR, basic compute support, and more all squared up. It's not yet all mainlined or ready for end-users, but Karol continues working on it as well as Rob Clark of Red Hat. It's been interesting though the amount of work Red Hat has been investing in the effort considering Maxwell and newer graphics cards continue to be crippled performance-wise due to the inability to have proper re-clocking on these desktop GPUs.

Their fundamental initiative is about getting NIR as more of a general purpose IR within Mesa and being able to use NIR for all necessary driver operations. Here's a useful look at the planned overview of the intermediate presentations inside Mesa for OpenCL and SPIR-V and ultimately hitting the different drivers:


To get NIR working for their use-case, they've had to work on proper pointer support, additional operations, VEC8/VEC16 support, and other features.

While there are other drivers utilizing NIR inside Mesa like Intel, RadeonSI, and VC4/V3D, for now most of this work and testing is done on the Nouveau and Freedreno drivers. But ultimately other drivers may be able to easily benefit if they add support for the new compute intrinsics and other necessary instructions.

In total this year-long effort is nearing fruition but at around 150 patches, currently breaking graphics support, and the NIR code-path is slower than the mature TGSI code for Nouveau... It doesn't sound like this NIR/SPIR-V compute work will be settled in full in time for Mesa 18.3 to end out the year.

In the future, this SPIR-V/NIR support may allow for support of other languages and even a potential OpenMP offloading state tracker inside Mesa. The other work going on within Red Hat for Heterogeneous Memory Management (HMM) may play nicely into this as well.

The XDC2018 slide deck by Karol and Rob can be viewed here.
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