mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 12:40:09 +01:00
nir: make ballot find_lsb/msb/bit_count 32bit only
The lowering is 32bit only too. Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37178>
This commit is contained in:
parent
276fce4f13
commit
f8633511be
3 changed files with 10 additions and 10 deletions
|
|
@ -567,11 +567,11 @@ intrinsic("vote_ieq", src_comp=[0], dest_comp=1, flags=SUBGROUP_FLAGS)
|
|||
# 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, 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])
|
||||
intrinsic("ballot_find_lsb", src_comp=[4], dest_comp=1, flags=[CAN_REORDER, CAN_ELIMINATE])
|
||||
intrinsic("ballot_find_msb", src_comp=[4], dest_comp=1, flags=[CAN_REORDER, CAN_ELIMINATE])
|
||||
intrinsic("ballot_bit_count_reduce", src_comp=[4], dest_comp=1, bit_sizes=[32], flags=[CAN_REORDER, CAN_ELIMINATE])
|
||||
intrinsic("ballot_bit_count_inclusive", src_comp=[4], dest_comp=1, bit_sizes=[32], flags=[CAN_REORDER, CAN_ELIMINATE])
|
||||
intrinsic("ballot_bit_count_exclusive", src_comp=[4], dest_comp=1, bit_sizes=[32], flags=[CAN_REORDER, CAN_ELIMINATE])
|
||||
intrinsic("ballot_find_lsb", src_comp=[4], dest_comp=1, bit_sizes=[32], flags=[CAN_REORDER, CAN_ELIMINATE])
|
||||
intrinsic("ballot_find_msb", src_comp=[4], dest_comp=1, bit_sizes=[32], flags=[CAN_REORDER, CAN_ELIMINATE])
|
||||
|
||||
# Shuffle operations from SPIR-V.
|
||||
intrinsic("shuffle", src_comp=[0, 1], dest_comp=0, bit_sizes=src0, flags=SUBGROUP_FLAGS)
|
||||
|
|
|
|||
|
|
@ -764,7 +764,7 @@ build_scan_reduce(nir_builder *b, nir_intrinsic_op op, nir_op red_op,
|
|||
* take into account in the accumulator.
|
||||
*/
|
||||
nir_def *has_buddy = nir_bany_inequal(b, remaining, nir_imm_int(b, 0));
|
||||
nir_def *buddy = nir_ballot_find_msb(b, 32, remaining);
|
||||
nir_def *buddy = nir_ballot_find_msb(b, remaining);
|
||||
|
||||
/* Accumulate with our buddy channel, if any */
|
||||
nir_def *buddy_data = nir_shuffle(b, data, buddy);
|
||||
|
|
@ -789,7 +789,7 @@ build_scan_reduce(nir_builder *b, nir_intrinsic_op op, nir_op red_op,
|
|||
*/
|
||||
nir_def *lower = nir_iand(b, mask, lt_mask);
|
||||
nir_def *has_buddy = nir_bany_inequal(b, lower, nir_imm_int(b, 0));
|
||||
nir_def *buddy = nir_ballot_find_msb(b, 32, lower);
|
||||
nir_def *buddy = nir_ballot_find_msb(b, lower);
|
||||
|
||||
nir_def *buddy_data = nir_shuffle(b, data, buddy);
|
||||
nir_def *identity = build_identity(b, data->bit_size, red_op);
|
||||
|
|
@ -801,7 +801,7 @@ build_scan_reduce(nir_builder *b, nir_intrinsic_op op, nir_op red_op,
|
|||
|
||||
case nir_intrinsic_reduce: {
|
||||
/* For reductions, we need to take the top value of the scan */
|
||||
nir_def *idx = nir_ballot_find_msb(b, 32, mask);
|
||||
nir_def *idx = nir_ballot_find_msb(b, mask);
|
||||
return nir_shuffle(b, data, idx);
|
||||
}
|
||||
|
||||
|
|
@ -995,7 +995,7 @@ static nir_def *
|
|||
lower_first_invocation_to_ballot(nir_builder *b, nir_intrinsic_instr *intrin,
|
||||
const nir_lower_subgroups_options *options)
|
||||
{
|
||||
return nir_ballot_find_lsb(b, 32, nir_ballot(b, 4, 32, nir_imm_true(b)));
|
||||
return nir_ballot_find_lsb(b, nir_ballot(b, 4, 32, nir_imm_true(b)));
|
||||
}
|
||||
|
||||
static nir_def *
|
||||
|
|
|
|||
|
|
@ -74,7 +74,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->bit_size, ballot);
|
||||
: nir_ballot_bit_count_reduce(b, ballot);
|
||||
}
|
||||
|
||||
static nir_def *
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue