[Mlir-commits] [mlir] [MLIR][LLVM] Add Continuous Loop Peeling transform to SCF (PR #71555)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Nov 13 06:20:23 PST 2023
================
@@ -105,6 +106,168 @@ static void specializeForLoopForUnrolling(ForOp op) {
op.erase();
}
+static LogicalResult splitLoopHelper(RewriterBase &b, scf::ForOp &forOp,
----------------
muneebkhan85 wrote:
Yes, the function can be called from peelForLoop. The test mlir/test/Dialect/SCF/for-loop-peeling.mlir passes when spliLoopHelper is called after the new splitBound has been computed as shown here
`static LogicalResult peelForLoop(RewriterBase &b, ForOp forOp,
ForOp &partialIteration, Value &splitBound) {
auto loc = forOp.getLoc();
AffineExpr sym0, sym1, sym2;
bindSymbols(b.getContext(), sym0, sym1, sym2);
// New upper bound: %ub - (%ub - %lb) mod %step
auto modMap = AffineMap::get(0, 3, {sym1 - ((sym1 - sym0) % sym2)});
b.setInsertionPoint(forOp);
splitBound = b.createOrFold<AffineApplyOp>(loc, modMap,
ValueRange{forOp.getLowerBound(),
forOp.getUpperBound(),
forOp.getStep()});
if(failed(splitLoopHelper(b, forOp, partialIteration, splitBound)))
return failure();
return success();
}`
But, should this change be a part of this patch? I think this is a separate change, as the current patch should only target the new addition of Continuous Loop Peeling?
https://github.com/llvm/llvm-project/pull/71555
More information about the Mlir-commits
mailing list