[Mlir-commits] [mlir] Fold `memref.dim` into `memref.expand_shape` (PR #88423)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Apr 11 12:39:35 PDT 2024
MaheshRavishankar wrote:
Actually I am really surprised that the `memref.expand/collapse_shape` and the `tensor.expand/collapse_shape` ops do not implement the [`ReifyRankedShapedTypeOpInterface`](https://github.com/llvm/llvm-project/blob/5d6d8dcd292e0a107b11d378932eee9c2f9ccfc7/mlir/include/mlir/Interfaces/InferTypeOpInterface.td#L344) . They really should be and dim folding shouldnt be part of the canonicalization. If you make the operation implement the interface you can then just add the [`memref::populateResolveRankedShapedTypeResultDimsPatterns`](https://github.com/llvm/llvm-project/blob/5d6d8dcd292e0a107b11d378932eee9c2f9ccfc7/mlir/lib/Dialect/MemRef/Transforms/ResolveShapedTypeResultDims.cpp#L127) wherever you need to fold the dims away.
If you want a separate pass you can just run `resolve-ranked-shaped-type-result-dims` pass to run the patterns as a separate pass.
https://github.com/llvm/llvm-project/pull/88423
More information about the Mlir-commits
mailing list