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

Fotis Kounelis llvmlistbot at llvm.org
Mon May 20 05:52:44 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 {
----------------
fotiskoun wrote:

Hi @ftynse thank you for your comment. For dynamic bounds there are checks with if else branch before hoisting out, that is why I didn't include any test. Do you want me to still add a test with dynamic upper bound for example?

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


More information about the Mlir-commits mailing list