Mesa (master): nir/algebraic: Fix some 1-bit Boolean weirdness

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 18 19:50:11 UTC 2019


Module: Mesa
Branch: master
Commit: f3d6df719ca77170f8d28272cc2c051aafbf5992
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f3d6df719ca77170f8d28272cc2c051aafbf5992

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Mon Dec 17 21:34:11 2018 -0800

nir/algebraic: Fix some 1-bit Boolean weirdness

Skylake, Broadwell, and Haswell had similar results. (Skylake shown)
total cycles in shared programs: 372594532 -> 372594460 (<.01%)
cycles in affected programs: 46854 -> 46782 (-0.15%)
helped: 9
HURT: 0
helped stats (abs) min: 2 max: 22 x̄: 8.00 x̃: 2
helped stats (rel) min: 0.02% max: 0.41% x̄: 0.16% x̃: 0.09%
95% mean confidence interval for cycles value: -14.34 -1.66
95% mean confidence interval for cycles %-change: -0.28% -0.04%
Cycles are helped.

Ivy Bridge
total instructions in shared programs: 12038379 -> 12038373 (<.01%)
instructions in affected programs: 1278 -> 1272 (-0.47%)
helped: 3
HURT: 0
helped stats (abs) min: 2 max: 2 x̄: 2.00 x̃: 2
helped stats (rel) min: 0.31% max: 0.77% x̄: 0.54% x̃: 0.55%

total cycles in shared programs: 180889027 -> 180888997 (<.01%)
cycles in affected programs: 29979 -> 29949 (-0.10%)
helped: 5
HURT: 0
helped stats (abs) min: 1 max: 16 x̄: 6.00 x̃: 5
helped stats (rel) min: 0.02% max: 0.34% x̄: 0.11% x̃: 0.07%
95% mean confidence interval for cycles value: -13.40 1.40
95% mean confidence interval for cycles %-change: -0.27% 0.05%
Inconclusive result (value mean confidence interval includes 0).

Sandy Bridge
total cycles in shared programs: 155091021 -> 155091003 (<.01%)
cycles in affected programs: 8842 -> 8824 (-0.20%)
helped: 2
HURT: 0

No changes on Iron Lake or GM45.

Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/compiler/nir/nir_opt_algebraic.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 23412aca029..0e50c3f51f8 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -407,6 +407,9 @@ optimizations = [
    (('ior', a, ('ieq', a, False)), True),
    (('ior', a, ('inot', a)), -1),
 
+   (('ine', ('ineg', ('b2i32', 'a at 1')), ('ineg', ('b2i32', 'b at 1'))), ('ine', a, b)),
+   (('b2i32', ('ine', 'a at 1', 'b at 1')), ('b2i32', ('ixor', a, b))),
+
    (('iand', ('ieq', 'a at 32', 0), ('ieq', 'b at 32', 0)), ('ieq', ('ior', 'a at 32', 'b at 32'), 0)),
 
    # These patterns can result when (a < b || a < c) => (a < min(b, c))




More information about the mesa-commit mailing list