radv: call nir_opt_find_array_copies before first radv_optimize_nir()

Totals from 11 (0.01% of 79839) affected shaders: (Navi48)

Instrs: 6514 -> 5526 (-15.17%); split: -16.76%, +1.60%
CodeSize: 34700 -> 29336 (-15.46%); split: -17.30%, +1.84%
Latency: 12372 -> 11545 (-6.68%); split: -8.13%, +1.45%
InvThroughput: 2769 -> 2444 (-11.74%); split: -12.96%, +1.23%
Copies: 738 -> 649 (-12.06%)
Branches: 155 -> 111 (-28.39%)
PreVGPRs: 506 -> 471 (-6.92%); split: -7.71%, +0.79%
VALU: 3467 -> 2915 (-15.92%); split: -16.96%, +1.04%
SALU: 992 -> 839 (-15.42%); split: -16.03%, +0.60%
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38367>
This commit is contained in:
Daniel Schürmann 2025-11-10 13:11:50 +01:00 committed by Marge Bot
parent bf0e04a531
commit d959e17d3d

View file

@ -170,15 +170,6 @@ radv_optimize_nir(struct nir_shader *shader, bool optimize_conservatively)
NIR_LOOP_PASS(progress, skip, shader, nir_split_array_vars, nir_var_function_temp);
NIR_LOOP_PASS(progress, skip, shader, nir_shrink_vec_array_vars, nir_var_function_temp | nir_var_mem_shared);
if (!shader->info.var_copies_lowered) {
/* Only run this pass if nir_lower_var_copies was not called
* yet. That would lower away any copy_deref instructions and we
* don't want to introduce any more.
*/
NIR_LOOP_PASS(progress, skip, shader, nir_opt_find_array_copies);
}
NIR_LOOP_PASS(progress, skip, shader, nir_opt_copy_prop_vars);
NIR_LOOP_PASS(_, skip, shader, nir_lower_vars_to_ssa);
@ -724,6 +715,11 @@ radv_shader_spirv_to_nir(struct radv_device *device, const struct radv_shader_st
NIR_PASS(_, nir, nir_opt_access, &opt_access_options);
if (!stage->key.optimisations_disabled) {
/* Only run this pass once before nir_lower_var_copies is called,
* so that we don't introduce any new copy_deref instructions later.
*/
NIR_PASS(_, nir, nir_opt_find_array_copies);
radv_optimize_nir(nir, false);
NIR_PASS(_, nir, nir_opt_dead_write_vars);