nir: make ballot_bitfield_extract 1bit only

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37178>
This commit is contained in:
Georg Lehmann 2025-09-03 13:56:29 +02:00 committed by Marge Bot
parent 83326af899
commit b8db8f877d
3 changed files with 3 additions and 3 deletions

View file

@ -566,7 +566,7 @@ intrinsic("vote_ieq", src_comp=[0], dest_comp=1, flags=SUBGROUP_FLAGS)
# These operations work like their ALU counterparts except that the operate
# on a uvec4 which is treated as a 128bit integer. Also, they are, in
# general, free to ignore any bits which are above the subgroup size.
intrinsic("ballot_bitfield_extract", src_comp=[4, 1], dest_comp=1, flags=[CAN_REORDER, CAN_ELIMINATE])
intrinsic("ballot_bitfield_extract", src_comp=[4, 1], dest_comp=1, bit_sizes=[1], flags=[CAN_REORDER, CAN_ELIMINATE])
intrinsic("ballot_bit_count_reduce", src_comp=[4], dest_comp=1, flags=[CAN_REORDER, CAN_ELIMINATE])
intrinsic("ballot_bit_count_inclusive", src_comp=[4], dest_comp=1, flags=[CAN_REORDER, CAN_ELIMINATE])
intrinsic("ballot_bit_count_exclusive", src_comp=[4], dest_comp=1, flags=[CAN_REORDER, CAN_ELIMINATE])

View file

@ -1134,7 +1134,7 @@ lower_subgroups_instr(nir_builder *b, nir_instr *instr, void *_options)
case nir_intrinsic_inverse_ballot:
if (options->lower_inverse_ballot) {
return nir_ballot_bitfield_extract(b, 1, intrin->src[0].ssa,
return nir_ballot_bitfield_extract(b, intrin->src[0].ssa,
nir_load_subgroup_invocation(b));
} else if (intrin->src[0].ssa->num_components != options->ballot_components ||
intrin->src[0].ssa->bit_size != options->ballot_bit_size) {

View file

@ -2207,7 +2207,7 @@ lower_subgroup_scan(nir_builder *b, nir_intrinsic_instr *intr, void *data)
nir_def *thread_in_range = intr->intrinsic == nir_intrinsic_inclusive_scan ?
nir_ige(b, subgroup_id, loop_counter) :
nir_ilt(b, loop_counter, subgroup_id);
nir_def *thread_active = nir_ballot_bitfield_extract(b, 1, active_threads, loop_counter);
nir_def *thread_active = nir_ballot_bitfield_extract(b, active_threads, loop_counter);
nir_if *if_active_thread = nir_push_if(b, nir_iand(b, thread_in_range, thread_active));
nir_def *result = nir_build_alu2(b, op, nir_load_var(b, result_var), other_thread_val);