From 5b34d1ff3421802a491da3cdb24a612354a67e37 Mon Sep 17 00:00:00 2001 From: squidbus Date: Sun, 26 Apr 2026 13:06:08 -0700 Subject: [PATCH] nir: Only attempt subgroups lower_boolean_reduce for single component. lower_boolean_reduce only works if the number of components is 1, and even asserts on this in its prologue. Otherwise, given a boolean vector type, it may produce output using ballot/vote with a boolean vector input. Acked-by: Aitor Camacho Part-of: --- src/compiler/nir/nir_lower_subgroups.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/nir/nir_lower_subgroups.c b/src/compiler/nir/nir_lower_subgroups.c index 3d4ac17b4b6..fbbc6f5ca15 100644 --- a/src/compiler/nir/nir_lower_subgroups.c +++ b/src/compiler/nir/nir_lower_subgroups.c @@ -1396,7 +1396,7 @@ lower_subgroups_instr(nir_builder *b, nir_instr *instr, void *_options) return intrin->src[0].ssa; if (options->lower_to_scalar && intrin->num_components > 1) return lower_subgroup_op_to_scalar(b, intrin, is_bitwise(nir_intrinsic_reduction_op(intrin))); - if (intrin->def.bit_size == 1 && options->ballot_components == 1 && + if (intrin->def.bit_size == 1 && intrin->def.num_components == 1 && options->ballot_components == 1 && (options->lower_boolean_reduce || options->lower_reduce)) return lower_boolean_reduce(b, intrin, options); if (options->lower_reduce) @@ -1407,7 +1407,7 @@ lower_subgroups_instr(nir_builder *b, nir_instr *instr, void *_options) case nir_intrinsic_exclusive_scan: if (options->lower_to_scalar && intrin->num_components > 1) return lower_subgroup_op_to_scalar(b, intrin, is_bitwise(nir_intrinsic_reduction_op(intrin))); - if (intrin->def.bit_size == 1 && options->ballot_components == 1 && + if (intrin->def.bit_size == 1 && intrin->def.num_components == 1 && options->ballot_components == 1 && (options->lower_boolean_reduce || options->lower_reduce)) return lower_boolean_reduce(b, intrin, options); if (options->lower_reduce)