[clang] [llvm] [mlir] [openmp] [OpenMP][offload] Cross-team reductions with variable number of teams (PR #195102)
Robert Imschweiler via cfe-commits
cfe-commits at lists.llvm.org
Fri May 8 05:34:50 PDT 2026
================
@@ -143,11 +159,16 @@ GenericKernelTy::getKernelLaunchEnvironment(
LocalKLE.DynCGroupMemFb = DynBlockMemConf.Fallback;
LocalKLE.ReductionBuffer = nullptr;
- if (KernelEnvironment.Configuration.ReductionDataSize &&
- KernelEnvironment.Configuration.ReductionBufferLength) {
+ if (NeedsReductionBuffer) {
+ // Size the teams-reduction buffer. ReductionBufferLength is the
+ // statically known upper bound on the number of teams. When it is 0
+ // (i.e. num_teams was not a compile-time constant), we size the buffer
+ // to exactly match the number of teams for this launch (NumBlocks0).
+ uint32_t BufferElements = RedCfg.ReductionBufferLength
+ ? RedCfg.ReductionBufferLength
+ : NumBlocks0;
----------------
ro-i wrote:
good idea, thanks!
https://github.com/llvm/llvm-project/pull/195102
More information about the cfe-commits
mailing list