aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorRhys Perry <[email protected]>2020-07-06 17:59:08 +0100
committerMarge Bot <[email protected]>2020-07-13 14:11:50 +0000
commit9c317cb2787db09be103dde5eee86b4709ebe6ba (patch)
tree02851a2a248c56f9e01b32dddc3c4aad365c93c5 /src/compiler
parenta6a731bea5e835a49c0ff12b7d729ba761d3296f (diff)
nir/lower_subgroups: pass options struct to lower_shuffle
Signed-off-by: Rhys Perry <[email protected]> Reviewed-by: Daniel Schürmann <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5695>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/nir/nir_lower_subgroups.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/compiler/nir/nir_lower_subgroups.c b/src/compiler/nir/nir_lower_subgroups.c
index 2a7361b7472..5244d916fd9 100644
--- a/src/compiler/nir/nir_lower_subgroups.c
+++ b/src/compiler/nir/nir_lower_subgroups.c
@@ -224,21 +224,25 @@ lower_vote_eq_to_ballot(nir_builder *b, nir_intrinsic_instr *intrin,
static nir_ssa_def *
lower_shuffle(nir_builder *b, nir_intrinsic_instr *intrin,
- bool lower_to_scalar, bool lower_to_32bit)
+ const nir_lower_subgroups_options *options)
{
nir_ssa_def *index = nir_load_subgroup_invocation(b);
+ bool is_shuffle = false;
switch (intrin->intrinsic) {
case nir_intrinsic_shuffle_xor:
assert(intrin->src[1].is_ssa);
index = nir_ixor(b, index, intrin->src[1].ssa);
+ is_shuffle = true;
break;
case nir_intrinsic_shuffle_up:
assert(intrin->src[1].is_ssa);
index = nir_isub(b, index, intrin->src[1].ssa);
+ is_shuffle = true;
break;
case nir_intrinsic_shuffle_down:
assert(intrin->src[1].is_ssa);
index = nir_iadd(b, index, intrin->src[1].ssa);
+ is_shuffle = true;
break;
case nir_intrinsic_quad_broadcast:
assert(intrin->src[1].is_ssa);
@@ -276,7 +280,8 @@ lower_shuffle(nir_builder *b, nir_intrinsic_instr *intrin,
intrin->dest.ssa.num_components,
intrin->dest.ssa.bit_size, NULL);
- if (lower_to_scalar && shuffle->num_components > 1) {
+ bool lower_to_32bit = options->lower_shuffle_to_32bit && is_shuffle;
+ if (options->lower_to_scalar && shuffle->num_components > 1) {
return lower_subgroup_op_to_scalar(b, shuffle, lower_to_32bit);
} else if (lower_to_32bit && shuffle->src[0].ssa->bit_size == 64) {
return lower_subgroup_op_to_32bit(b, shuffle);
@@ -306,7 +311,7 @@ lower_dynamic_quad_broadcast(nir_builder *b, nir_intrinsic_instr *intrin,
const nir_lower_subgroups_options *options)
{
if (!options->lower_quad_broadcast_dynamic_to_const)
- return lower_shuffle(b, intrin, options->lower_to_scalar, false);
+ return lower_shuffle(b, intrin, options);
nir_ssa_def *dst = NULL;
@@ -523,12 +528,11 @@ lower_subgroups_instr(nir_builder *b, nir_instr *instr, void *_options)
else if (options->lower_shuffle_to_32bit && intrin->src[0].ssa->bit_size == 64)
return lower_subgroup_op_to_32bit(b, intrin);
break;
-
case nir_intrinsic_shuffle_xor:
case nir_intrinsic_shuffle_up:
case nir_intrinsic_shuffle_down:
if (options->lower_shuffle)
- return lower_shuffle(b, intrin, options->lower_to_scalar, options->lower_shuffle_to_32bit);
+ return lower_shuffle(b, intrin, options);
else if (options->lower_to_scalar && intrin->num_components > 1)
return lower_subgroup_op_to_scalar(b, intrin, options->lower_shuffle_to_32bit);
else if (options->lower_shuffle_to_32bit && intrin->src[0].ssa->bit_size == 64)