Mesa (master): nir/algebraic: add optimization pattern for ('ult', a, ('and', b, a)) and friends.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 24 17:12:23 UTC 2019


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

Author: Daniel Schürmann <daniel.schuermann at campus.tu-berlin.de>
Date:   Fri Jan 25 12:48:44 2019 +0100

nir/algebraic: add optimization pattern for ('ult', a, ('and', b, a)) and friends.

These optimizations are based on the fact that
'and(a,b) <= umin(a,b)'.
For AMD, this series moves the optimization from LLVM to NIR,
so currently no vkpipeline-db changes here.

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

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

diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index f1b5893be88..36e576b7eff 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -497,6 +497,10 @@ optimizations = [
    (('ult', ('umax', a, b), a), False),
    (('uge', a, ('umax', b, a)), ('uge', a, b)),
    (('uge', ('umin', a, b), a), ('uge', b, a)),
+   (('ult', a, ('iand', b, a)), False),
+   (('ult', ('ior', a, b), a), False),
+   (('uge', a, ('iand', b, a)), True),
+   (('uge', ('ior', a, b), a), True),
 
    (('ilt', '#a', ('imax', '#b', c)), ('ior', ('ilt', a, b), ('ilt', a, c))),
    (('ilt', ('imin', '#a', b), '#c'), ('ior', ('ilt', a, c), ('ilt', b, c))),




More information about the mesa-commit mailing list