diff options
author | Matthias Gehre <matthias.gehre@amd.com> | 2025-01-20 13:42:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-20 13:42:18 +0100 |
commit | 5ce271ef74dd3325993c827f496e460ced41af11 (patch) | |
tree | 31c77f466ec6577bdd67a486f242737be6234003 /llvm/lib/Bitcode/Reader | |
parent | d70f54f248853f4d5f9e71a51dfda53a47f0b7d3 (diff) | |
download | llvm-5ce271ef74dd3325993c827f496e460ced41af11.zip llvm-5ce271ef74dd3325993c827f496e460ced41af11.tar.gz llvm-5ce271ef74dd3325993c827f496e460ced41af11.tar.bz2 |
[MLIR] TosaToLinalgNamed: Lower unsigned tosa.max_pool2d (#123290)
This PR allows to lower **unsigned** `tosa.max_pool2d` to linalg.
```
// CHECK-LABEL: @max_pool_ui8
func.func @max_pool_ui8(%arg0: tensor<1x6x34x62xui8>) -> tensor<1x4x32x62xui8> {
// CHECK: builtin.unrealized_conversion_cast {{.*}} : tensor<1x6x34x62xui8> to tensor<1x6x34x62xi8>
// CHECK: arith.constant 0
// CHECK: linalg.pooling_nhwc_max_unsigned {{.*}} : (tensor<1x4x32x62xi8>) -> tensor<1x4x32x62xi8>
// CHECK: builtin.unrealized_conversion_cast {{.*}} : tensor<1x4x32x62xi8> to tensor<1x4x32x62xui8>
%0 = tosa.max_pool2d %arg0 {pad = array<i64: 0, 0, 0, 0>, kernel = array<i64: 3, 3>, stride = array<i64: 1, 1>} : (tensor<1x6x34x62xui8>) -> tensor<1x4x32x62xui8>
return %0 : tensor<1x4x32x62xui8>
}
```
It does this by
- converting the MaxPool2dConverter from OpRewriterPattern to
OpConversion Pattern
- adjusting the padding value to the the minimum unsigned value when the
max_pool is unsigned
- lowering to `linalg.pooling_nhwc_max_unsigned` (which uses
`arith.maxui`) when the max_pool is unsigned
Diffstat (limited to 'llvm/lib/Bitcode/Reader')
0 files changed, 0 insertions, 0 deletions