[Mlir-commits] [mlir] [mlir][scf] Considering affine.apply when fusing scf::ParallelOp (PR #80145)

Ivan Butygin llvmlistbot at llvm.org
Wed Jan 31 09:09:53 PST 2024


================
@@ -102,8 +114,25 @@ static bool haveNoReadsAfterWriteExceptSameIndex(
       return WalkResult::interrupt();
     for (int i = 0, e = storeIndices.size(); i < e; ++i) {
       if (firstToSecondPloopIndices.lookupOrDefault(storeIndices[i]) !=
-          loadIndices[i])
-        return WalkResult::interrupt();
+          loadIndices[i]) {
+        auto storeIndexDef = storeIndices[i].getDefiningOp<AffineApplyOp>();
----------------
Hardcode84 wrote:

Can we use `OperationEquivalence::isEquivalentTo` with custom `checkEquivalent` hook for this, to avoid hardcoding `affine.apply` op? Checking equivalence and the op has no side effects should be enough.

There are also more complicated cases, when you have multiple chained apply/arith ops, but we can do them in separate PR.

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


More information about the Mlir-commits mailing list