From 1af0897452fb29f0ca3603a02c3be77c49802039 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 7 Aug 2025 14:29:39 -0400 Subject: [PATCH] nir/lower_subgroups: add lower_fp64 option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is needed for doubles lowering to do the right thing. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Marek Olšák Part-of: --- src/compiler/nir/nir.h | 1 + src/compiler/nir/nir_lower_subgroups.c | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 562f1207d24..6c1ff658cd3 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -5460,6 +5460,7 @@ typedef struct nir_lower_subgroups_options { uint8_t ballot_bit_size; uint8_t ballot_components; bool lower_to_scalar : 1; + bool lower_fp64 : 1; bool lower_vote_trivial : 1; bool lower_vote_feq : 1; bool lower_vote_ieq : 1; diff --git a/src/compiler/nir/nir_lower_subgroups.c b/src/compiler/nir/nir_lower_subgroups.c index 944c43a466e..90af472c4d1 100644 --- a/src/compiler/nir/nir_lower_subgroups.c +++ b/src/compiler/nir/nir_lower_subgroups.c @@ -1036,7 +1036,8 @@ lower_subgroups_instr(nir_builder *b, nir_instr *instr, void *_options) return lower_vote_eq(b, intrin); } else { if (intrin->intrinsic == nir_intrinsic_vote_feq && - options->lower_vote_feq) + (options->lower_vote_feq || + (options->lower_fp64 && intrin->src[0].ssa->bit_size == 64))) return lower_vote_eq(b, intrin); if (intrin->intrinsic == nir_intrinsic_vote_ieq && options->lower_vote_ieq) @@ -1295,7 +1296,8 @@ lower_subgroups_instr(nir_builder *b, nir_instr *instr, void *_options) if (intrin->def.bit_size == 1 && options->ballot_components == 1 && (options->lower_boolean_reduce || options->lower_reduce)) return lower_boolean_reduce(b, intrin, options); - if (options->lower_reduce) + if (options->lower_reduce || + (options->lower_fp64 && intrin->def.bit_size == 64)) return lower_scan_reduce(b, intrin, options); return ret; } @@ -1306,7 +1308,8 @@ lower_subgroups_instr(nir_builder *b, nir_instr *instr, void *_options) if (intrin->def.bit_size == 1 && options->ballot_components == 1 && (options->lower_boolean_reduce || options->lower_reduce)) return lower_boolean_reduce(b, intrin, options); - if (options->lower_reduce) + if (options->lower_reduce || + (options->lower_fp64 && intrin->def.bit_size == 64)) return lower_scan_reduce(b, intrin, options); break;