From 28a32fe54be5cde96d5e7bd15e47bf7ceb5accb5 Mon Sep 17 00:00:00 2001 From: Job Noorman Date: Sat, 4 Apr 2026 10:06:18 +0200 Subject: [PATCH] nir/opt_uniform_subgroup: fix ballot_bit_count components ballot_bit_count_reduce expects the ballot to have 4 components causing validation failures on targets where 1 < ballot_components < 4. Fix this by padding the ballot to 4 components. Signed-off-by: Job Noorman Fixes: ae66bd1c007 ("nir/opt_uniform_subgroup: use ballot_bit_count") Reviewed-by: Georg Lehmann (cherry picked from commit cc6eec79c2bbb3cd0508a15baaa0d07655be7b23) Part-of: --- .pick_status.json | 2 +- src/compiler/nir/nir_opt_uniform_subgroup.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 043453a5573..0bfe6a6ad70 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4364,7 +4364,7 @@ "description": "nir/opt_uniform_subgroup: fix ballot_bit_count components", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "ae66bd1c007af48f609147979cef550d04be05ed", "notes": null diff --git a/src/compiler/nir/nir_opt_uniform_subgroup.c b/src/compiler/nir/nir_opt_uniform_subgroup.c index 22a8141eeff..30f2f678b11 100644 --- a/src/compiler/nir/nir_opt_uniform_subgroup.c +++ b/src/compiler/nir/nir_opt_uniform_subgroup.c @@ -107,7 +107,7 @@ ballot_bit_count(nir_builder *b, nir_def *ballot) { return ballot->num_components == 1 ? nir_bit_count(b, ballot) - : nir_ballot_bit_count_reduce(b, ballot); + : nir_ballot_bit_count_reduce(b, nir_pad_vec4(b, ballot)); } static nir_def *