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>
(cherry picked from commit 2cd51a6efc)
This commit is contained in:
Jose Maria Casanova Crespo 2026-04-15 01:07:54 +02:00 committed by Eric Engestrom
parent ab529590f8
commit 13564e57b7
2 changed files with 3 additions and 2 deletions

View file

@ -2754,7 +2754,7 @@
"description": "broadcom/compiler: move nir_lower_undef_to_zero out of optimization loop",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "cbe24a0e9c57a1e65243a9dce1c122597b08d50f",
"notes": null

View file

@ -2243,7 +2243,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) {
@ -2254,6 +2253,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
*/