[Mlir-commits] [mlir] [mlir][tosa] Make tosa.reverse an elementwise unary op (PR #193961)

Hocky Yudhiono llvmlistbot at llvm.org
Tue Apr 28 19:48:36 PDT 2026


hockyy wrote:

```
hocky at hocky:~/llvm/llvm-project/build_clion$ mlir-opt tosa_reverse_reduce_transposes_regression.mlir 
module {
  func.func @reverse_axis_must_not_be_preserved_when_hoisted(%arg0: tensor<2x3xi32>) -> tensor<2x3xi32> {
    %0 = tosa.transpose %arg0 {perms = array<i32: 1, 0>} : (tensor<2x3xi32>) -> tensor<3x2xi32>
    %1 = tosa.reverse %0 {axis = 0 : i32} : (tensor<3x2xi32>) -> tensor<3x2xi32>
    %2 = tosa.transpose %1 {perms = array<i32: 1, 0>} : (tensor<3x2xi32>) -> tensor<2x3xi32>
    return %2 : tensor<2x3xi32>
  }
}

hocky at hocky:~/llvm/llvm-project/build_clion$ mlir-opt tosa_reverse_reduce_transposes_regression.mlir --tosa-reduce-transposes 
module {
  func.func @reverse_axis_must_not_be_preserved_when_hoisted(%arg0: tensor<2x3xi32>) -> tensor<2x3xi32> {
    %0 = tosa.reverse %arg0 {axis = 0 : i32} : (tensor<2x3xi32>) -> tensor<2x3xi32>
    return %0 : tensor<2x3xi32>
  }
}
```


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


More information about the Mlir-commits mailing list