[Mlir-commits] [mlir] [mlir][vector] Use inferRankReducedResultType for subview type inference. (PR #84395)

Han-Chung Wang llvmlistbot at llvm.org
Tue Mar 12 09:30:05 PDT 2024


================
@@ -1337,8 +1301,10 @@ class DropInnerMostUnitDimsTransferRead
                                       rewriter.getIndexAttr(0));
     SmallVector<OpFoldResult> strides(srcType.getRank(),
                                       rewriter.getIndexAttr(1));
-    MemRefType resultMemrefType =
-        getMemRefTypeWithDroppingInnerDims(rewriter, srcType, dimsToDrop);
+    auto resultMemrefType =
+        cast<MemRefType>(memref::SubViewOp::inferRankReducedResultType(
+            srcType.getShape().drop_back(dimsToDrop), srcType, offsets, sizes,
----------------
hanhanW wrote:

I think it is not feasible because we want to create a rank reduced subview. If the result type is not passed, it inferred the result shape with given offsets, sizes, and strides; they need to match the source rank. IMO, it is intended because users could need both, and non-rank-reduced is the default.

https://github.com/llvm/llvm-project/blob/fa1d13590cfd0be77c452cca929bc32efb456627/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp#L2579-L2583

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


More information about the Mlir-commits mailing list