diff options
author | Ian Romanick <[email protected]> | 2018-01-05 13:29:26 -0800 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2018-01-30 15:40:14 -0800 |
commit | d8d18516b0aa81f6791889bab7ce14703e65d8b4 (patch) | |
tree | 8dca20038d6989b05cae3f012936ce3f2a603a58 /src/compiler/nir/nir_opt_algebraic.py | |
parent | 3941cba0f76d2e004cd26df3cabf063f68eed899 (diff) |
nir: Undo possible damage caused by rearranging or-compounded float compares
shader-db results:
Skylake and Broadwell had similar results (Skylake shown)
total instructions in shared programs: 14525898 -> 14525836 (<.01%)
instructions in affected programs: 1964 -> 1902 (-3.16%)
helped: 14
HURT: 0
helped stats (abs) min: 1 max: 25 x̄: 4.43 x̃: 1
helped stats (rel) min: 0.68% max: 9.77% x̄: 2.10% x̃: 0.86%
95% mean confidence interval for instructions value: -9.46 0.60
95% mean confidence interval for instructions %-change: -3.97% -0.24%
Inconclusive result (value mean confidence interval includes 0).
total cycles in shared programs: 533119892 -> 533115756 (<.01%)
cycles in affected programs: 96061 -> 91925 (-4.31%)
helped: 13
HURT: 1
helped stats (abs) min: 60 max: 596 x̄: 318.77 x̃: 300
helped stats (rel) min: 1.15% max: 5.49% x̄: 4.27% x̃: 4.42%
HURT stats (abs) min: 8 max: 8 x̄: 8.00 x̃: 8
HURT stats (rel) min: 0.46% max: 0.46% x̄: 0.46% x̃: 0.46%
95% mean confidence interval for cycles value: -379.43 -211.43
95% mean confidence interval for cycles %-change: -4.84% -3.01%
Cycles are helped.
Haswell, Ivy Bridge and Sandy Bridge had similar results (Haswell shown).
total instructions in shared programs: 9033948 -> 9033898 (<.01%)
instructions in affected programs: 535 -> 485 (-9.35%)
helped: 2
HURT: 0
total cycles in shared programs: 84631402 -> 84628949 (<.01%)
cycles in affected programs: 63197 -> 60744 (-3.88%)
helped: 13
HURT: 2
helped stats (abs) min: 1 max: 594 x̄: 189.62 x̃: 140
helped stats (rel) min: 0.07% max: 5.04% x̄: 3.79% x̃: 4.01%
HURT stats (abs) min: 4 max: 8 x̄: 6.00 x̃: 6
HURT stats (rel) min: 0.17% max: 0.45% x̄: 0.31% x̃: 0.31%
95% mean confidence interval for cycles value: -253.40 -73.67
95% mean confidence interval for cycles %-change: -4.24% -2.25%
Cycles are helped.
No changes on GM45 or Iron Lake.
v2: Add a couple more tautological compares. Suggested by Elie.
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
Reviewed-by: Elie Tournier <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_opt_algebraic.py')
-rw-r--r-- | src/compiler/nir/nir_opt_algebraic.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 09538ba25a8..b141f2414db 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -205,6 +205,15 @@ optimizations = [ (('~ior', ('fge', a, '#b'), ('fge', a, '#c')), ('fge', a, ('fmin', b, c))), (('~ior', ('fge', '#a', c), ('fge', '#b', c)), ('fge', ('fmax', a, b), c)), + # These patterns can result when (a < b || a < c) => (a < min(b, c)) + # transformations occur before constant propagation and loop-unrolling. + (('~flt', a, ('fmax', b, a)), ('flt', a, b)), + (('~flt', ('fmin', a, b), a), ('flt', b, a)), + (('~fge', a, ('fmin', b, a)), True), + (('~fge', ('fmax', a, b), a), True), + (('~flt', a, ('fmin', b, a)), False), + (('~flt', ('fmax', a, b), a), False), + (('fabs', ('slt', a, b)), ('slt', a, b)), (('fabs', ('sge', a, b)), ('sge', a, b)), (('fabs', ('seq', a, b)), ('seq', a, b)), |