[llvm-branch-commits] [mlir] [MLIR][OpenMP] Update omp.wsloop translation to LLVM IR (4/5) (PR #89214)
Sergio Afonso via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Apr 19 05:57:04 PDT 2024
================
@@ -1008,33 +1009,34 @@ convertOmpWsloop(Operation &opInst, llvm::IRBuilderBase &builder,
auto bodyGen = [&](llvm::OpenMPIRBuilder::InsertPointTy ip, llvm::Value *iv) {
// Make sure further conversions know about the induction variable.
moduleTranslation.mapValue(
- loop.getRegion().front().getArgument(loopInfos.size()), iv);
+ loopOp.getRegion().front().getArgument(loopInfos.size()), iv);
// Capture the body insertion point for use in nested loops. BodyIP of the
// CanonicalLoopInfo always points to the beginning of the entry block of
// the body.
bodyInsertPoints.push_back(ip);
- if (loopInfos.size() != loop.getNumLoops() - 1)
+ if (loopInfos.size() != loopOp.getNumLoops() - 1)
return;
// Convert the body of the loop.
builder.restoreIP(ip);
- convertOmpOpRegions(loop.getRegion(), "omp.wsloop.region", builder,
+ convertOmpOpRegions(loopOp.getRegion(), "omp.wsloop.region", builder,
moduleTranslation, bodyGenStatus);
};
// Delegate actual loop construction to the OpenMP IRBuilder.
- // TODO: this currently assumes Wsloop is semantically similar to SCF loop,
- // i.e. it has a positive step, uses signed integer semantics. Reconsider
- // this code when Wsloop clearly supports more cases.
+ // TODO: this currently assumes omp.loop_nest is semantically similar to SCF
+ // loop, i.e. it has a positive step, uses signed integer semantics.
+ // Reconsider this code when the nested loop operation clearly supports more
+ // cases.
----------------
skatrak wrote:
This was a comment that already existed before. The only changes I made to it are to make it refer to the right operation (it mentioned `omp.wsloop`, but the restriction applies to `omp.loop_nest` now). As far as I can understand it, what this comes to say is that regardless of whether the `OpenMPIRBuilder` could represent more cases, the `omp.loop_nest` operation itself is similar to `scf.for`, so some assumptions are made in that regard below. When `omp.loop_nest` is replaced by a full-fledged `omp.canonical_loop` then these assumptions will no longer apply, so that code will have to be revised.
https://github.com/llvm/llvm-project/pull/89214
More information about the llvm-branch-commits
mailing list