radeonsi: recompute IO bases after optimizations

to fix an assertion added by the commit, reproduced by viewperf13/catia

Fixes: d06616063c - radeonsi: assert that IO bases don't have holes & the same base isn't used twice

Reviewed-by: Pierre-Eric
(cherry picked from commit 8ea3d794fb)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
This commit is contained in:
Marek Olšák 2026-03-12 14:54:42 -04:00 committed by Eric Engestrom
parent 9257997e3e
commit 6416837667
2 changed files with 6 additions and 2 deletions

View file

@ -3234,7 +3234,7 @@
"description": "radeonsi: recompute IO bases after optimizations",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "d06616063cabda3443f52323e33a890e8f48f6f4",
"notes": null

View file

@ -111,6 +111,7 @@ void si_finalize_nir(struct pipe_screen *screen, struct nir_shader *nir,
bool optimize)
{
struct si_screen *sscreen = (struct si_screen *)screen;
nir_variable_mode recompute_io_bases = 0;
if (nir->info.io_lowered) {
nir_foreach_variable_with_modes(var, nir, nir_var_shader_in | nir_var_shader_out) {
@ -119,7 +120,7 @@ void si_finalize_nir(struct pipe_screen *screen, struct nir_shader *nir,
/* Not all places recompute FS input bases, but we need them to be up to date. */
if (nir->info.stage == MESA_SHADER_FRAGMENT)
NIR_PASS(_, nir, nir_recompute_io_bases, nir_var_shader_in | nir_var_shader_out);
recompute_io_bases = nir_var_shader_in | nir_var_shader_out;
} else {
/* This always recomputes FS output bases. */
nir_lower_io_passes(nir, false);
@ -146,6 +147,9 @@ void si_finalize_nir(struct pipe_screen *screen, struct nir_shader *nir,
NIR_PASS_ASSERT_NO_PROGRESS(nir, nir_opt_intrinsics);
NIR_PASS_ASSERT_NO_PROGRESS(nir, nir_lower_system_values);
if (recompute_io_bases)
NIR_PASS(_, nir, nir_recompute_io_bases, recompute_io_bases);
/* Remove uniforms because those should have been lowered to UBOs already. */
nir_foreach_variable_with_modes_safe(var, nir, nir_var_uniform) {
if (!glsl_type_get_image_count(var->type) &&