[Mlir-commits] [mlir] [mlir][tensor] Apply `InsertSliceOfTransferWriteOpFolder` only when `transfer_write` overwrites all elements of `insert_slice` (PR #108803)

Rajveer Singh Bharadwaj llvmlistbot at llvm.org
Mon Sep 30 04:07:21 PDT 2024


================
@@ -84,6 +88,15 @@ static LogicalResult preconditionsFoldExtractOrInsertWithTransferOp(
                 "strides, this may result in needing to insert "
                 "vector.insert_strided_slice/extract_strided_slice ops");
   }
+  if constexpr (std::is_same_v<XferOp, vector::TransferWriteOp>) {
+    if constexpr (std::is_same_v<ExtractOrInsertOp, tensor::InsertSliceOp>) {
+      if (!InsertSliceOfTransferWriteOpFolder::
+              doesTransferWriteCoverInsertSlice(xferOp))
+        return rewriter.notifyMatchFailure(
+            xferOp, "transfer_write does not cover insert_slice");
+    }
+  }
----------------
Rajveer100 wrote:

https://github.com/llvm/llvm-project/pull/108803#discussion_r1779271758

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


More information about the Mlir-commits mailing list