[Mlir-commits] [mlir] [mlir][linalg] fix OuterUnitDims linalg.pack decomposition pattern (PR #141613)

Han-Chung Wang llvmlistbot at llvm.org
Tue May 27 08:00:45 PDT 2025


hanhanW wrote:

> module {
>   func.func @main(%arg0: tensor<1x1x1x4x1xf32>, %arg1: tensor<1x1x4xf32>) -> tensor<1x1x1x4x1xf32> {
>     %pack = linalg.pack %arg1 outer_dims_perm = [1, 2, 0] inner_dims_pos = [2, 0] inner_tiles = [4, 1] into %arg0 : tensor<1x1x4xf32> -> tensor<1x1x1x4x1xf32>
>     return %pack : tensor<1x1x1x4x1xf32>
>   }
> }

E.g., I'd expect the below test case working with your support, if I read your intention correctly.

```mlir
func.func @main(%arg0: tensor<2x1x1x4x1xf32>, %arg1: tensor<1x2x4xf32>) -> tensor<2x1x1x4x1xf32> {
  %pack = linalg.pack %arg1 outer_dims_perm = [1, 2, 0] inner_dims_pos = [2, 0] inner_tiles = [4, 1] into %arg0 : tensor<1x2x4xf32> -> tensor<2x1x1x4x1xf32>
  return %pack : tensor<2x1x1x4x1xf32>
}
```

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


More information about the Mlir-commits mailing list