diff --git a/src/freedreno/ir3/ir3_nir.c b/src/freedreno/ir3/ir3_nir.c index 8558b3f59bc..624f726fcfd 100644 --- a/src/freedreno/ir3/ir3_nir.c +++ b/src/freedreno/ir3/ir3_nir.c @@ -310,7 +310,8 @@ ir3_get_variable_size_align_bytes(const glsl_type *type, unsigned *size, unsigne }) bool -ir3_optimize_loop(struct ir3_compiler *compiler, nir_shader *s) +ir3_optimize_loop(struct ir3_compiler *compiler, + struct ir3_optimize_options *options, nir_shader *s) { MESA_TRACE_FUNC(); @@ -715,7 +716,8 @@ ir3_finalize_nir(struct ir3_compiler *compiler, OPT(s, nir_lower_is_helper_invocation); OPT(s, nir_opt_combine_barriers, NULL, NULL); - ir3_optimize_loop(compiler, s); + struct ir3_optimize_options optimize_options = {}; + ir3_optimize_loop(compiler, &optimize_options, s); /* do idiv lowering after first opt loop to get a chance to propagate * constants for divide by immed power-of-two: @@ -740,7 +742,7 @@ ir3_finalize_nir(struct ir3_compiler *compiler, bool vectorize_progress = OPT(s, nir_opt_load_store_vectorize, &vectorize_opts); if (idiv_progress || vectorize_progress) - ir3_optimize_loop(compiler, s); + ir3_optimize_loop(compiler, &optimize_options, s); OPT(s, nir_remove_dead_variables, nir_var_function_temp, NULL); @@ -1030,7 +1032,8 @@ ir3_nir_post_finalize(struct ir3_shader *shader) if (compiler->gen >= 6) OPT(s, ir3_nir_lower_ssbo_size, compiler->options.storage_16bit ? 1 : 2); - ir3_optimize_loop(compiler, s); + struct ir3_optimize_options optimize_options = {}; + ir3_optimize_loop(compiler, &optimize_options, s); } static bool @@ -1246,9 +1249,11 @@ ir3_nir_lower_variant(struct ir3_shader_variant *so, ir3_setup_const_state(s, so, ir3_const_state_mut(so)); } + struct ir3_optimize_options optimize_options = {}; + /* Cleanup code leftover from lowering passes before opt_preamble */ if (progress) { - ir3_optimize_loop(so->compiler, s); + ir3_optimize_loop(so->compiler, &optimize_options, s); /* No need to run the optimize loop again if there's no progress after * this point. @@ -1308,17 +1313,17 @@ ir3_nir_lower_variant(struct ir3_shader_variant *so, } if (progress) - ir3_optimize_loop(so->compiler, s); + ir3_optimize_loop(so->compiler, &optimize_options, s); /* verify that progress is always set */ - assert(!ir3_optimize_loop(so->compiler, s)); + assert(!ir3_optimize_loop(so->compiler, &optimize_options, s)); /* Fixup indirect load_const_ir3's which end up with a const base offset * which is too large to encode. Do this late(ish) so we actually * can differentiate indirect vs non-indirect. */ if (OPT(s, ir3_nir_fixup_load_const_ir3)) - ir3_optimize_loop(so->compiler, s); + ir3_optimize_loop(so->compiler, &optimize_options, s); /* Do late algebraic optimization to turn add(a, neg(b)) back into * subs, then the mandatory cleanup after algebraic. Note that it may diff --git a/src/freedreno/ir3/ir3_nir.h b/src/freedreno/ir3/ir3_nir.h index 0aa8638f2b1..e6d5d9690b6 100644 --- a/src/freedreno/ir3/ir3_nir.h +++ b/src/freedreno/ir3/ir3_nir.h @@ -63,7 +63,10 @@ nir_mem_access_size_align ir3_mem_access_size_align( bool ir3_nir_opt_branch_and_or_not(nir_shader *nir); bool ir3_nir_opt_triops_bitwise(nir_shader *nir); -bool ir3_optimize_loop(struct ir3_compiler *compiler, nir_shader *s); + +struct ir3_optimize_options {}; +bool ir3_optimize_loop(struct ir3_compiler *compiler, + struct ir3_optimize_options *options, nir_shader *s); void ir3_nir_lower_io_vars_to_temporaries(nir_shader *s); void ir3_finalize_nir(struct ir3_compiler *compiler, const struct ir3_shader_nir_options *options, diff --git a/src/freedreno/vulkan/tu_shader.cc b/src/freedreno/vulkan/tu_shader.cc index 8de3e9f2a7d..0786a07bd39 100644 --- a/src/freedreno/vulkan/tu_shader.cc +++ b/src/freedreno/vulkan/tu_shader.cc @@ -135,7 +135,8 @@ tu_spirv_to_nir(struct tu_device *dev, if (key->lower_view_index_to_device_index) NIR_PASS(_, nir, nir_lower_view_index_to_device_index); - ir3_optimize_loop(dev->compiler, nir); + struct ir3_optimize_options optimize_options = {}; + ir3_optimize_loop(dev->compiler, &optimize_options, nir); nir_opt_peephole_select_options peephole_select_options = { .limit = 0,