[Mlir-commits] [mlir] [MLIR][Vector] Implement transferXXPermutationLowering as MaskableOpRewritePattern (PR #91987)

Andrzej Warzyński llvmlistbot at llvm.org
Fri May 17 09:30:47 PDT 2024


================
@@ -285,10 +303,14 @@ struct TransferWriteNonPermutationLowering
       newInBoundsValues.push_back(op.isDimInBounds(i));
     }
     ArrayAttr newInBoundsAttr = rewriter.getBoolArrayAttr(newInBoundsValues);
-    rewriter.replaceOpWithNewOp<vector::TransferWriteOp>(
-        op, newVec, op.getSource(), op.getIndices(), AffineMapAttr::get(newMap),
-        newMask, newInBoundsAttr);
-    return success();
+    auto newWrite = rewriter.create<vector::TransferWriteOp>(
+        op.getLoc(), newVec, op.getSource(), op.getIndices(),
+        AffineMapAttr::get(newMap), newMask, newInBoundsAttr);
+    if (newWrite.hasPureTensorSemantics())
+      return newWrite.getResult();
+    // In memref case, MaskableOpRewritePattern cannot replaceOp with result.
----------------
banach-space wrote:

Argh, sorry, I see where I got confused 🤦🏻 

> Implemented in : https://github.com/llvm/llvm-project/pull/92526

It's tricky to test that alone, so I'd keep the changes in this file. I will make a couple more small suggestions in this PR. To prevent my future-self from getting confused 😅 

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


More information about the Mlir-commits mailing list