From f9f60aa84451bf8f38a102e0481292b084fd655a Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Fri, 6 Mar 2026 15:23:02 +0000 Subject: [PATCH] radv: don't use radv_optimize_nir after lowering indirect derefs for RT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Just these three passes seem necessary. radv_rt_nir_to_asm() will call radv_optimize_nir() later. fossil-db (navi21): Totals from 32 (0.02% of 202427) affected shaders: Instrs: 205974 -> 205948 (-0.01%) CodeSize: 1131492 -> 1131352 (-0.01%) SpillSGPRs: 321 -> 320 (-0.31%) Latency: 2171106 -> 2170677 (-0.02%); split: -0.02%, +0.00% InvThroughput: 540282 -> 540174 (-0.02%) VClause: 5579 -> 5578 (-0.02%) SClause: 4586 -> 4582 (-0.09%) Copies: 23543 -> 23535 (-0.03%) PreSGPRs: 2444 -> 2443 (-0.04%) VALU: 129415 -> 129399 (-0.01%) SMEM: 7175 -> 7170 (-0.07%) Signed-off-by: Rhys Perry Acked-by: Marek Olšák Reviewed-by: Georg Lehmann Part-of: --- src/amd/vulkan/radv_pipeline_rt.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/amd/vulkan/radv_pipeline_rt.c b/src/amd/vulkan/radv_pipeline_rt.c index 4a849e688ce..613e1184762 100644 --- a/src/amd/vulkan/radv_pipeline_rt.c +++ b/src/amd/vulkan/radv_pipeline_rt.c @@ -657,11 +657,9 @@ radv_rt_spirv_to_nir(const struct radv_compiler_info *compiler_info, struct radv { stage->nir = radv_shader_spirv_to_nir(compiler_info, stage, NULL, false); - bool indirect_derefs_lowered = false; - NIR_PASS(indirect_derefs_lowered, stage->nir, ac_nir_lower_indirect_derefs); + NIR_PASS(_, stage->nir, ac_nir_lower_indirect_derefs); NIR_PASS(_, stage->nir, nir_lower_vars_to_ssa); - if (indirect_derefs_lowered && !stage->key.optimisations_disabled) - radv_optimize_nir(stage->nir, false); + NIR_PASS(_, stage->nir, nir_remove_dead_variables, nir_var_function_temp, NULL); nir_foreach_variable_with_modes (var, stage->nir, nir_var_ray_hit_attrib) { unsigned size, alignment;