AMD Mesa Stack Getting Runtime Linker For Better LLVM Integration
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:
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.
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.
9 Comments