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

v2: Rebase on almost 2 years.  Require that one of the arguments to fmin
or fmax be used only once.  This prevents some regressions.

shader-db results:

Skylake, Broadwell, and Haswell had similar results.  Skylake shown.
total instructions in shared programs: 14526021 -> 14525913 (<.01%)
instructions in affected programs: 4613 -> 4505 (-2.34%)
helped: 31
HURT: 0
helped stats (abs) min: 1 max: 4 x̄: 3.48 x̃: 4
helped stats (rel) min: 0.62% max: 6.67% x̄: 3.31% x̃: 2.42%

total cycles in shared programs: 533118710 -> 533118403 (<.01%)
cycles in affected programs: 34334 -> 34027 (-0.89%)
helped: 24
HURT: 0
helped stats (abs) min: 4 max: 24 x̄: 12.79 x̃: 14
helped stats (rel) min: 0.25% max: 2.40% x̄: 1.08% x̃: 1.03%

Ivy Bridge
total instructions in shared programs: 11817676 -> 11817596 (<.01%)
instructions in affected programs: 4660 -> 4580 (-1.72%)
helped: 20
HURT: 0
helped stats (abs) min: 4 max: 4 x̄: 4.00 x̃: 4
helped stats (rel) min: 0.90% max: 3.23% x̄: 1.95% x̃: 1.95%

total cycles in shared programs: 257564068 -> 257563970 (<.01%)
cycles in affected programs: 39922 -> 39824 (-0.25%)
helped: 14
HURT: 2
helped stats (abs) min: 1 max: 26 x̄: 9.00 x̃: 4
helped stats (rel) min: 0.05% max: 1.58% x̄: 0.38% x̃: 0.22%
HURT stats (abs)   min: 14 max: 14 x̄: 14.00 x̃: 14
HURT stats (rel)   min: 0.50% max: 0.50% x̄: 0.50% x̃: 0.50%
abs t: -0.63, p: 53.89%
rel t: -0.30, p: 77.19%
Inconclusive result (cannot disprove both null hypothoses).

No changes on GM45, Iron Lake, or Sandy Bridge.

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

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index cb690d3..8129e92 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -158,6 +158,11 @@ optimizations = [
    # a != 0.0
    (('flt', 0.0, ('fabs', a)), ('fne', a, 0.0)),
 
+   (('fmax',                        ('b2f(is_used_once)', a),           
('b2f', b)),           ('b2f', ('ior', a, b))),
+   (('fmax', ('fneg(is_used_once)', ('b2f(is_used_once)', a)), ('fneg', 
('b2f', b))), ('fneg', ('b2f', ('ior', a, b)))),
+   (('fmin',                        ('b2f(is_used_once)', a),           
('b2f', b)),           ('b2f', ('iand', a, b))),
+   (('fmin', ('fneg(is_used_once)', ('b2f(is_used_once)', a)), ('fneg', 
('b2f', b))), ('fneg', ('b2f', ('iand', a, b)))),
+
    # ignore this opt when the result is used by a bcsel or if so we can make
    # use of conditional modifiers on supported hardware.
    (('flt(is_not_used_by_conditional)', ('fadd(is_used_once)', a, ('fneg', 
b)), 0.0), ('flt', a, 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