[Mlir-commits] [mlir] [MLIR][Tensor] Remove tensor.dim canonicalization patterns registered on tensor.expand_shape/tensor.collapse_shape (PR #134219)

Nicolas Vasilache llvmlistbot at llvm.org
Fri Jun 27 04:37:17 PDT 2025


nicolasvasilache wrote:

> I chatted with @Groverkss and we identified the reason these can't work well as canonicalization. It isn't visible on collapse_shape example because they trigger a multiplication operation, however it becomes very visible on the expand_shape operation which introduces a `floor_div`. The problem is that this is an **information loss** that can't be just recovered easily. The `expand_shape` guarantees an "exact division", which can't be expressed with affine_apply apparently. Losing information is obviously never OK in canonicalization.
>

And I realize this is also what @joker-eph has been writing :)


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


More information about the Mlir-commits mailing list