[Mesa-dev] [PATCH 0/5] Do better for flrp on platforms that lack flrp instruction

Ian Romanick idr at freedesktop.org
Mon Aug 13 23:34:16 UTC 2018


This series is a prerequisite for the optimizations that I actually
wanted to do.  That series, which affects the use of nir_op_flrp, will
come later.

For some reason, Intel Gen5 and earlier platforms don't lower flrp
instructions in NIR.  Instead these instructions are lowered when
converting from NIR to Gen assembly.  This would be understandable if
the backend lowering used the strict, by the spec lowering to a(1-c)+bc,
but it doesn't.  The backend uses the same a+c(b-a) lowering as NIR.

Lowering in NIR enables existing NIR optimizations.  It also provides an
opportunity for new nir_opt_algebraic optimizations based on the "a" and
"b" parameters of the flrp.  The final results are pretty good.

Across the whole series for Iron Lake:

total instructions in shared programs: 7781330 -> 7728593 (-0.68%)
instructions in affected programs: 4378493 -> 4325756 (-1.20%)
helped: 17807
HURT: 1643
helped stats (abs) min: 1 max: 155 x̄: 3.21 x̃: 2
helped stats (rel) min: 0.07% max: 35.48% x̄: 1.80% x̃: 1.32%
HURT stats (abs)   min: 1 max: 17 x̄: 2.68 x̃: 1
HURT stats (rel)   min: 0.19% max: 12.00% x̄: 1.71% x̃: 1.11%
95% mean confidence interval for instructions value: -2.77 -2.65
95% mean confidence interval for instructions %-change: -1.53% -1.47%
Instructions are helped.

total cycles in shared programs: 177879330 -> 177635216 (-0.14%)
cycles in affected programs: 100176772 -> 99932658 (-0.24%)
helped: 17882
HURT: 2009
helped stats (abs) min: 2 max: 930 x̄: 15.21 x̃: 8
helped stats (rel) min: <.01% max: 44.61% x̄: 0.74% x̃: 0.36%
HURT stats (abs)   min: 2 max: 126 x̄: 13.90 x̃: 6
HURT stats (rel)   min: <.01% max: 11.27% x̄: 0.56% x̃: 0.21%
95% mean confidence interval for cycles value: -12.64 -11.91
95% mean confidence interval for cycles %-change: -0.63% -0.59%
Cycles are helped.

LOST:   0
GAINED: 17

Across the whole series for GM45:

total instructions in shared programs: 4792461 -> 4764706 (-0.58%)
instructions in affected programs: 2357852 -> 2330097 (-1.18%)
helped: 9156
HURT: 834
helped stats (abs) min: 1 max: 155 x̄: 3.27 x̃: 2
helped stats (rel) min: 0.07% max: 34.38% x̄: 1.75% x̃: 1.29%
HURT stats (abs)   min: 1 max: 17 x̄: 2.67 x̃: 1
HURT stats (rel)   min: 0.19% max: 11.69% x̄: 1.66% x̃: 1.08%
95% mean confidence interval for instructions value: -2.86 -2.69
95% mean confidence interval for instructions %-change: -1.51% -1.43%
Instructions are helped.

total cycles in shared programs: 121883478 -> 121727206 (-0.13%)
cycles in affected programs: 62107848 -> 61951576 (-0.25%)
helped: 9276
HURT: 1094
helped stats (abs) min: 2 max: 930 x̄: 18.63 x̃: 12
helped stats (rel) min: <.01% max: 41.03% x̄: 0.79% x̃: 0.37%
HURT stats (abs)   min: 2 max: 126 x̄: 15.10 x̃: 6
HURT stats (rel)   min: <.01% max: 10.51% x̄: 0.55% x̃: 0.18%
95% mean confidence interval for cycles value: -15.66 -14.48
95% mean confidence interval for cycles %-change: -0.67% -0.62%
Cycles are helped.

total fills in shared programs: 93 -> 94 (1.08%)
fills in affected programs: 81 -> 82 (1.23%)
helped: 0
HURT: 1

LOST:   17
GAINED: 17




More information about the mesa-dev mailing list