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

shader-db results:

Skylake and Broadwell had similar results (Skylake shown)
total instructions in shared programs: 14526033 -> 14526021 (<.01%)
instructions in affected programs: 1450 -> 1438 (-0.83%)
helped: 12
HURT: 0
helped stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1
helped stats (rel) min: 0.68% max: 0.86% x̄: 0.83% x̃: 0.86%

total cycles in shared programs: 533121762 -> 533118710 (<.01%)
cycles in affected programs: 75423 -> 72371 (-4.05%)
helped: 11
HURT: 1
helped stats (abs) min: 60 max: 300 x̄: 278.18 x̃: 300
helped stats (rel) min: 1.15% max: 4.42% x̄: 4.09% 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%

Haswell, Ivy Bridge and Sandy Bridge had similar results (Haswell shown).
total cycles in shared programs: 409473831 -> 409472382 (<.01%)
cycles in affected programs: 46203 -> 44754 (-3.14%)
helped: 12
HURT: 2
helped stats (abs) min: 1 max: 140 x̄: 121.75 x̃: 140
helped stats (rel) min: 0.07% max: 4.01% x̄: 3.41% 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%
abs t: 3.56, p: 0.39%
rel t: 3.19, p: 0.78%
Positive result.

No changes on GM45 or Iron Lake.

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

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index 09538ba..cb690d3 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -205,6 +205,13 @@ 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),
+
    (('fabs', ('slt', a, b)), ('slt', a, b)),
    (('fabs', ('sge', a, b)), ('sge', a, b)),
    (('fabs', ('seq', a, b)), ('seq', 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