nir/subgroups: Replace lower_vote_eq_to_ballot with lower_vote_eq

Lower it to a vote instead of a ballot. This was only used for AMD, and
in that case they're pretty much the same. However Qualcomm has a vote
builtin, which we want to use instead of ballots.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6752>
This commit is contained in:
Connor Abbott 2020-09-11 13:07:48 +02:00 committed by Marge Bot
parent 4fcb7e96b8
commit 90819b9b0e
4 changed files with 7 additions and 9 deletions

View file

@ -642,7 +642,7 @@ radv_shader_compile_to_nir(struct radv_device *device, struct vk_shader_module *
.lower_subgroup_masks = 1,
.lower_shuffle = 1,
.lower_shuffle_to_32bit = 1,
.lower_vote_eq_to_ballot = 1,
.lower_vote_eq = 1,
.lower_quad_broadcast_dynamic = 1,
.lower_quad_broadcast_dynamic_to_const = gfx7minus,
.lower_shuffle_to_swizzle_amd = 1,

View file

@ -4728,7 +4728,7 @@ typedef struct nir_lower_subgroups_options {
uint8_t ballot_bit_size;
bool lower_to_scalar:1;
bool lower_vote_trivial:1;
bool lower_vote_eq_to_ballot:1;
bool lower_vote_eq:1;
bool lower_subgroup_masks:1;
bool lower_shuffle:1;
bool lower_shuffle_to_32bit:1;

View file

@ -178,8 +178,7 @@ lower_vote_eq_to_scalar(nir_builder *b, nir_intrinsic_instr *intrin)
}
static nir_ssa_def *
lower_vote_eq_to_ballot(nir_builder *b, nir_intrinsic_instr *intrin,
const nir_lower_subgroups_options *options)
lower_vote_eq(nir_builder *b, nir_intrinsic_instr *intrin)
{
assert(intrin->src[0].is_ssa);
nir_ssa_def *value = intrin->src[0].ssa;
@ -203,8 +202,7 @@ lower_vote_eq_to_ballot(nir_builder *b, nir_intrinsic_instr *intrin,
}
}
nir_ssa_def *ballot = nir_ballot(b, 1, options->ballot_bit_size, nir_inot(b, all_eq));
return nir_ieq(b, ballot, nir_imm_intN_t(b, 0, options->ballot_bit_size));
return nir_vote_all(b, 1, all_eq);
}
static nir_ssa_def *
@ -386,8 +384,8 @@ lower_subgroups_instr(nir_builder *b, nir_instr *instr, void *_options)
if (options->lower_vote_trivial)
return nir_imm_true(b);
if (options->lower_vote_eq_to_ballot)
return lower_vote_eq_to_ballot(b, intrin, options);
if (options->lower_vote_eq)
return lower_vote_eq(b, intrin);
if (options->lower_to_scalar && intrin->num_components > 1)
return lower_vote_eq_to_scalar(b, intrin);

View file

@ -824,7 +824,7 @@ static void si_lower_nir(struct si_screen *sscreen, struct nir_shader *nir)
.lower_to_scalar = true,
.lower_subgroup_masks = true,
.lower_vote_trivial = false,
.lower_vote_eq_to_ballot = true,
.lower_vote_eq = true,
.lower_elect = true,
};
NIR_PASS_V(nir, nir_lower_subgroups, &subgroups_options);