summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIago Toral Quiroga <itoral@igalia.com>2021-05-03 11:33:46 +0200
committerIago Toral Quiroga <itoral@igalia.com>2021-05-06 12:24:29 +0200
commitec72b876fe86683b28a7fad4c2e1fc0797802e99 (patch)
tree89410ebbcddff68215390c96d0fd8f7297d1b0fe
parent43dd023bd1eb23a5cdb1470c6a30595c3fbf319a (diff)
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@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10647>
-rw-r--r--src/broadcom/compiler/nir_to_vir.c7
1 files changed, 7 insertions, 0 deletions
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 =