[Mlir-commits] [mlir] Add checks before hoisting out in loop pipelining (PR #90872)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Fri May 17 04:59:43 PDT 2024


================
@@ -227,7 +229,14 @@ loopScheduling(scf::ForOp forOp,
       Operation *def = operand.getDefiningOp();
       if (!def)
         continue;
-      earlyCycle = std::max(earlyCycle, opCycles[def] + getLatency(def));
+      if (ubConstant && lbConstant) {
+        unsigned ubInt = ubConstant.value();
+        unsigned lbInt = lbConstant.value();
+        auto minLatency = std::min(ubInt - lbInt - 1, getLatency(def));
+        earlyCycle = std::max(earlyCycle, opCycles[def] + minLatency);
+      } else {
----------------
ftynse wrote:

How should this work when loop bounds are dynamic? Could we have a test?

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


More information about the Mlir-commits mailing list