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

Author: Jason Ekstrand <[email protected]>
Date:   Fri Mar 29 17:12:47 2019 -0500

nir/algebraic: Add some logical OR and AND patterns

The new OR pattern has been seen in the wild and can end up being
generated by GLSLang.  Not sure about the other two new patterns but we
may as well throw them in for completeness.  While we're here, we can
drop the '@bool' specifier from the one pattern because specifying True
already implies 1-bit which basically implies boolean.

Shader-db results on Kaby Lake:

    total instructions in shared programs: 15321227 -> 15321129 (<.01%)
    instructions in affected programs: 3594 -> 3496 (-2.73%)
    helped: 6
    HURT: 0

    total cycles in shared programs: 357481321 -> 357479725 (<.01%)
    cycles in affected programs: 44109 -> 42513 (-3.62%)
    helped: 6
    HURT: 0

VkPipeline-DB results on Kaby Lake:

    total instructions in shared programs: 3770504 -> 3769734 (-0.02%)
    instructions in affected programs: 19058 -> 18288 (-4.04%)
    helped: 163
    HURT: 0

    total cycles in shared programs: 1417583701 -> 1417569727 (<.01%)
    cycles in affected programs: 750958 -> 736984 (-1.86%)
    helped: 158
    HURT: 1

Reviewed-by: Timothy Arceri <[email protected]>

---

 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 597d479bd63..d6737995844 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -313,6 +313,9 @@ optimizations = [
    (('bcsel', a, ('bcsel', b, c, d), ('bcsel(is_used_once)', b, 'e', d)), 
('bcsel', b, ('bcsel', a, c, 'e'), d)),
    (('bcsel', a, ('bcsel(is_used_once)', b, c, d), ('bcsel', b, 'e', d)), 
('bcsel', b, ('bcsel', a, c, 'e'), d)),
    (('bcsel', a, True, b), ('ior', a, b)),
+   (('bcsel', a, a, b), ('ior', a, b)),
+   (('bcsel', a, b, False), ('iand', a, b)),
+   (('bcsel', a, b, a), ('iand', a, b)),
    (('fmin', a, a), a),
    (('fmax', a, a), a),
    (('imin', a, a), a),

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to