[Mlir-commits] [mlir] [mlir][tosa] Use traits to check output type aligns with input type (PR #193961)
Luke Hutton
llvmlistbot at llvm.org
Wed Apr 29 02:01:27 PDT 2026
================
@@ -2349,8 +2349,12 @@ def Tosa_ReshapeBlockScaledOp
// Operator: reverse
//===----------------------------------------------------------------------===//
def Tosa_ReverseOp: Tosa_Op<"reverse", [
- DeclareOpInterfaceMethods<InferShapedTypeOpInterface,
- ["inferReturnTypeComponents"]>, Pure]> {
+ DeclareOpInterfaceMethods<InferShapedTypeOpInterface,
+ ["inferReturnTypeComponents"]>,
+ SameOperandsAndResultRank,
----------------
lhutton1 wrote:
Unfortunately, this would prevent constructs such as:
```
func.func @test_reverse(%arg0: tensor<2x3xi32>) -> tensor<2x?xi32> {
%0 = tosa.reverse %arg0 {axis = 1 : i32} : (tensor<2x3xi32>) -> tensor<2x?xi32>
return %0 : tensor<2x?xi32>
}
```
which are required for shape inference.
https://github.com/llvm/llvm-project/pull/193961
More information about the Mlir-commits
mailing list