[Mlir-commits] [mlir] [mlir][tosa] Add min/max_shape ops (PR #175146)
Luke Hutton
llvmlistbot at llvm.org
Fri Jan 9 03:01:58 PST 2026
================
@@ -587,3 +587,22 @@ func.func @test_mul_shape() -> !tosa.shape<4> {
%c = tosa.mul_shape %a, %b : (!tosa.shape<4>, !tosa.shape<4>) -> !tosa.shape<4>
return %c : !tosa.shape<4>
}
+
+// -----
+
+func.func @test_max_shape() -> !tosa.shape<4> {
+ %a = tosa.const_shape {values = dense<[1, 2, 3, 4]> : tensor<4xindex>} : () -> !tosa.shape<4>
+ %b = tosa.const_shape {values = dense<[5, 6, 7, 8]> : tensor<4xindex>} : () -> !tosa.shape<4>
+ // expected-error at +1 {{'tosa.max_shape' op illegal: requires [shape] but not enabled in target}}
+ %c = tosa.max_shape %a, %b : (!tosa.shape<4>, !tosa.shape<4>) -> !tosa.shape<4>
+ return %c : !tosa.shape<4>
+}
+// -----
+
+func.func @test_min_shape() -> !tosa.shape<4> {
+ %a = tosa.const_shape {values = dense<[1, 2, 3, 4]> : tensor<4xindex>} : () -> !tosa.shape<4>
+ %b = tosa.const_shape {values = dense<[5, 6, 7, 8]> : tensor<4xindex>} : () -> !tosa.shape<4>
+ // expected-error at +1 {{'tosa.min_shape' op illegal: requires [shape] but not enabled in target}}
+ %c = tosa.min_shape %a, %b : (!tosa.shape<4>, !tosa.shape<4>) -> !tosa.shape<4>
+ return %c : !tosa.shape<4>
+}
----------------
lhutton1 wrote:
nit: missing new line here
https://github.com/llvm/llvm-project/pull/175146
More information about the Mlir-commits
mailing list