Skip to content

nir: prepass scheduling for register pressure

Emma Anholt requested to merge anholt/mesa:nir-schedule into master

Adds a "generic" pass for scheduling NIR instructions to reduce register pressure. It doesn't win in every shader, but turning it on for V3D gets:

    total spills in shared programs: 3587 -> 159 (-95.57%)
    spills in affected programs: 3587 -> 159 (-95.57%)
    
    total fills in shared programs: 3632 -> 232 (-93.61%)
    fills in affected programs: 3632 -> 232 (-93.61%)

and I have some ideas for fixing some of the few where the schedule gets worse.

I've tried enabling it on i965, even with the other prepass scheduler still in place, and got:

total spills in shared programs: 2628 -> 2420 (-7.91%)
spills in affected programs: 2127 -> 1919 (-9.78%)
helped: 17
HURT: 11

total fills in shared programs: 3501 -> 3296 (-5.86%)
fills in affected programs: 2757 -> 2552 (-7.44%)
helped: 17
HURT: 11

at the cost of some more instructions/cycles (see note in the code about CSP vs CSR for the likely cause).

Merge request reports