================
@@ -152,26 +231,136 @@ class DoConcurrentConversion : public
mlir::OpConversionPattern<fir::DoLoopOp> {
public:
using mlir::OpConversionPattern<fir::DoLoopOp>::OpConversionPattern;
- DoConcurrentConversion(mlir::MLIRContext *context, bool mapToDevice)
- : OpConversionPattern(context), mapToDevice(mapToDevice) {}
+ DoConcurrentConversion(mlir::MLIRContext *context, bool mapToDevice,
+ llvm::DenseSet<fir::DoLoopOp> &concurrentLoopsToSkip)
+ : OpConversionPattern(context), mapToDevice(mapToDevice),
+ concurrentLoopsToSkip(concurrentLoopsToSkip) {}
mlir::LogicalResult
matchAndRewrite(fir::DoLoopOp doLoop, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
- looputils::LoopNest loopNest;
+ looputils::LoopNestToIndVarMap loopNest;
bool hasRemainingNestedLoops =
failed(looputils::collectLoopNest(doLoop, loopNest));
if (hasRemainingNestedLoops)
mlir::emitWarning(doLoop.getLoc(),
"Some `do concurent` loops are not perfectly-nested. "
"These will be serialized.");
- // TODO This will be filled in with the next PRs that upstreams the rest of
- // the ROCm implementaion.
+ mlir::IRMapping mapper;
+ genParallelOp(doLoop.getLoc(), rewriter, loopNest, mapper);
+ mlir::omp::LoopNestOperands loopNestClauseOps;
+ genLoopNestClauseOps(doLoop.getLoc(), rewriter, loopNest, mapper,
+ loopNestClauseOps);
+
+ mlir::omp::LoopNestOp ompLoopNest =
+ genWsLoopOp(rewriter, loopNest.back().first, mapper, loopNestClauseOps,
+ /*isComposite=*/mapToDevice);
----------------
skatrak wrote:
This will at the moment cause invalid MLIR to be produced (composite
`omp.wsloop` with no other loop wrappers). We should probably emit a not yet
implemented error if `mapToDevice=true` at the beginning of the function
instead, unless you intend to merge host and target support at the same time.
https://github.com/llvm/llvm-project/pull/127633
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits