================
@@ -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>() &&
+         !D.hasClausesOfKind<OMPReductionClause>();
----------------
ro-i wrote:

if we later thread the no-loop flag to codegen, we could also affect reduction 
cases, I think.
I guess you just ported the flang equivalent?

https://github.com/llvm/llvm-project/blob/650a05947d5bd0393914b8dfe15a5c50b193dfc9/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp#L2761-L2784

https://github.com/llvm/llvm-project/pull/205325
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to