Mesa (master): nir: also move b2i in case of nir_move_copies

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jul 20 16:31:07 UTC 2020


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

Author: Daniel Schürmann <daniel at schuermann.dev>
Date:   Wed Apr 29 15:36:41 2020 +0100

nir: also move b2i in case of nir_move_copies

Booleans are often more efficient with register usage.
This also allows to move comparisons further.

Totals from affected shaders: (VEGA)
SGPRS: 451608 -> 450320 (-0.29 %)
VGPRS: 351448 -> 351256 (-0.05 %)
Spilled SGPRs: 105 -> 105 (0.00 %)
Spilled VGPRs: 0 -> 0 (0.00 %)
Private memory VGPRs: 0 -> 0 (0.00 %)
Scratch size: 1008 -> 1008 (0.00 %) dwords per thread
Code Size: 26555596 -> 26551080 (-0.02 %) bytes
LDS: 10323 -> 10323 (0.00 %) blocks
Max Waves: 42850 -> 42934 (0.20 %)

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4830>

---

 src/compiler/nir/nir_opt_sink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_opt_sink.c b/src/compiler/nir/nir_opt_sink.c
index 1d551fe9f8b..03feacfedec 100644
--- a/src/compiler/nir/nir_opt_sink.c
+++ b/src/compiler/nir/nir_opt_sink.c
@@ -45,7 +45,8 @@ nir_can_move_instr(nir_instr *instr, nir_move_options options)
       return options & nir_move_const_undef;
    }
    case nir_instr_type_alu: {
-      if (nir_op_is_vec(nir_instr_as_alu(instr)->op))
+      if (nir_op_is_vec(nir_instr_as_alu(instr)->op) ||
+          nir_instr_as_alu(instr)->op == nir_op_b2i32)
          return options & nir_move_copies;
       if (nir_alu_instr_is_comparison(nir_instr_as_alu(instr)))
          return options & nir_move_comparisons;



More information about the mesa-commit mailing list