[Mesa-dev] [PATCH 3/3] nir: opt_algebraic add some opts to remove spilling in dirt showdown
Timothy Arceri
tarceri at itsqueeze.com
Thu Jul 19 03:29:52 UTC 2018
These appear in a single Dirt Showdown compute shader. With this
VGPR spilling in the radeonsi NIR backend is reduced.
---
src/compiler/nir/nir_opt_algebraic.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 808679d0bbb..97ffc75d1c3 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -221,8 +221,19 @@ optimizations = [
(('~bcsel', ('fge', a, b), b, a), ('fmin', a, b)),
(('~bcsel', ('fge', b, a), b, a), ('fmax', a, b)),
(('bcsel', ('inot', a), b, c), ('bcsel', a, c, b)),
+ (('bcsel', a, b, ('inot', 'a at bool')), ('bcsel', a, b, True)),
+ (('bcsel', a, ('inot', 'a at bool'), b), ('bcsel', a, False, b)),
(('bcsel', a, ('bcsel', a, b, c), d), ('bcsel', a, b, d)),
+ (('bcsel', a, 'a at bool', 'b at bool'), ('ior', a, b)),
(('bcsel', a, True, 'b at bool'), ('ior', a, b)),
+ (('bcsel', a, ('iand', 'a at bool', b), c), ('bcsel', a, b, c)),
+ (('bcsel', a, b, ('iand', ('inot', 'a at bool'), c)), ('bcsel', a, b, c)),
+ (('bcsel', a, ('ior', ('inot', 'a at bool'), b), c), ('bcsel', a, b, c)),
+ (('bcsel', ('fge', a, b), c, ('flt', a, b)), ('bcsel', ('fge', a, b), c, True)),
+ (('bcsel', ('fge', a, b), ('ior', ('flt', a, b), c), d), ('bcsel', ('fge', a, b), c, d)),
+ (('bcsel', ('iand', 'a at bool', 'b at bool'), ('bcsel', a, b, True), c), ('bcsel', ('iand', a, b), True, c)),
+ (('ior', ('bcsel', 'a at bool', 'b at bool', 'c at bool'), ('bcsel', a, True, c)), ('ior', a, c)),
+ (('ior', ('bcsel', 'a at bool', 'b at bool', 'c at bool'), ('ior', a, c)), ('ior', a, c)),
(('fmin', a, a), a),
(('fmax', a, a), a),
(('imin', a, a), a),
@@ -287,7 +298,14 @@ optimizations = [
(('ior', 'a at bool', ('ieq', a, False)), True),
(('ior', 'a at bool', ('inot', a)), True),
+ (('ior', a, ('iand', ('inot', 'a at bool'), 'b at bool')), ('ior', a, b)),
+ (('ior', ('ior', a, b), a), ('ior', a, b)),
+ (('iand', ('iand', a, b), a), ('iand', a, b)),
+
+ (('iand', ('fge', a, b), ('ior', ('flt', a, b), 'c at bool')), ('iand', ('fge', a, b), c)),
+ (('iand', ('iand', 'a at bool', 'b at bool'), a), ('iand', a, b)),
+ (('iand', ('ior', 'a at bool', 'b at bool'), ('inot', 'a at bool')), ('iand', ('inot', 'a at bool'), 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))
--
2.17.1
More information about the mesa-dev
mailing list