[Mlir-commits] [mlir] [mlir][tensor] Fold producer linalg transpose with consumer tensor pack (PR #75658)

Han-Chung Wang llvmlistbot at llvm.org
Mon Jan 8 15:42:02 PST 2024


https://github.com/hanhanW requested changes to this pull request.

I think there is a bug about tensor.empty op creation. Here is the example:

```mlir
  module {
    func.func @trunc_pack(%arg0: tensor<?x32x128xbf16>) -> tensor<32x?x64x16x2xbf16> {
      %c0 = arith.constant 0 : index
      %cst = arith.constant 0.000000e+00 : bf16
      %dim = tensor.dim %arg0, %c0 : tensor<?x32x128xbf16>
      %0 = tensor.empty(%dim) : tensor<32x128x?xbf16>
      %transposed = linalg.transpose ins(%arg0 : tensor<?x32x128xbf16>) outs(%0 : tensor<32x128x?xbf16>) permutation = [1, 2, 0]
      %1 = affine.apply #map()[%dim]
      %2 = tensor.empty(%1) : tensor<32x?x64x16x2xbf16>
      %pack = tensor.pack %transposed padding_value(%cst : bf16) outer_dims_perm = [0, 2, 1] inner_dims_pos = [2, 1] inner_tiles = [16, 2] into %2 : tensor<32x128x?xbf16> -> tensor<32x?x64x16x2xbf16>
      return %pack : tensor<32x?x64x16x2xbf16>
    }
```

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


More information about the Mlir-commits mailing list