[flang-commits] [clang] [flang] [llvm] [mlir] [OpenMP] Add no-loop SPMD kernel emission to Clang (PR #205325)

Nicole Aschenbrenner via flang-commits flang-commits at lists.llvm.org
Mon Aug 31 06:09:55 PDT 2026


================
@@ -66,6 +66,15 @@ static bool canEmitGPUFusedDistSchedule(const CodeGenModule &CGM,
          !S.getSingleClause<OMPOrderedClause>();
 }
 
+static bool canEmitGPUNoLoopKernel(CodeGenModule &CGM,
+                                   const OMPLoopDirective &S) {
+  const auto *D = dyn_cast<OMPTargetTeamsDistributeParallelForDirective>(&S);
+  return CGM.getLangOpts().OpenMPIRBuilder && S.getLoopsNumber() == 1 &&
----------------
nicebert wrote:

They're allowed to differ, that's deliberate. One says the kernel can be launched with a no-loop sized grid, the other says we can actually drop the loop. Dropping it currently goes through the same path as flang, so it needs the IRBuilder, while the grid sizing doesn't.

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


More information about the flang-commits mailing list