AMD Mesa Stack Getting Runtime Linker For Better LLVM Integration

Written by Michael Larabel in Mesa on 3 May 2019 at 07:47 AM EDT. 9 Comments
MESA
Longtime Mesa developer Nicolai Hähnle of AMD has sent out a big patch series today introducing a real runtime linker for the RadeonSI Gallium3D driver and hopefully to be used by the RADV Vulkan driver as well.

This runtime linker changes the way shaders are loaded and sent off to LLVM to the AMDGPU back-end. Rather than a bunch of hard-coding, there's an actual linker in place.

Nicolai Hähnle explained:
Basically, instead of hard-coding that we have a single .text section in the ELF generated by LLVM, we align ourselves more with the ELF standard and actually look at all the sections in the file(s), lay them out in memory, and resolve relocations between them.

There is still hard-coding of ".text" sections for the purpose of gfx9+ merged shaders.

The immediate consequence is that we will be able to emit .rodata in LLVM and emit absolute or relative relocations that will be resolved when shaders are uploaded to the GPU.

As a next step, I want us to explicitly record LDS symbol in the ELF symbol table and have ac_rtld lay out and resolve those symbols at load time. This will allow us to use LDS both for communication between shader parts and for temporary variables used within each part.

With the Mesa 19.1 branching imminent and these patches not yet being reviewed, we will likely only find this work with Mesa 19.2 next quarter but is certainly interesting and at least gives RADV time to potentially hook into this new functionality as well. More details via this patch series of ten patches touching roughly one thousand lines of code.
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