broadcom/compiler: move nir_lower_undef_to_zero out of optimization loop

The combination of nir_opt_if and nir_lower_undef_to_zero running inside
the optimization loop could make it to not converge.

This was exercised by ollama running gemma3 compute shaders.

Removing the pass from the optimization loop results in No changes in
shader-db.

Assisted-by: Claude Opus 4.6
Fixes: cbe24a0e9c ("broadcom/compiler: use nir_lower_undef_to_zero")
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41256>
This commit is contained in:
Jose Maria Casanova Crespo 2026-04-15 01:07:54 +02:00
parent b4591f4b30
commit 2cd51a6efc

View file

@ -2261,7 +2261,6 @@ v3d_optimize_nir(struct v3d_compile *c, struct nir_shader *s)
}
NIR_PASS(progress, s, nir_opt_undef);
NIR_PASS(progress, s, nir_lower_undef_to_zero);
if (c && !c->disable_loop_unrolling &&
s->options->max_unroll_iterations > 0) {
@ -2272,6 +2271,8 @@ v3d_optimize_nir(struct v3d_compile *c, struct nir_shader *s)
}
} while (progress);
NIR_PASS(progress, s, nir_lower_undef_to_zero);
/* needs to be outside of optimization loop, otherwise it fights with
* opt_algebraic optimizing the conversion lowering
*/