Files
clang-p2996/mlir/lib/Dialect/Utils/ReshapeOpsUtils.cpp
Artem Gindinson f82cf74420 [mlir][tensor] Fix getReassociationForCollapse for tensor/scalar re… (#144118)
…shapes

Commit 6e5a142 changed the behavior of the function when computing
reassociations between tensors (consisting of unit/dynamic dimensions)
and scalars/0d vectors. The IR representation for such reshapes actually
expects an empty reassociation, like so:
```
func.func @example(%arg0 : tensor<?x?x?xf32>) -> tensor<f32> {
  %0 = tensor.collapse_shape %arg0 [] : tensor<?x?x?xf32> into tensor<f32>
}
```

Restore the original behavior - the routine should resort to reporting
failures when compile time-known non-unit dimensions are part of the
attempted reassociation.

Signed-off-by: Artem Gindinson <gindinson@roofline.ai>
2025-06-13 20:03:24 +02:00

31 KiB