Mesa (main): st/nir: always revectorise if scalarising happens.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 3 02:35:25 UTC 2021


Module: Mesa
Branch: main
Commit: 1956ff08ad8597ac758e9afceabbbf65f312857e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1956ff08ad8597ac758e9afceabbbf65f312857e

Author: Dave Airlie <airlied at gmail.com>
Date:   Tue May 18 13:31:14 2021 +1000

st/nir: always revectorise if scalarising happens.

This fixes arb_gpu_shader_fp64-vs-non-uniform-control-flow-ssbo
on crocus.

Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11098>

---

 src/mesa/state_tracker/st_glsl_to_nir.cpp | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index bf77064efb4..e9ea019a498 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -534,13 +534,14 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog,
    if (nir->options->lower_int64_options ||
        nir->options->lower_doubles_options) {
       bool lowered_64bit_ops = false;
+      bool revectorize = false;
 
       /* nir_lower_doubles is not prepared for vector ops, so if the backend doesn't
        * request lower_alu_to_scalar until now, lower all 64 bit ops, and try to
        * vectorize them afterwards again */
       if (!nir->options->lower_to_scalar) {
-         NIR_PASS_V(nir, nir_lower_alu_to_scalar, filter_64_bit_instr, nullptr);
-         NIR_PASS_V(nir, nir_lower_phis_to_scalar, false);
+         NIR_PASS(revectorize, nir, nir_lower_alu_to_scalar, filter_64_bit_instr, nullptr);
+         NIR_PASS(revectorize, nir, nir_lower_phis_to_scalar, false);
       }
 
       if (nir->options->lower_doubles_options) {
@@ -550,11 +551,11 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog,
       if (nir->options->lower_int64_options)
          NIR_PASS(lowered_64bit_ops, nir, nir_lower_int64);
 
-      if (lowered_64bit_ops) {
-         if (!nir->options->lower_to_scalar)
-            NIR_PASS_V(nir, nir_opt_vectorize, nullptr, nullptr);
+      if (revectorize)
+         NIR_PASS_V(nir, nir_opt_vectorize, nullptr, nullptr);
+
+      if (revectorize || lowered_64bit_ops)
          st_nir_opts(nir);
-      }
    }
 
    nir_variable_mode mask =



More information about the mesa-commit mailing list