Skip to content

ac: Introduce a LLVM-independent way to handle shader arguments

Connor Abbott requested to merge cwabbott0/mesa:review/ac-nir-abi into master

Currently most of the work of implementing the driver-specific ABI for things like descriptor loads is done while translating NIR to LLVM (or now, ACO). With just LLVM, this worked kind of ok, but with ACO in the picture this just won't work. This series is the first step to try to move all this code away from being LLVM-specific. Specifically, we move the code that sets up input SGPRs and VGPRs out of LLVM, creating a new non-LLVM-specific interface that lets the driver specify how arguments should be laid out before touching LLVM. This means that we can access these arguments from NIR (not done yet) and we can delete the radv-specific code which does this in ACO. The ultimate goal is to remove as many things out of ac_shader_abi as possible, lowering things in NIR instead, so that the LLVM->{NIR,ACO} translation layers can be disentangled from the driver. Among the things this will hopefully help unlock:

  • Lowering resource handling in NIR.
  • Moving prolog and epilog handling in radeonsi to NIR, to use ACO for it. Compiling these happens on the critical draw-call path and ACO is much faster than LLVM.
  • Lowering vertex-stage IO in NIR, meaning that tess/GS can be supported on both radeonsi and radv without driver-specific callbacks.
  • Making supporting ACO on other drivers much easier.

The first two patches introduce the core datastructure that makes all this possible, ac_shader_args. Each driver will subclass this, similar to ac_shader_abi. Then the next three patches, which are split up for readability but need to be squashed together, actually perform the switch. This part unfortunately needs to touch a lot of code. Then we extract all the radv-specific argument handling code out to a new file, and massage both that code and ACO until we can ditch the argument handling in ACO. I wanted to do this first both to provide an initial benefit from the refactoring and to make sure that ac_shader_args will actually work with ACO.

I've tested this with piglit and vulkan CTS (both with and without ACO) on polaris10 and vega10, but this probably needs more testing before it can land. However, I do want it to land as soon as possible, since this touches a lot of code, which means that it's very prone to rebase conflicts, and it unblocks a lot of other stuff.

Edited by Connor Abbott

Merge request reports