radv: gather nir shader info at the end of radv_optimize_nir()

Otherwise, outputs_read/outputs_written might not be up-to-date
(mostly after nir_remove_dead_variables) and remove_point_size() might
reach an assertion later because the output variable isn't found.

It seems better to run nir_shader_gather_info() at the very end of
radv_optimize_nir() which can change a lot of things anyways.

No fossils-db changes.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35707>
(cherry picked from commit 30ccd97cd2)
This commit is contained in:
Samuel Pitoiset 2025-06-24 09:12:10 +02:00 committed by Eric Engestrom
parent 8a8f5b6962
commit d9b72d2987
4 changed files with 3 additions and 6 deletions

View file

@ -3714,7 +3714,7 @@
"description": "radv: gather nir shader info at the end of radv_optimize_nir()",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -102,9 +102,6 @@ radv_compile_cs(struct radv_device *device, struct vk_pipeline_cache *cache, str
radv_optimize_nir(cs_stage->nir, cs_stage->key.optimisations_disabled);
/* Gather info again, information such as outputs_read can be out-of-date. */
nir_shader_gather_info(cs_stage->nir, nir_shader_get_entrypoint(cs_stage->nir));
/* Run the shader info pass. */
radv_nir_shader_info_init(cs_stage->stage, MESA_SHADER_NONE, &cs_stage->info);
radv_nir_shader_info_pass(device, cs_stage->nir, &cs_stage->layout, &cs_stage->key, NULL, RADV_PIPELINE_COMPUTE,

View file

@ -2741,8 +2741,6 @@ radv_graphics_shaders_compile(struct radv_device *device, struct vk_pipeline_cac
radv_optimize_nir(stages[i].nir, stages[i].key.optimisations_disabled);
/* Gather info again, information such as outputs_read can be out-of-date. */
nir_shader_gather_info(stages[i].nir, nir_shader_get_entrypoint(stages[i].nir));
radv_nir_lower_io(device, stages[i].nir);
stages[i].feedback.duration += os_time_get_nano() - stage_start;

View file

@ -213,6 +213,8 @@ radv_optimize_nir(struct nir_shader *shader, bool optimize_conservatively)
NIR_PASS(progress, shader, nir_opt_move_discards_to_top);
NIR_PASS(progress, shader, nir_opt_move, nir_move_load_ubo);
nir_shader_gather_info(shader, nir_shader_get_entrypoint(shader));
}
void