From ec72b876fe86683b28a7fad4c2e1fc0797802e99 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Mon, 3 May 2021 11:33:46 +0200 Subject: [PATCH] broadcom/compiler: add a loop unrolling pass MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Part-of: --- 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 =