[Mlir-commits] [mlir] [MLIR][Tensor] Remove FoldDimOf[Expand|Collapse]Shape Pattern (PR #134219)
Vivek Khandelwal
llvmlistbot at llvm.org
Sun Apr 6 20:26:54 PDT 2025
vivekkhandelwal1 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.
Thanks @MaheshRavishankar for adding the rationale behind these changes.
I request all the existing reviewers to re-review this PR since we have been blocked on the Torch-MLIR for quite some time because of this.
CC: @joker-eph
https://github.com/llvm/llvm-project/pull/134219
More information about the Mlir-commits
mailing list