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 <aitor@lunarg.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41186>
This commit is contained in:
squidbus 2026-04-26 13:06:08 -07:00 committed by Marge Bot
parent 8bd7f1d44b
commit 5b34d1ff34

View file

@ -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)