From daa2b253f44f792ff6d43eaeab0b95f29174b70e Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Fri, 19 Dec 2025 19:17:01 +0100 Subject: [PATCH] ac/nir/cull: do not reuse variables if subgroup ops are used Subgroup ops make divergence information useless for our purpose, we would need workgroup divergence. The game affected here has control flow dependent on vote_any, so it's possible that a wave only executes the code after culling/reordering invocations. That means we can't reuse the maybe undefined value from before culling. Reviewed-by: Samuel Pitoiset Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14459 Cc: mesa-stable (cherry picked from commit cbedced5e8c10d2becbeb351fe3603b55f8b6571) Part-of: --- .pick_status.json | 2 +- src/amd/common/nir/ac_nir_lower_ngg.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 0da5de9e38e..8c6dea17dd8 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -244,7 +244,7 @@ "description": "ac/nir/cull: do not reuse variables if subgroup ops are used", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/amd/common/nir/ac_nir_lower_ngg.c b/src/amd/common/nir/ac_nir_lower_ngg.c index aa454239307..66f38be1815 100644 --- a/src/amd/common/nir/ac_nir_lower_ngg.c +++ b/src/amd/common/nir/ac_nir_lower_ngg.c @@ -752,6 +752,12 @@ save_reusable_variables(nir_builder *b, lower_ngg_nogs_state *s) ASSERTED int vec_ok = u_vector_init(&s->reusable_nondeferred_variables, 4, sizeof(reusable_nondeferred_variable)); assert(vec_ok); + /* Subgroup ops make divergence information useless for our purpose, + * we would need workgroup divergence. + */ + if (b->shader->info.uses_wide_subgroup_intrinsics) + return; + /* Upper limit on reusable uniforms in order to reduce SGPR spilling. */ unsigned remaining_reusable_uniforms = 48;