Mesa (main): nir/lower_subgroups: Rename lower_shuffle to lower_relative_shuffle
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Feb 1 17:01:27 UTC 2022
Module: Mesa
Branch: main
Commit: 913bec10c42d5d394a2115691c1ebdf55b8fb7c7
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=913bec10c42d5d394a2115691c1ebdf55b8fb7c7
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Tue Jan 4 14:31:29 2022 +0100
nir/lower_subgroups: Rename lower_shuffle to lower_relative_shuffle
This option only applies to relative shuffles (up/down/xor), and in a
moment we're going to add an option to lower normal shuffles, so rename
it.
While we're here, rename lower_shuffle() to lower_to_shuffle() for
similar reasons.
Reviewed-by: Danylo Piliaiev <dpiliaiev at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14412>
---
src/amd/vulkan/radv_shader.c | 2 +-
src/compiler/nir/nir.h | 2 +-
src/compiler/nir/nir_lower_subgroups.c | 12 +++++++-----
src/intel/compiler/brw_nir.c | 2 +-
4 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index 3af59f675cd..8514c4702af 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -730,7 +730,7 @@ radv_shader_compile_to_nir(struct radv_device *device, struct vk_shader_module *
.ballot_components = 1,
.lower_to_scalar = 1,
.lower_subgroup_masks = 1,
- .lower_shuffle = 1,
+ .lower_relative_shuffle = 1,
.lower_shuffle_to_32bit = 1,
.lower_vote_eq = 1,
.lower_quad_broadcast_dynamic = 1,
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 868d4915311..7c60d29c103 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -4679,7 +4679,7 @@ typedef struct nir_lower_subgroups_options {
bool lower_vote_trivial:1;
bool lower_vote_eq:1;
bool lower_subgroup_masks:1;
- bool lower_shuffle:1;
+ bool lower_relative_shuffle:1;
bool lower_shuffle_to_32bit:1;
bool lower_shuffle_to_swizzle_amd:1;
bool lower_quad:1;
diff --git a/src/compiler/nir/nir_lower_subgroups.c b/src/compiler/nir/nir_lower_subgroups.c
index 6f8f34fb8ca..ed38056f8d1 100644
--- a/src/compiler/nir/nir_lower_subgroups.c
+++ b/src/compiler/nir/nir_lower_subgroups.c
@@ -225,9 +225,11 @@ lower_shuffle_to_swizzle(nir_builder *b, nir_intrinsic_instr *intrin,
}
}
+/* Lowers "specialized" shuffles to a generic nir_intrinsic_shuffle. */
+
static nir_ssa_def *
-lower_shuffle(nir_builder *b, nir_intrinsic_instr *intrin,
- const nir_lower_subgroups_options *options)
+lower_to_shuffle(nir_builder *b, nir_intrinsic_instr *intrin,
+ const nir_lower_subgroups_options *options)
{
if (intrin->intrinsic == nir_intrinsic_shuffle_xor &&
options->lower_shuffle_to_swizzle_amd &&
@@ -479,7 +481,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);
+ return lower_to_shuffle(b, intrin, options);
nir_ssa_def *dst = NULL;
@@ -708,8 +710,8 @@ lower_subgroups_instr(nir_builder *b, nir_instr *instr, void *_options)
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);
+ if (options->lower_relative_shuffle)
+ return lower_to_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)
diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c
index 0bb82a3e629..080cc09bf11 100644
--- a/src/intel/compiler/brw_nir.c
+++ b/src/intel/compiler/brw_nir.c
@@ -861,7 +861,7 @@ brw_preprocess_nir(const struct brw_compiler *compiler, nir_shader *nir,
.ballot_components = 1,
.lower_to_scalar = true,
.lower_vote_trivial = !is_scalar,
- .lower_shuffle = true,
+ .lower_relative_shuffle = true,
.lower_quad_broadcast_dynamic = true,
.lower_elect = true,
};
More information about the mesa-commit
mailing list