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

Johannes Doerfert via Openmp-commits openmp-commits at lists.llvm.org
Thu May 7 17:46:52 PDT 2026


================
@@ -788,8 +788,12 @@ void CGOpenMPRuntimeGPU::emitKernelDeinit(CodeGenFunction &CGF,
           ? 0
           : DL.getTypeAllocSize(LLVMReductionsBufferTy).getFixedValue();
   CGBuilderTy &Bld = CGF.Builder;
+  // The teams-reduction buffer is sized at kernel launch by the offload
+  // plugin to match the actual number of teams, so we always pass 0 as the
+  // buffer length (signal for dynamic sizing) regardless of any value
+  // supplied via the deprecated -fopenmp-cuda-teams-reduction-recs-num flag.
   OMPBuilder.createTargetDeinit(Bld, ReductionDataSize,
-                                C.getLangOpts().OpenMPCUDAReductionBufNum);
+                                /*TeamsReductionBufferLength=*/0);
----------------
jdoerfert wrote:

Do we need to pass the value at all? Only reason might be if flang is using a non-zero value, right?

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


More information about the Openmp-commits mailing list