pan/mdg: Propagate modifiers in the backend (+ associated fixes)
While working on !23089 (merged), I found that Midgard's "unique" approach to modifiers -- chasing in the NIR -- will conflict with the register work I've done. There are basically two categories of backend: adult backends that do their own modifier propagation, and baby backends that rely on NIR to do it. Midgard is in the weird teenage in-between where it's chasing in NIR and that makes the register rework pretty painful without adding Midgard-only code paths to the common helpers.
The fix is to make Midgard an adult backend :~)
The heart of the series is the last patch, "pan/mdg: Propagate modifiers in the backend", which removes the NIR chasing helpers and replaces them with straightforward optimization passes. Both the helper and new passes are aggregate O(n)
time, although the new passes rely heavily on Midgard's copyprop which is inexplicably O(n^2)
.. that would not be hard to fix but I've been so thoroughly yaksniped by this that I'm not going to write that patch myself.
Before we can get there, though, we have a bunch of small improvements around the compiler, motivated by shader-db regressions I debugged from earlier versions of the series. Altogether results across the series look good:
total instructions in shared programs: 1518422 -> 1508444 (-0.66%)
instructions in affected programs: 798671 -> 788693 (-1.25%)
helped: 3781
HURT: 347
Instructions are helped.
total bundles in shared programs: 646941 -> 642999 (-0.61%)
bundles in affected programs: 208748 -> 204806 (-1.89%)
helped: 2038
HURT: 491
Bundles are helped.
total quadwords in shared programs: 1134727 -> 1125969 (-0.77%)
quadwords in affected programs: 529090 -> 520332 (-1.66%)
helped: 3223
HURT: 390
Quadwords are helped.
total registers in shared programs: 90619 -> 90633 (0.02%)
registers in affected programs: 6981 -> 6995 (0.20%)
helped: 439
HURT: 382
Inconclusive result (value mean confidence interval includes 0).
total threads in shared programs: 55563 -> 55607 (0.08%)
threads in affected programs: 152 -> 196 (28.95%)
helped: 62
HURT: 33
Threads are helped.
total spills in shared programs: 1386 -> 1371 (-1.08%)
spills in affected programs: 455 -> 440 (-3.30%)
helped: 11
HURT: 14
total fills in shared programs: 5159 -> 5133 (-0.50%)
fills in affected programs: 1732 -> 1706 (-1.50%)
helped: 18
HURT: 19
This also opens the door to propagating f2f16/f2f32 instructions in a fairly straightforward way, but there are enough changes here and I don't know if I want to rock that boat right now anyway.
More importantly, this unblocks nir_register
work while being a win for Midgard.
Draft because dEQP-GLES31 is running as I'm writing this and I'm only now seeing a few regressions to sort through.