Skip to content

freedreno/ir3: post-sched & two-pass RA

Rob Clark requested to merge robclark/mesa:wip/two-pass-ra into master

The postsched pass runs after RA and attempts increase parallelism (reduce nops). The two-pass RA pre-colors vecN assignments based on the first pass, and re-assigns everything else as scalar regs, to reduce fragmentation caused because the register-allocate algo does not consider partial liveness of vecN registers.

I expect more benefit from postsched with round-robin register allocation. The rough plan there is to use the # of registers used in first pass RA to round-robin in second pass (possibly after optimistically rounding down in hopes that the second pass uses fewer regs). But current state is already showing wins, so probably about time to land this.

for manhattan:

total instructions in shared programs: 35498 -> 31087 (-12.43%)
instructions in affected programs: 33782 -> 29371 (-13.06%)
helped: 269
HURT: 0
total nops in shared programs: 12737 -> 8329 (-34.61%)
nops in affected programs: 12380 -> 7972 (-35.61%)
helped: 269
HURT: 0
total non-nops in shared programs: 22761 -> 22758 (-0.01%)
non-nops in affected programs: 176 -> 173 (-1.70%)
helped: 2
HURT: 0
total last-baryf in shared programs: 966 -> 775 (-19.77%)
last-baryf in affected programs: 940 -> 749 (-20.32%)
helped: 83
HURT: 0
total full in shared programs: 2421 -> 2389 (-1.32%)
full in affected programs: 241 -> 209 (-13.28%)
helped: 32
HURT: 1
total (ss) in shared programs: 490 -> 422 (-13.88%)
(ss) in affected programs: 338 -> 270 (-20.12%)
helped: 56
HURT: 10
total (sy) in shared programs: 224 -> 217 (-3.12%)
(sy) in affected programs: 14 -> 7 (-50.00%)
helped: 5
HURT: 0

for full shader-db run (with closed shaders):

total instructions in shared programs: 8467483 -> 6949759 (-17.92%)
instructions in affected programs: 8200142 -> 6682418 (-18.51%)
helped: 38633
HURT: 2294
total nops in shared programs: 3472395 -> 1972143 (-43.21%)
nops in affected programs: 3416502 -> 1916250 (-43.91%)
helped: 38483
HURT: 2326
total non-nops in shared programs: 4995023 -> 4977551 (-0.35%)
non-nops in affected programs: 1117562 -> 1100090 (-1.56%)
helped: 4626
HURT: 0
total last-baryf in shared programs: 226479 -> 202200 (-10.72%)
last-baryf in affected programs: 179980 -> 155701 (-13.49%)
helped: 8700
HURT: 2435
total full in shared programs: 362065 -> 349447 (-3.49%)
full in affected programs: 98470 -> 85852 (-12.81%)
helped: 8951
HURT: 197
total (ss) in shared programs: 161921 -> 150910 (-6.80%)
(ss) in affected programs: 106161 -> 95150 (-10.37%)
helped: 9302
HURT: 3568
total (sy) in shared programs: 92794 -> 82085 (-11.54%)
(sy) in affected programs: 67337 -> 56628 (-15.90%)
helped: 3734
HURT: 1178
Edited by Rob Clark

Merge request reports