From: Ian Romanick <ian.d.roman...@intel.com>

Doing the same for the existing feq and fne transformations didn't help
anything in shader-db.

shader-db results:

Skylake
total instructions in shared programs: 14529598 -> 14526282 (-0.02%)
instructions in affected programs: 402420 -> 399104 (-0.82%)
helped: 2136
HURT: 131
helped stats (abs) min: 1 max: 10 x̄: 1.61 x̃: 1
helped stats (rel) min: 0.03% max: 16.22% x̄: 3.14% x̃: 1.12%
HURT stats (abs)   min: 1 max: 2 x̄: 1.01 x̃: 1
HURT stats (rel)   min: 0.13% max: 7.69% x̄: 0.75% x̃: 0.57%
abs t: 6.19, p: <.01%
rel t: 8.18, p: <.01%
Positive result.

total cycles in shared programs: 533148771 -> 533122387 (<.01%)
cycles in affected programs: 10356261 -> 10329877 (-0.25%)
helped: 1933
HURT: 844
helped stats (abs) min: 1 max: 490 x̄: 29.44 x̃: 16
helped stats (rel) min: <.01% max: 28.57% x̄: 3.43% x̃: 1.88%
HURT stats (abs)   min: 1 max: 423 x̄: 36.17 x̃: 12
HURT stats (rel)   min: <.01% max: 23.75% x̄: 1.90% x̃: 0.59%
abs t: -3.06, p: 0.22%
rel t: 10.07, p: <.01%
Inconclusive result (absolute and relative data disagree).

Broadwell
total instructions in shared programs: 14819433 -> 14816140 (-0.02%)
instructions in affected programs: 399932 -> 396639 (-0.82%)
helped: 2129
HURT: 129
helped stats (abs) min: 1 max: 10 x̄: 1.61 x̃: 1
helped stats (rel) min: 0.03% max: 16.22% x̄: 2.75% x̃: 1.12%
HURT stats (abs)   min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel)   min: 0.19% max: 7.69% x̄: 0.75% x̃: 0.56%
abs t: 6.20, p: <.01%
rel t: 8.03, p: <.01%
Positive result.

total cycles in shared programs: 559379982 -> 559342256 (<.01%)
cycles in affected programs: 10791218 -> 10753492 (-0.35%)
helped: 1952
HURT: 908
helped stats (abs) min: 1 max: 5762 x̄: 37.71 x̃: 16
helped stats (rel) min: <.01% max: 28.57% x̄: 3.54% x̃: 2.09%
HURT stats (abs)   min: 1 max: 573 x̄: 39.51 x̃: 10
HURT stats (rel)   min: <.01% max: 27.78% x̄: 1.93% x̃: 0.66%
abs t: -0.34, p: 73.70%
rel t: 9.88, p: <.01%
Inconclusive result (cannot disprove both null hypothoses).

Haswell
total instructions in shared programs: 13105209 -> 13101495 (-0.03%)
instructions in affected programs: 483588 -> 479874 (-0.77%)
helped: 2494
HURT: 132
helped stats (abs) min: 1 max: 11 x̄: 1.54 x̃: 1
helped stats (rel) min: 0.03% max: 25.00% x̄: 2.49% x̃: 0.89%
HURT stats (abs)   min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel)   min: 0.19% max: 7.69% x̄: 0.83% x̃: 0.60%
abs t: 5.72, p: <.01%
rel t: 6.00, p: <.01%
Positive result.

total cycles in shared programs: 409490551 -> 409474526 (<.01%)
cycles in affected programs: 10314955 -> 10298930 (-0.16%)
helped: 2242
HURT: 1083
helped stats (abs) min: 1 max: 2860 x̄: 32.79 x̃: 18
helped stats (rel) min: <.01% max: 36.36% x̄: 3.33% x̃: 1.82%
HURT stats (abs)   min: 1 max: 1080 x̄: 53.08 x̃: 15
HURT stats (rel)   min: 0.01% max: 51.33% x̄: 2.65% x̃: 0.79%
abs t: -6.45, p: <.01%
rel t: 4.26, p: <.01%
Inconclusive result (absolute and relative data disagree).

LOST:   1
GAINED: 0

Ivy Bridge
total instructions in shared programs: 11817620 -> 11813863 (-0.03%)
instructions in affected programs: 616613 -> 612856 (-0.61%)
helped: 2551
HURT: 188
helped stats (abs) min: 1 max: 11 x̄: 1.59 x̃: 1
helped stats (rel) min: 0.03% max: 25.00% x̄: 2.27% x̃: 0.74%
HURT stats (abs)   min: 1 max: 4 x̄: 1.61 x̃: 1
HURT stats (rel)   min: 0.09% max: 7.69% x̄: 0.89% x̃: 0.56%
abs t: -0.17, p: 86.53%
rel t: 6.24, p: <.01%
Inconclusive result (cannot disprove both null hypothoses).

total cycles in shared programs: 257538699 -> 257522659 (<.01%)
cycles in affected programs: 8806115 -> 8790075 (-0.18%)
helped: 2160
HURT: 1052
helped stats (abs) min: 1 max: 1392 x̄: 29.42 x̃: 18
helped stats (rel) min: <.01% max: 34.51% x̄: 3.19% x̃: 1.58%
HURT stats (abs)   min: 1 max: 633 x̄: 45.16 x̃: 12
HURT stats (rel)   min: <.01% max: 25.95% x̄: 2.36% x̃: 0.64%
abs t: -6.81, p: <.01%
rel t: 5.54, p: <.01%
Inconclusive result (absolute and relative data disagree).

LOST:   1
GAINED: 0

Sandy Bridge
total instructions in shared programs: 10548980 -> 10545653 (-0.03%)
instructions in affected programs: 505185 -> 501858 (-0.66%)
helped: 2200
HURT: 142
helped stats (abs) min: 1 max: 10 x̄: 1.62 x̃: 1
helped stats (rel) min: 0.03% max: 27.27% x̄: 2.44% x̃: 0.83%
HURT stats (abs)   min: 1 max: 4 x̄: 1.65 x̃: 1
HURT stats (rel)   min: 0.08% max: 7.14% x̄: 0.92% x̃: 0.50%
abs t: -0.28, p: 78.16%
rel t: 5.65, p: <.01%
Inconclusive result (cannot disprove both null hypothoses).

total cycles in shared programs: 146130803 -> 146113003 (-0.01%)
cycles in affected programs: 7378575 -> 7360775 (-0.24%)
helped: 1743
HURT: 1011
helped stats (abs) min: 1 max: 694 x̄: 24.54 x̃: 16
helped stats (rel) min: 0.02% max: 33.33% x̄: 2.93% x̃: 1.43%
HURT stats (abs)   min: 1 max: 839 x̄: 24.71 x̃: 9
HURT stats (rel)   min: 0.01% max: 17.35% x̄: 0.83% x̃: 0.28%
abs t: -0.08, p: 93.60%
rel t: 16.65, p: <.01%
Inconclusive result (cannot disprove both null hypothoses).

LOST:   1
GAINED: 0

Iron Lake
total instructions in shared programs: 7888446 -> 7886959 (-0.02%)
instructions in affected programs: 331581 -> 330094 (-0.45%)
helped: 1160
HURT: 97
helped stats (abs) min: 1 max: 10 x̄: 1.37 x̃: 1
helped stats (rel) min: 0.02% max: 9.68% x̄: 0.93% x̃: 0.43%
HURT stats (abs)   min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel)   min: 0.17% max: 4.17% x̄: 0.37% x̃: 0.25%
abs t: 3.28, p: 0.11%
rel t: 3.77, p: 0.02%
Positive result.

total cycles in shared programs: 178130766 -> 178116996 (<.01%)
cycles in affected programs: 12534564 -> 12520794 (-0.11%)
helped: 1856
HURT: 187
helped stats (abs) min: 2 max: 202 x̄: 7.78 x̃: 4
helped stats (rel) min: <.01% max: 6.47% x̄: 0.28% x̃: 0.11%
HURT stats (abs)   min: 2 max: 26 x̄: 3.55 x̃: 2
HURT stats (rel)   min: 0.01% max: 2.14% x̄: 0.08% x̃: 0.02%
abs t: 3.66, p: 0.03%
rel t: 3.79, p: 0.02%
Positive result.

GM45
total instructions in shared programs: 4858912 -> 4857887 (-0.02%)
instructions in affected programs: 237565 -> 236540 (-0.43%)
helped: 867
HURT: 57
helped stats (abs) min: 1 max: 10 x̄: 1.25 x̃: 1
helped stats (rel) min: 0.02% max: 9.38% x̄: 0.87% x̃: 0.43%
HURT stats (abs)   min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel)   min: 0.16% max: 3.85% x̄: 0.34% x̃: 0.22%
abs t: 2.05, p: 4.09%
rel t: 3.06, p: 0.23%
Positive result.

total cycles in shared programs: 122189118 -> 122180816 (<.01%)
cycles in affected programs: 8776418 -> 8768116 (-0.09%)
helped: 1213
HURT: 166
helped stats (abs) min: 2 max: 202 x̄: 7.30 x̃: 4
helped stats (rel) min: <.01% max: 6.43% x̄: 0.25% x̃: 0.11%
HURT stats (abs)   min: 2 max: 26 x̄: 3.35 x̃: 2
HURT stats (rel)   min: 0.01% max: 2.14% x̄: 0.06% x̃: 0.02%
abs t: 3.43, p: 0.06%
rel t: 3.68, p: 0.02%
Positive result.

Signed-off-by: Ian Romanick <ian.d.roman...@intel.com>
---
 src/compiler/nir/nir_opt_algebraic.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index ad75228..0ada915 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -354,7 +354,8 @@ optimizations = [
    # a single non-constant.  We could do better eventually.
    (('~fmul', '#a', ('fmul', b, '#c')), ('fmul', ('fmul', a, c), b)),
    (('imul', '#a', ('imul', b, '#c')), ('imul', ('imul', a, c), b)),
-   (('~fadd', '#a', ('fadd', b, '#c')), ('fadd', ('fadd', a, c), b)),
+   (('~fadd', '#a',          ('fadd', b, '#c')),  ('fadd', ('fadd', a,         
 c),           b)),
+   (('~fadd', '#a', ('fneg', ('fadd', b, '#c'))), ('fadd', ('fadd', a, 
('fneg', c)), ('fneg', b))),
    (('iadd', '#a', ('iadd', b, '#c')), ('iadd', ('iadd', a, c), b)),
 
    # By definition...
@@ -569,8 +570,10 @@ before_ffma_optimizations = [
 late_optimizations = [
    # Most of these optimizations aren't quite safe when you get infinity or
    # Nan involved but the first one should be fine.
-   (('flt', ('fadd', a, b), 0.0), ('flt', a, ('fneg', b))),
-   (('~fge', ('fadd', a, b), 0.0), ('fge', a, ('fneg', b))),
+   (('flt',          ('fadd', a, b),  0.0), ('flt',          a, ('fneg', b))),
+   (('flt', ('fneg', ('fadd', a, b)), 0.0), ('flt', ('fneg', a),         b)),
+   (('~fge',          ('fadd', a, b),  0.0), ('fge',          a, ('fneg', b))),
+   (('~fge', ('fneg', ('fadd', a, b)), 0.0), ('fge', ('fneg', a),         b)),
    (('~feq', ('fadd', a, b), 0.0), ('feq', a, ('fneg', b))),
    (('~fne', ('fadd', a, b), 0.0), ('fne', a, ('fneg', b))),
 
-- 
2.9.5

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to