From d5d0628728c66e743771d076f7a28a2d29afe2fb Mon Sep 17 00:00:00 2001 From: Job Noorman Date: Fri, 29 Nov 2024 17:09:16 +0100 Subject: [PATCH] nir/lower_subgroups: add option to only lower clustered rotates On ir3, we have native support for full rotates but not for clustered ones. Signed-off-by: Job Noorman Reviewed-by: Connor Abbott Part-of: --- src/compiler/nir/nir.h | 1 + src/compiler/nir/nir_lower_subgroups.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index c238de29945..78e6cf77167 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -6176,6 +6176,7 @@ typedef struct nir_lower_subgroups_options { bool lower_elect : 1; bool lower_read_invocation_to_cond : 1; bool lower_rotate_to_shuffle : 1; + bool lower_rotate_clustered_to_shuffle : 1; bool lower_ballot_bit_count_to_mbcnt_amd : 1; bool lower_inverse_ballot : 1; bool lower_reduce : 1; diff --git a/src/compiler/nir/nir_lower_subgroups.c b/src/compiler/nir/nir_lower_subgroups.c index ce55427af45..b24b264fdae 100644 --- a/src/compiler/nir/nir_lower_subgroups.c +++ b/src/compiler/nir/nir_lower_subgroups.c @@ -1323,6 +1323,10 @@ lower_subgroups_instr(nir_builder *b, nir_instr *instr, void *_options) if (options->lower_rotate_to_shuffle && (!options->lower_boolean_shuffle || intrin->src[0].ssa->bit_size != 1)) return lower_to_shuffle(b, intrin, options); + else if (options->lower_rotate_clustered_to_shuffle && + nir_intrinsic_cluster_size(intrin) > 0 && + (!options->lower_boolean_shuffle || intrin->src[0].ssa->bit_size != 1)) + 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); else if (options->lower_boolean_shuffle && intrin->src[0].ssa->bit_size == 1)