[clang] [llvm] [OpenMP][Clang] Add no-loop SPMD kernel promotion (PR #205325)

Robert Imschweiler via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 23 09:28:28 PDT 2026


================
@@ -701,6 +701,18 @@ static bool supportsSPMDExecutionMode(ASTContext &Ctx,
       "Unknown programming model for OpenMP directive on NVPTX target.");
 }
 
+/// Check whether a target kernel can be promoted to a "no-loop" SPMD kernel,
+/// mirroring Flang's MLIR promotion path.
+static bool canPromoteToNoLoop(const LangOptions &LangOpts,
+                               const OMPExecutableDirective &D) {
+  OpenMPDirectiveKind DKind = D.getDirectiveKind();
+  return (DKind == OMPD_target_teams_distribute_parallel_for ||
+          DKind == OMPD_target_teams_distribute_parallel_for_simd) &&
+         LangOpts.OpenMPTeamSubscription && LangOpts.OpenMPThreadSubscription &&
+         !D.hasClausesOfKind<OMPNumTeamsClause>() &&
----------------
ro-i wrote:

excluding num_teams but allowing num_threads makes kinda sense because we have much more freedom in choosing the number of teams, but that's not a hard argument. Not sure if it makes sense to change it, tho

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


More information about the cfe-commits mailing list