ir3: remove unused outputs for binning pass in NIR
We used to remove the unused outputs for the binning pass in ir3. Even though DCE would be able to clean up most of the mess, there could still be some left: most notably, unused control flow would not be cleaned up (leaving some weird branches to empty blocks). Instead of teaching ir3 how to clean this up, it makes more sense to do this at the NIR level, where we can also benefit from other optimizations.
This series also implements two other improvements related to the handling of the const state for the binning variant:
- don't modify const state for the binning variant in
ir3_cp
; - make
ir3_const_state
less error-prone to use by returning aconst
pointer by default, a new accessor was added for non-const
pointers that can only be used for the non-binning variant.
shader-db results
total instructions in shared programs: 4083461 -> 4076800 (-0.16%) instructions in affected programs: 146429 -> 139768 (-4.55%) helped: 739 HURT: 107 helped stats (abs) min: 1 max: 151 x̄: 9.43 x̃: 6 helped stats (rel) min: 0.32% max: 80.75% x̄: 5.92% x̃: 4.48% HURT stats (abs) min: 1 max: 8 x̄: 2.85 x̃: 2 HURT stats (rel) min: 0.17% max: 7.02% x̄: 2.29% x̃: 1.72% 95% mean confidence interval for instructions value: -8.92 -6.82 95% mean confidence interval for instructions %-change: -5.50% -4.26% Instructions are helped.total nops in shared programs: 882073 -> 878001 (-0.46%) nops in affected programs: 36139 -> 32067 (-11.27%) helped: 538 HURT: 294 helped stats (abs) min: 1 max: 87 x̄: 8.54 x̃: 9 helped stats (rel) min: 1.02% max: 100.00% x̄: 18.93% x̃: 16.07% HURT stats (abs) min: 1 max: 9 x̄: 1.79 x̃: 1 HURT stats (rel) min: 0.00% max: 100.00% x̄: 28.79% x̃: 25.00% 95% mean confidence interval for nops value: -5.57 -4.22 95% mean confidence interval for nops %-change: -4.20% 0.06% Inconclusive result (%-change mean confidence interval includes 0).
total non-nops in shared programs: 3201388 -> 3198799 (-0.08%) non-nops in affected programs: 93219 -> 90630 (-2.78%) helped: 687 HURT: 24 helped stats (abs) min: 1 max: 64 x̄: 3.81 x̃: 3 helped stats (rel) min: 0.63% max: 65.98% x̄: 4.30% x̃: 2.11% HURT stats (abs) min: 1 max: 4 x̄: 1.21 x̃: 1 HURT stats (rel) min: 0.49% max: 2.72% x̄: 0.99% x̃: 0.93% 95% mean confidence interval for non-nops value: -4.13 -3.15 95% mean confidence interval for non-nops %-change: -4.70% -3.56% Non-nops are helped.
total mov in shared programs: 143915 -> 143874 (-0.03%) mov in affected programs: 468 -> 427 (-8.76%) helped: 56 HURT: 26 helped stats (abs) min: 1 max: 4 x̄: 1.27 x̃: 1 helped stats (rel) min: 4.76% max: 100.00% x̄: 42.37% x̃: 33.33% HURT stats (abs) min: 1 max: 4 x̄: 1.15 x̃: 1 HURT stats (rel) min: 0.00% max: 100.00% x̄: 19.25% x̃: 0.00% 95% mean confidence interval for mov value: -0.79 -0.21 95% mean confidence interval for mov %-change: -33.04% -12.63% Mov are helped.
total cov in shared programs: 88697 -> 88672 (-0.03%) cov in affected programs: 105 -> 80 (-23.81%) helped: 19 HURT: 1 helped stats (abs) min: 1 max: 3 x̄: 1.37 x̃: 1 helped stats (rel) min: 10.00% max: 100.00% x̄: 50.94% x̃: 33.33% HURT stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1 HURT stats (rel) min: 100.00% max: 100.00% x̄: 100.00% x̃: 100.00% 95% mean confidence interval for cov value: -1.65 -0.85 95% mean confidence interval for cov %-change: -67.65% -19.13% Cov are helped.
total dwords in shared programs: 8678834 -> 8662712 (-0.19%) dwords in affected programs: 241970 -> 225848 (-6.66%) helped: 528 HURT: 35 helped stats (abs) min: 2 max: 224 x̄: 30.77 x̃: 28 helped stats (rel) min: 0.14% max: 77.78% x̄: 11.27% x̃: 6.25% HURT stats (abs) min: 2 max: 26 x̄: 3.60 x̃: 2 HURT stats (rel) min: 0.31% max: 7.32% x̄: 1.13% x̃: 0.78% 95% mean confidence interval for dwords value: -31.66 -25.61 95% mean confidence interval for dwords %-change: -11.75% -9.25% Dwords are helped.
total last-baryf in shared programs: 132617 -> 132617 (0.00%) last-baryf in affected programs: 0 -> 0 helped: 0 HURT: 0
total last-helper in shared programs: 1143707 -> 1143707 (0.00%) last-helper in affected programs: 0 -> 0 helped: 0 HURT: 0
total half in shared programs: 0 -> 0 half in affected programs: 0 -> 0 helped: 0 HURT: 0
total full in shared programs: 253117 -> 247053 (-2.40%) full in affected programs: 24666 -> 18602 (-24.58%) helped: 3669 HURT: 0 helped stats (abs) min: 1 max: 9 x̄: 1.65 x̃: 1 helped stats (rel) min: 8.33% max: 100.00% x̄: 27.88% x̃: 25.00% 95% mean confidence interval for full value: -1.68 -1.62 95% mean confidence interval for full %-change: -28.31% -27.45% Full are helped.
total constlen in shared programs: 624568 -> 624008 (-0.09%) constlen in affected programs: 1448 -> 888 (-38.67%) helped: 59 HURT: 0 helped stats (abs) min: 4 max: 32 x̄: 9.49 x̃: 8 helped stats (rel) min: 7.69% max: 100.00% x̄: 44.05% x̃: 50.00% 95% mean confidence interval for constlen value: -11.21 -7.77 95% mean confidence interval for constlen %-change: -50.74% -37.36% Constlen are helped.
total cat0 in shared programs: 975093 -> 970089 (-0.51%) cat0 in affected programs: 38602 -> 33598 (-12.96%) helped: 563 HURT: 234 helped stats (abs) min: 1 max: 103 x̄: 9.68 x̃: 11 helped stats (rel) min: 0.61% max: 96.26% x̄: 19.21% x̃: 17.46% HURT stats (abs) min: 1 max: 8 x̄: 1.90 x̃: 1 HURT stats (rel) min: 1.04% max: 200.00% x̄: 27.37% x̃: 20.00% 95% mean confidence interval for cat0 value: -7.10 -5.46 95% mean confidence interval for cat0 %-change: -7.54% -3.52% Cat0 are helped.
total cat1 in shared programs: 234056 -> 233990 (-0.03%) cat1 in affected programs: 881 -> 815 (-7.49%) helped: 71 HURT: 27 helped stats (abs) min: 1 max: 4 x̄: 1.37 x̃: 1 helped stats (rel) min: 2.22% max: 100.00% x̄: 39.90% x̃: 33.33% HURT stats (abs) min: 1 max: 4 x̄: 1.15 x̃: 1 HURT stats (rel) min: 0.00% max: 100.00% x̄: 30.07% x̃: 33.33% 95% mean confidence interval for cat1 value: -0.94 -0.41 95% mean confidence interval for cat1 %-change: -29.67% -11.57% Cat1 are helped.
total cat2 in shared programs: 1494267 -> 1492232 (-0.14%) cat2 in affected programs: 41123 -> 39088 (-4.95%) helped: 652 HURT: 1 helped stats (abs) min: 1 max: 23 x̄: 3.12 x̃: 1 helped stats (rel) min: 0.55% max: 66.67% x̄: 11.94% x̃: 1.47% HURT stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1 HURT stats (rel) min: 2.94% max: 2.94% x̄: 2.94% x̃: 2.94% 95% mean confidence interval for cat2 value: -3.40 -2.83 95% mean confidence interval for cat2 %-change: -13.27% -10.57% Cat2 are helped.
total cat3 in shared programs: 1194858 -> 1195323 (0.04%) cat3 in affected programs: 8804 -> 9269 (5.28%) helped: 17 HURT: 185 helped stats (abs) min: 1 max: 24 x̄: 12.65 x̃: 8 helped stats (rel) min: 3.57% max: 54.55% x̄: 32.18% x̃: 40.00% HURT stats (abs) min: 1 max: 4 x̄: 3.68 x̃: 4 HURT stats (rel) min: 2.38% max: 20.00% x̄: 9.06% x̃: 9.52% 95% mean confidence interval for cat3 value: 1.53 3.07 95% mean confidence interval for cat3 %-change: 3.72% 7.46% Cat3 are HURT.
total cat4 in shared programs: 84051 -> 84035 (-0.02%) cat4 in affected programs: 16 -> 0 helped: 16 HURT: 0 helped stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1 helped stats (rel) min: 100.00% max: 100.00% x̄: 100.00% x̃: 100.00% 95% mean confidence interval for cat4 value: -1.00 -1.00 95% mean confidence interval for cat4 %-change: -100.00% -100.00% Cat4 are helped.
total cat5 in shared programs: 48109 -> 48109 (0.00%) cat5 in affected programs: 0 -> 0 helped: 0 HURT: 0
total cat6 in shared programs: 49895 -> 49890 (-0.01%) cat6 in affected programs: 41 -> 36 (-12.20%) helped: 5 HURT: 0 helped stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1 helped stats (rel) min: 10.00% max: 100.00% x̄: 28.00% x̃: 10.00% 95% mean confidence interval for cat6 value: -1.00 -1.00 95% mean confidence interval for cat6 %-change: -77.98% 21.98% Inconclusive result (%-change mean confidence interval includes 0).
total cat7 in shared programs: 3132 -> 3132 (0.00%) cat7 in affected programs: 0 -> 0 helped: 0 HURT: 0
total stp in shared programs: 2448 -> 2448 (0.00%) stp in affected programs: 0 -> 0 helped: 0 HURT: 0
total ldp in shared programs: 568 -> 568 (0.00%) ldp in affected programs: 0 -> 0 helped: 0 HURT: 0
total sstall in shared programs: 351217 -> 350903 (-0.09%) sstall in affected programs: 3948 -> 3634 (-7.95%) helped: 85 HURT: 28 helped stats (abs) min: 1 max: 10 x̄: 4.68 x̃: 4 helped stats (rel) min: 3.03% max: 100.00% x̄: 30.76% x̃: 10.26% HURT stats (abs) min: 1 max: 10 x̄: 3.00 x̃: 2 HURT stats (rel) min: 0.00% max: 40.00% x̄: 6.98% x̃: 4.00% 95% mean confidence interval for sstall value: -3.58 -1.98 95% mean confidence interval for sstall %-change: -28.26% -14.56% Sstall are helped.
total (ss) in shared programs: 88009 -> 88100 (0.10%) (ss) in affected programs: 583 -> 674 (15.61%) helped: 62 HURT: 98 helped stats (abs) min: 1 max: 2 x̄: 1.08 x̃: 1 helped stats (rel) min: 9.09% max: 100.00% x̄: 55.39% x̃: 25.00% HURT stats (abs) min: 1 max: 4 x̄: 1.61 x̃: 2 HURT stats (rel) min: 0.00% max: 150.00% x̄: 38.93% x̃: 40.00% 95% mean confidence interval for (ss) value: 0.35 0.79 95% mean confidence interval for (ss) %-change: -6.42% 11.19% Inconclusive result (%-change mean confidence interval includes 0).
total systall in shared programs: 740723 -> 740425 (-0.04%) systall in affected programs: 13654 -> 13356 (-2.18%) helped: 83 HURT: 56 helped stats (abs) min: 1 max: 61 x̄: 16.54 x̃: 12 helped stats (rel) min: 0.81% max: 100.00% x̄: 19.78% x̃: 14.46% HURT stats (abs) min: 1 max: 67 x̄: 19.20 x̃: 5 HURT stats (rel) min: 0.00% max: 100.00% x̄: 25.23% x̃: 6.61% 95% mean confidence interval for systall value: -6.49 2.20 95% mean confidence interval for systall %-change: -7.64% 4.34% Inconclusive result (value mean confidence interval includes 0).
total (sy) in shared programs: 38171 -> 38146 (-0.07%) (sy) in affected programs: 239 -> 214 (-10.46%) helped: 52 HURT: 19 helped stats (abs) min: 1 max: 2 x̄: 1.02 x̃: 1 helped stats (rel) min: 16.67% max: 100.00% x̄: 30.19% x̃: 33.33% HURT stats (abs) min: 1 max: 2 x̄: 1.47 x̃: 1 HURT stats (rel) min: 25.00% max: 100.00% x̄: 68.86% x̃: 100.00% 95% mean confidence interval for (sy) value: -0.62 -0.08 95% mean confidence interval for (sy) %-change: -15.18% 7.81% Inconclusive result (%-change mean confidence interval includes 0).
total waves in shared programs: 629370 -> 629370 (0.00%) waves in affected programs: 0 -> 0 helped: 0 HURT: 0
total loops in shared programs: 1085 -> 1025 (-5.53%) loops in affected programs: 60 -> 0 helped: 60 HURT: 0 helped stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1 helped stats (rel) min: 100.00% max: 100.00% x̄: 100.00% x̃: 100.00% 95% mean confidence interval for loops value: -1.00 -1.00 95% mean confidence interval for loops %-change: -100.00% -100.00% Loops are helped.