[Mlir-commits] [mlir] [MLIR][SCF] Add support for pipelining dynamic loops (PR #74350)
Quinn Dawkins
llvmlistbot at llvm.org
Sun Dec 10 10:04:51 PST 2023
================
@@ -326,9 +366,16 @@ scf::ForOp LoopPipelinerInternal::createKernelLoop(
// `numStages - 1` iterations. Then we adjust the upper bound to remove those
// iterations.
Value newUb = forOp.getUpperBound();
- if (peelEpilogue)
- newUb = rewriter.create<arith::ConstantIndexOp>(forOp.getLoc(),
- ub - maxStage * step);
+ if (peelEpilogue) {
+ Type t = ub.getType();
+ Location loc = forOp.getLoc();
+ // newUb = ub - maxStage * step
+ Value maxStageByStep = rewriter.create<arith::MulIOp>(
+ loc, step,
+ rewriter.create<arith::ConstantOp>(
----------------
qedawkins wrote:
Edit: I see this kind of arith op building in a few places, and it does make the code look closer to the comments, so this is probably fine. I'll leave this comment here as optional.
https://github.com/llvm/llvm-project/pull/74350
More information about the Mlir-commits
mailing list