Skip to content

nir/constant_folding: Optimize txb with bias of constant zero to tex

Ian Romanick requested to merge idr/mesa:review/txb-zero-bias into main

I also tried this in nir_lower_tex.c. This seems like a slightly better place for it. Funny story... the fossil-db results we slightly different. Quickly looking at the results, it seemed that having the vec2 operations in different places caused some slight changes. 🤷

All Haswell and newer Intel GPUs had similar results. (Ice Lake shown)
total instructions in shared programs: 19757733 -> 19753431 (-0.02%)
instructions in affected programs: 277248 -> 272946 (-1.55%)
helped: 1644
HURT: 1
helped stats (abs) min: 1 max: 16 x̄: 2.62 x̃: 2
helped stats (rel) min: 0.05% max: 11.11% x̄: 2.11% x̃: 1.61%
HURT stats (abs)   min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel)   min: 0.35% max: 0.35% x̄: 0.35% x̃: 0.35%
95% mean confidence interval for instructions value: -2.72 -2.51
95% mean confidence interval for instructions %-change: -2.19% -2.03%
Instructions are helped.

total cycles in shared programs: 938517439 -> 938384079 (-0.01%)
cycles in affected programs: 19548849 -> 19415489 (-0.68%)
helped: 1358
HURT: 269
helped stats (abs) min: 1 max: 2328 x̄: 133.01 x̃: 16
helped stats (rel) min: <.01% max: 41.12% x̄: 1.40% x̃: 0.48%
HURT stats (abs)   min: 1 max: 1302 x̄: 175.70 x̃: 30
HURT stats (rel)   min: <.01% max: 69.03% x̄: 6.24% x̃: 1.04%
95% mean confidence interval for cycles value: -99.14 -64.79
95% mean confidence interval for cycles %-change: -0.47% 0.19%
Inconclusive result (%-change mean confidence interval includes 0).

LOST:   21
GAINED: 32

All Ivy Bridge and older Intel GPUs had similar results. (Ivy Bridge shown)
total instructions in shared programs: 15302017 -> 15301485 (<.01%)
instructions in affected programs: 22565 -> 22033 (-2.36%)
helped: 168
HURT: 0
helped stats (abs) min: 1 max: 7 x̄: 3.17 x̃: 3
helped stats (rel) min: 0.04% max: 4.39% x̄: 3.05% x̃: 3.27%
95% mean confidence interval for instructions value: -3.45 -2.89
95% mean confidence interval for instructions %-change: -3.19% -2.91%
Instructions are helped.

total cycles in shared programs: 550119761 -> 549989147 (-0.02%)
cycles in affected programs: 12834251 -> 12703637 (-1.02%)
helped: 164
HURT: 0
helped stats (abs) min: 20 max: 4547 x̄: 796.43 x̃: 294
helped stats (rel) min: 0.23% max: 53.84% x̄: 2.05% x̃: 0.37%
95% mean confidence interval for cycles value: -942.62 -650.24
95% mean confidence interval for cycles %-change: -3.17% -0.94%
Cycles are helped.

fossil-db results:

Tiger Lake, Ice Lake, and Skylake had similar results. (Ice Lake shown)
Instructions in all programs: 142073649 -> 141307526 (-0.5%)
SENDs in all programs: 6876848 -> 6876778 (-0.0%)
Loops in all programs: 38283 -> 38283 (+0.0%)
Cycles in all programs: 8410049681 -> 8402902960 (-0.1%)
Spills in all programs: 190623 -> 190599 (-0.0%)
Fills in all programs: 297780 -> 297756 (-0.0%)

Merge request reports