[Mlir-commits] [mlir] [MLIR][Linalg] pack, unpack to take memref inputs (PR #129036)

Han-Chung Wang llvmlistbot at llvm.org
Thu Apr 3 11:26:22 PDT 2025


================
@@ -4951,7 +4993,7 @@ LogicalResult PackOp::canonicalize(PackOp packOp, PatternRewriter &rewriter) {
     rewriter.modifyOpInPlace(packOp, [&] {
       packOp.getSourceMutable().assign(source);
       packOp.getDestMutable().assign(dest);
-      packOp.getResult().setType(cast<RankedTensorType>(dest.getType()));
+      packOp.getResult().setType(cast<ShapedType>(dest.getType()));
----------------
hanhanW wrote:

SGTM, please add the tests to https://github.com/llvm/llvm-project/blob/main/mlir/test/Dialect/Linalg/canonicalize.mlir

EDIT: You should have inner_dims_pos in the `fold_pack_unpack_memref` test. (We can have canonicalization patterns to fold them away if the configuration is empty and the types statically match.)

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


More information about the Mlir-commits mailing list