Mesa (main): broadcom/compiler: add a loop unrolling pass

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu May 6 10:43:23 UTC 2021


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

Author: Iago Toral Quiroga <itoral at igalia.com>
Date:   Mon May  3 11:33:46 2021 +0200

broadcom/compiler: add a loop unrolling pass

Right now this is useful for Vulkan onnly, because GL gets loop
unrolling from the GLSL compiler and/or mesa state tracker
NIR front-ends.

Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10647>

---

 src/broadcom/compiler/nir_to_vir.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c
index 2bbf613934d..38a39008a9a 100644
--- a/src/broadcom/compiler/nir_to_vir.c
+++ b/src/broadcom/compiler/nir_to_vir.c
@@ -1825,6 +1825,13 @@ v3d_optimize_nir(struct nir_shader *s)
 
                 NIR_PASS(progress, s, nir_opt_undef);
                 NIR_PASS(progress, s, nir_lower_undef_to_zero);
+
+                if (s->options->max_unroll_iterations > 0) {
+                        NIR_PASS(progress, s, nir_opt_loop_unroll,
+                                 nir_var_shader_in |
+                                 nir_var_shader_out |
+                                 nir_var_function_temp);
+                }
         } while (progress);
 
         nir_move_options sink_opts =



More information about the mesa-commit mailing list