[Mlir-commits] [clang] [llvm] [mlir] [openmp] [OpenMP][offload] Cross-team reductions with variable number of teams (PR #195102)

Robert Imschweiler llvmlistbot at llvm.org
Fri May 8 05:35:13 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:

fixed since removed (see above)

https://github.com/llvm/llvm-project/pull/195102


More information about the Mlir-commits mailing list