Mesa (main): bifrost: Run nir_lower_global_vars_to_local before nir_lower_vars_to_scratch

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 16 22:08:27 UTC 2022


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

Author: Jason Ekstrand <jason.ekstrand at collabora.com>
Date:   Tue Mar 15 16:22:27 2022 -0500

bifrost: Run nir_lower_global_vars_to_local before nir_lower_vars_to_scratch

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16483>

---

 src/panfrost/bifrost/bifrost_compile.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index 2590014f891..ee54015e40e 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -4543,6 +4543,9 @@ bi_finalize_nir(nir_shader *nir, unsigned gpu_id, bool is_blend)
                         psiz->data.precision = GLSL_PRECISION_MEDIUM;
         }
 
+        /* Get rid of any global vars before we lower to scratch. */
+        NIR_PASS_V(nir, nir_lower_global_vars_to_local);
+
         /* Lower large arrays to scratch and small arrays to bcsel (TODO: tune
          * threshold, but not until addresses / csel is optimized better) */
         NIR_PASS_V(nir, nir_lower_vars_to_scratch, nir_var_function_temp, 16,
@@ -4550,7 +4553,6 @@ bi_finalize_nir(nir_shader *nir, unsigned gpu_id, bool is_blend)
         NIR_PASS_V(nir, nir_lower_indirect_derefs, nir_var_function_temp, ~0);
 
         NIR_PASS_V(nir, nir_split_var_copies);
-        NIR_PASS_V(nir, nir_lower_global_vars_to_local);
         NIR_PASS_V(nir, nir_lower_var_copies);
         NIR_PASS_V(nir, nir_lower_vars_to_ssa);
         NIR_PASS_V(nir, nir_lower_io, nir_var_shader_in | nir_var_shader_out,



More information about the mesa-commit mailing list