[Mlir-commits] [mlir] [MLIR][Tensor] Remove FoldDimOf[Expand|Collapse]Shape Pattern (PR #134219)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Apr 3 10:03:55 PDT 2025
MaheshRavishankar wrote:
Dropping these canonicalizations is the right thing. These patterns are redundant w.r.t https://github.com/llvm/llvm-project/blob/a54736afd5b8f8ed25550a9f456afd36e49c04e0/mlir/lib/Dialect/Tensor/IR/TensorInferTypeOpInterfaceImpl.cpp#L129 which is the current way of resolving `tensor.dim` of results w.r.t dimensions of its operands. There are two reasons why this canonicalization is bad
1. In general all `tensor.dim` operation resolutions have been moved to use the `ReifyRankedShapedTypeOpInterface` and that is wrapped in https://github.com/llvm/llvm-project/blob/a54736afd5b8f8ed25550a9f456afd36e49c04e0/mlir/include/mlir/Dialect/MemRef/Transforms/Transforms.h#L52 . These two patterns are outliers and redundant.
2. None of the other tensor.dim resolution patterns are run during canonicalizations. They have non-local effects that might be too hard a hammer for canonicalizations, and was removed from canonicalizations a really long time ago.
https://github.com/llvm/llvm-project/pull/134219
More information about the Mlir-commits
mailing list