Skip to content

nir: Use a single list for all global variables

This MR implements the change suggested in #3145 (closed) in which we switch NIR to use a single list for all shader-level variables. See the issue for more discussion of why.

I've attempted to break any major driver or optimization pass changes out into separate commits for easier review. However, in the end, most of the bugs I had to fix bisected to the mega-commit which actually changes data structures. 😦 Once this lands, there will likely be some clean-up that can be done in various passes and drivers. That's left as an exercise to the reader.

I've run this MR through CI and it seems to pass on all the Intel platforms as well as everyone that's in CI. However, there are other drivers such as radeonsi, RADV, r600, and lima which I can't test in CI. Please test this MR with your driver as soon as convenient.

To provide a sanity check, I ran shader-db across the entire MR and there were no changes on on ICL:

total instructions in shared programs: 19723821 -> 19723821 (0.00%)
instructions in affected programs: 0 -> 0
helped: 0
HURT: 0

total loops in shared programs: 5973 -> 5973 (0.00%)
loops in affected programs: 0 -> 0
helped: 0
HURT: 0

total cycles in shared programs: 489407727 -> 489407727 (0.00%)
cycles in affected programs: 0 -> 0
helped: 0
HURT: 0

total spills in shared programs: 12487 -> 12487 (0.00%)
spills in affected programs: 0 -> 0
helped: 0
HURT: 0

total fills in shared programs: 12809 -> 12809 (0.00%)
fills in affected programs: 0 -> 0
helped: 0
HURT: 0

total sends in shared programs: 1010053 -> 1010053 (0.00%)
sends in affected programs: 0 -> 0
helped: 0
HURT: 0

LOST:   0
GAINED: 0

Total CPU time (seconds): 2657.58 -> 2640.10 (-0.66%)

As you can see, compile time also did not increase measurably which was one of the concerns raised in #3145 (closed). However, this is only one set of runs on a laptop. I've not done multiple runs on a machine with super-awesome thermals so there may still be a small change.

Closes: #3145 (closed)

Edited by Faith Ekstrand

Merge request reports