[flang-commits] [flang] [flang][OpenMP] Support `bind` clause code-gen for standalone `loop`s (PR #122674)
Sergio Afonso via flang-commits
flang-commits at lists.llvm.org
Tue Jan 21 06:30:05 PST 2025
================
@@ -117,7 +120,27 @@ class GenericLoopConversionPattern
return result;
}
- /// Rewrites standalone `loop` directives to equivalent `simd` constructs.
+ void rewriteStandaloneLoop(mlir::omp::LoopOp loopOp,
+ mlir::ConversionPatternRewriter &rewriter) const {
+ using namespace mlir::omp;
+ std::optional<ClauseBindKind> bindKind = loopOp.getBindKind();
+
+ if (!bindKind.has_value())
+ return rewriteToSimdLoop(loopOp, rewriter);
+
+ switch (*loopOp.getBindKind()) {
+ case ClauseBindKind::Parallel:
+ return rewriteToWsloop(loopOp, rewriter);
+ case ClauseBindKind::Teams:
+ return rewriteToDistrbute(loopOp, rewriter);
----------------
skatrak wrote:
Hmm, I see... But then, doesn't that also mean that `teams loop` would be equivalent to `teams distribute` rather than `teams distribute parallel do` or is there something else I'm missing? My reasoning is that, in the case of `teams loop`, the binding region is `teams`, just like `loop bind(teams)`.
https://github.com/llvm/llvm-project/pull/122674
More information about the flang-commits
mailing list