Skip to content

freedreno/ir3: Add support for flat.b instruction

Matt Turner requested to merge mattst88/mesa:flat.b into main

flat.b is a variant of the bary.f instruction that does not perform interpolation of the varying input.

The flat.b/bary.f cat2 instruction should be faster than an ldlv cat6 instruction, even with a couple of additional moves (which are removed in the last patch).

@flto discovered that because the (i,j) provided to flat.b in src1 is unused, that we can replace it with an immediate 0 and the instruction still works fine. This allows us to remove a couple of mov instructions or a bit of extra constfile usage.

shader-db results on a6xx:

total instructions in shared programs: 1513344 -> 1512397 (-0.06%)
instructions in affected programs: 40130 -> 39183 (-2.36%)
helped: 379
HURT: 18
helped stats (abs) min: 1 max: 19 x̄: 2.77 x̃: 2
helped stats (rel) min: 0.12% max: 28.57% x̄: 4.67% x̃: 3.70%
HURT stats (abs)   min: 1 max: 30 x̄: 5.67 x̃: 2
HURT stats (rel)   min: 0.21% max: 28.57% x̄: 9.47% x̃: 4.71%
95% mean confidence interval for instructions value: -2.69 -2.08
95% mean confidence interval for instructions %-change: -4.55% -3.51%
Instructions are helped.

total nops in shared programs: 338619 -> 337983 (-0.19%)
nops in affected programs: 10798 -> 10162 (-5.89%)
helped: 335
HURT: 16
helped stats (abs) min: 1 max: 18 x̄: 2.18 x̃: 1
helped stats (rel) min: 0.27% max: 100.00% x̄: 12.20% x̃: 5.88%
HURT stats (abs)   min: 1 max: 31 x̄: 5.94 x̃: 3
HURT stats (rel)   min: 0.00% max: 200.00% x̄: 45.03% x̃: 15.84%
95% mean confidence interval for nops value: -2.12 -1.50
95% mean confidence interval for nops %-change: -12.15% -7.04%
Nops are helped.

total non-nops in shared programs: 1174725 -> 1174414 (-0.03%)
non-nops in affected programs: 25565 -> 25254 (-1.22%)
helped: 336
HURT: 11
helped stats (abs) min: 1 max: 5 x̄: 1.03 x̃: 1
helped stats (rel) min: 0.09% max: 16.67% x̄: 3.36% x̃: 2.70%
HURT stats (abs)   min: 1 max: 7 x̄: 3.18 x̃: 3
HURT stats (rel)   min: 0.32% max: 2.92% x̄: 1.43% x̃: 1.41%
95% mean confidence interval for non-nops value: -0.99 -0.81
95% mean confidence interval for non-nops %-change: -3.51% -2.90%
Non-nops are helped.

total mov in shared programs: 68871 -> 68904 (0.05%)
mov in affected programs: 406 -> 439 (8.13%)
helped: 5
HURT: 16
helped stats (abs) min: 1 max: 4 x̄: 2.20 x̃: 1
helped stats (rel) min: 4.35% max: 25.00% x̄: 13.70% x̃: 17.39%
HURT stats (abs)   min: 1 max: 8 x̄: 2.75 x̃: 2
HURT stats (rel)   min: 4.00% max: 50.00% x̄: 18.32% x̃: 15.04%
95% mean confidence interval for mov value: 0.24 2.90
95% mean confidence interval for mov %-change: 2.00% 19.39%
Mov are HURT.

total cov in shared programs: 27912 -> 27912 (0.00%)
cov in affected programs: 0 -> 0
helped: 0
HURT: 0

total dwords in shared programs: 2697268 -> 2696154 (-0.04%)
dwords in affected programs: 27066 -> 25952 (-4.12%)
helped: 134
HURT: 6
helped stats (abs) min: 2 max: 28 x̄: 9.00 x̃: 4
helped stats (rel) min: 0.09% max: 37.50% x̄: 8.13% x̃: 5.56%
HURT stats (abs)   min: 2 max: 32 x̄: 15.33 x̃: 15
HURT stats (rel)   min: 0.39% max: 6.16% x̄: 2.34% x̃: 1.66%
95% mean confidence interval for dwords value: -9.80 -6.11
95% mean confidence interval for dwords %-change: -9.17% -6.19%
Dwords are helped.

total last-baryf in shared programs: 77582 -> 76606 (-1.26%)
last-baryf in affected programs: 2744 -> 1768 (-35.57%)
helped: 367
HURT: 3
helped stats (abs) min: 1 max: 7 x̄: 2.80 x̃: 2
helped stats (rel) min: 3.55% max: 100.00% x̄: 44.79% x̃: 40.00%
HURT stats (abs)   min: 8 max: 24 x̄: 17.00 x̃: 19
HURT stats (rel)   min: 34.78% max: 114.29% x̄: 84.87% x̃: 105.56%
95% mean confidence interval for last-baryf value: -2.88 -2.40
95% mean confidence interval for last-baryf %-change: -46.19% -41.29%
Last-baryf are helped.

total half in shared programs: 0 -> 0
half in affected programs: 0 -> 0
helped: 0
HURT: 0

total full in shared programs: 81483 -> 81479 (<.01%)
full in affected programs: 21 -> 17 (-19.05%)
helped: 2
HURT: 0

total constlen in shared programs: 273720 -> 273720 (0.00%)
constlen in affected programs: 0 -> 0
helped: 0
HURT: 0

total cat0 in shared programs: 370673 -> 370037 (-0.17%)
cat0 in affected programs: 11695 -> 11059 (-5.44%)
helped: 335
HURT: 16
helped stats (abs) min: 1 max: 18 x̄: 2.18 x̃: 1
helped stats (rel) min: 0.26% max: 75.00% x̄: 10.23% x̃: 5.49%
HURT stats (abs)   min: 1 max: 31 x̄: 5.94 x̃: 3
HURT stats (rel)   min: 5.71% max: 300.00% x̄: 90.48% x̃: 26.67%
95% mean confidence interval for cat0 value: -2.12 -1.50
95% mean confidence interval for cat0 %-change: -9.13% -2.15%
Cat0 are helped.

total cat1 in shared programs: 97105 -> 97142 (0.04%)
cat1 in affected programs: 449 -> 486 (8.24%)
helped: 5
HURT: 16
helped stats (abs) min: 1 max: 4 x̄: 2.20 x̃: 1
helped stats (rel) min: 4.35% max: 17.39% x̄: 10.12% x̃: 7.14%
HURT stats (abs)   min: 1 max: 8 x̄: 3.00 x̃: 2
HURT stats (rel)   min: 4.00% max: 250.00% x̄: 27.31% x̃: 13.33%
95% mean confidence interval for cat1 value: 0.39 3.13
95% mean confidence interval for cat1 %-change: -6.34% 43.14%
Inconclusive result (%-change mean confidence interval includes 0).

total cat2 in shared programs: 694649 -> 695734 (0.16%)
cat2 in affected programs: 15496 -> 16581 (7.00%)
helped: 0
HURT: 331
HURT stats (abs)   min: 1 max: 12 x̄: 3.28 x̃: 3
HURT stats (rel)   min: 0.09% max: 300.00% x̄: 19.22% x̃: 12.28%
95% mean confidence interval for cat2 value: 3.10 3.45
95% mean confidence interval for cat2 %-change: 15.52% 22.93%
Cat2 are HURT.

total cat3 in shared programs: 287898 -> 287898 (0.00%)
cat3 in affected programs: 0 -> 0
helped: 0
HURT: 0

total cat4 in shared programs: 33731 -> 33731 (0.00%)
cat4 in affected programs: 0 -> 0
helped: 0
HURT: 0

total cat5 in shared programs: 24157 -> 24157 (0.00%)
cat5 in affected programs: 0 -> 0
helped: 0
HURT: 0

total cat6 in shared programs: 5016 -> 3583 (-28.57%)
cat6 in affected programs: 1449 -> 16 (-98.90%)
helped: 430
HURT: 0
helped stats (abs) min: 1 max: 13 x̄: 3.33 x̃: 4
helped stats (rel) min: 16.67% max: 100.00% x̄: 99.26% x̃: 100.00%
95% mean confidence interval for cat6 value: -3.52 -3.14
95% mean confidence interval for cat6 %-change: -99.99% -98.54%
Cat6 are helped.

total cat7 in shared programs: 115 -> 115 (0.00%)
cat7 in affected programs: 0 -> 0
helped: 0
HURT: 0

total stp in shared programs: 308 -> 308 (0.00%)
stp in affected programs: 0 -> 0
helped: 0
HURT: 0

total ldp in shared programs: 328 -> 328 (0.00%)
ldp in affected programs: 0 -> 0
helped: 0
HURT: 0

total sstall in shared programs: 128104 -> 128146 (0.03%)
sstall in affected programs: 933 -> 975 (4.50%)
helped: 17
HURT: 15
helped stats (abs) min: 1 max: 8 x̄: 2.06 x̃: 1
helped stats (rel) min: 1.12% max: 100.00% x̄: 34.54% x̃: 11.11%
HURT stats (abs)   min: 1 max: 12 x̄: 5.13 x̃: 5
HURT stats (rel)   min: 4.46% max: 100.00% x̄: 27.79% x̃: 20.00%
95% mean confidence interval for sstall value: -0.38 3.01
95% mean confidence interval for sstall %-change: -21.51% 10.85%
Inconclusive result (value mean confidence interval includes 0).

total (ss) in shared programs: 34315 -> 33848 (-1.36%)
(ss) in affected programs: 1329 -> 862 (-35.14%)
helped: 421
HURT: 3
helped stats (abs) min: 1 max: 5 x̄: 1.12 x̃: 1
helped stats (rel) min: 1.32% max: 100.00% x̄: 68.98% x̃: 50.00%
HURT stats (abs)   min: 1 max: 2 x̄: 1.33 x̃: 1
HURT stats (rel)   min: 9.09% max: 25.00% x̄: 15.07% x̃: 11.11%
95% mean confidence interval for (ss) value: -1.15 -1.06
95% mean confidence interval for (ss) %-change: -71.51% -65.26%
(ss) are helped.

total (sy) in shared programs: 12704 -> 12715 (0.09%)
(sy) in affected programs: 65 -> 76 (16.92%)
helped: 5
HURT: 13
helped stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1
helped stats (rel) min: 16.67% max: 50.00% x̄: 28.33% x̃: 25.00%
HURT stats (abs)   min: 1 max: 2 x̄: 1.23 x̃: 1
HURT stats (rel)   min: 14.29% max: 100.00% x̄: 41.10% x̃: 33.33%
95% mean confidence interval for (sy) value: 0.07 1.15
95% mean confidence interval for (sy) %-change: 3.00% 40.63%
(sy) are HURT.

total waves in shared programs: 240322 -> 240326 (<.01%)
waves in affected programs: 18 -> 22 (22.22%)
helped: 0
HURT: 2

total max_sun in shared programs: 0 -> 0
max_sun in affected programs: 0 -> 0
helped: 0
HURT: 0

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

LOST:   0
GAINED: 0

Merge request reports