Lukas Sommer 5623d1f4e6
[mlir][Linalg] Allow more control in drop unit dims (#171796)
Extend the `ControlDropUnitDims` struct to allow users of the
`linalg::dropUnitDims` function more control over the behavior of the
function.

The extended struct allows users to specify functions to control how the
operands are collapsed and how the result is expanded to the original
shape.

One example (and the motivation for this change) where this additional
control is useful is to allow collapsing of tensors with an encoding, as
demonstrated by the new test.

This is a breaking change. The new default behavior changes to abort the
transformation if one of the operands cannot be collapsed or if the
result cannot be expanded. This is the case for `memref` with
non-identity layout and `tensor`s with an encoding.

---------

Signed-off-by: Lukas Sommer <lukas.sommer@amd.com>
2025-12-18 07:15:30 +01:00
..