|
2 | 2 | // Enable all supported profiles to focus the verification of expected extension requirement errors. |
3 | 3 | //-------------------------------------------------------------------------------------------------- |
4 | 4 |
|
5 | | -// RUN: mlir-opt %s -split-input-file -verify-diagnostics -tosa-validate="profile=pro_int,pro_fp,mt strict-op-spec-alignment" |
| 5 | +// RUN: mlir-opt %s -split-input-file -verify-diagnostics -tosa-validate="profile=pro_int,pro_fp strict-op-spec-alignment" |
6 | 6 |
|
7 | 7 | // ----- |
8 | 8 | func.func @test_fft2d(%arg0: tensor<1x4x8xf32>, %arg1: tensor<1x4x8xf32>) -> (tensor<1x4x8xf32>, tensor<1x4x8xf32>) { |
@@ -36,3 +36,37 @@ func.func @test_cast_bf16_i32(%arg0: tensor<13x21x3xbf16>) -> tensor<13x21x3xi32 |
36 | 36 | return %0 : tensor<13x21x3xi32> |
37 | 37 | } |
38 | 38 |
|
| 39 | +// ----- |
| 40 | +func.func @test_cond_if(%arg0: tensor<f32>, %arg1: tensor<f32>, %arg2: tensor<i1>) -> tensor<f32> { |
| 41 | + // expected-error@+1 {{'tosa.cond_if' op illegal: requires [controlflow]}} |
| 42 | + %0 = tosa.cond_if %arg2 -> (tensor<f32>) { |
| 43 | + %1 = tosa.add %arg0, %arg1 : (tensor<f32>, tensor<f32>) -> tensor<f32> |
| 44 | + tosa.yield %1 : tensor<f32> |
| 45 | + } else { |
| 46 | + %1 = tosa.sub %arg0, %arg1 : (tensor<f32>, tensor<f32>) -> tensor<f32> |
| 47 | + tosa.yield %1 : tensor<f32> |
| 48 | + } |
| 49 | + return %0 : tensor<f32> |
| 50 | +} |
| 51 | + |
| 52 | +// ----- |
| 53 | +func.func @test_while_loop(%arg0: tensor<10xi32>, %arg1: tensor<i32>) { |
| 54 | + %0 = "tosa.const"() {value = dense<0> : tensor<i32>} : () -> tensor<i32> |
| 55 | + // expected-error@+1 {{'tosa.while_loop' op illegal: requires [controlflow]}} |
| 56 | + %1:3 = tosa.while_loop (%arg2 = %0, %arg3 = %0, %arg4 = %arg0) : (tensor<i32>, tensor<i32>, tensor<10xi32>) -> (tensor<i32>, tensor<i32>, tensor<10xi32>) { |
| 57 | + %2 = tosa.greater_equal %arg3, %arg1 : (tensor<i32>, tensor<i32>) -> tensor<i1> |
| 58 | + %3 = tosa.logical_not %2 : (tensor<i1>) -> tensor<i1> |
| 59 | + tosa.yield %3 : tensor<i1> |
| 60 | + } do { |
| 61 | + ^bb0(%arg2: tensor<i32>, %arg3: tensor<i32>, %arg4: tensor<10xi32>): |
| 62 | + %2 = "tosa.const"() {value = dense<1> : tensor<i32>} : () -> tensor<i32> |
| 63 | + %3 = tosa.add %arg3, %2 : (tensor<i32>, tensor<i32>) -> tensor<i32> |
| 64 | + %7 = tosa.const_shape {value = dense<[1]> : tensor<1xindex>} : () -> !tosa.shape<1> |
| 65 | + %4 = tosa.reshape %2, %7 : (tensor<i32>, !tosa.shape<1>) -> tensor<1xi32> |
| 66 | + %5 = tosa.add %arg4, %4 : (tensor<10xi32>, tensor<1xi32>) -> tensor<10xi32> |
| 67 | + %6 = tosa.add %arg2, %2 : (tensor<i32>, tensor<i32>) -> tensor<i32> |
| 68 | + tosa.yield %6, %3, %5 : tensor<i32>, tensor<i32>, tensor<10xi32> |
| 69 | + } |
| 70 | + return |
| 71 | +} |
| 72 | + |
0 commit comments