[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:

nit: I think it would be easier to parse if you make a new variable for the constant and then do the multiplication.

https://github.com/llvm/llvm-project/pull/74350


More information about the Mlir-commits mailing list