[Mlir-commits] [mlir] [mlir][linalg] Pack matmul pass (PR #89782)

Andrzej WarzyƄski llvmlistbot at llvm.org
Wed Apr 24 02:51:58 PDT 2024


================

----------------
banach-space wrote:

Given that there's no other documentation attached to this PR, I'm using these tests to infer the high level logic. That's a bit tricky ATM - it could be simplified with more meaningful var names (MLIR and LIT) ;-) 

For example:

```mlir
func.func @block_matmul(%lhs: tensor<128x128xf32>, %rhs: tensor<128x128xf32>, %out: tensor<128x128xf32>) -> tensor<128x128xf32> {
  %0 = linalg.matmul  ins(%lhs, %rhs : tensor<128x128xf32>, tensor<128x128xf32>)
                      outs(%our : tensor<128x128xf32>) -> tensor<128x128xf32>
  return %0 : tensor<128x128xf32>
}
```
or
```
func.func @block_matmul(%A: tensor<128x128xf32>, %B: tensor<128x128xf32>, %C: tensor<128x128xf32>) -> tensor<128x128xf32> {
  %0 = linalg.matmul  ins(%A, %B : tensor<128x128xf32>, tensor<128x128xf32>)
                      outs(%C : tensor<128x128xf32>) -> tensor<128x128xf32>
  return %0 : tensor<128x128xf32>
}
```

And then in LIT:
```mlir
// CHECK: %[[LHS_PACKED:.+]] = tensor.pack %[[LHS]]
```

Or something similar. I don't really mind what the actual names are, as long as they help to map to the high level semantics of Matmul. Updated names will really help to review this, thanks!

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


More information about the Mlir-commits mailing list