brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 74706c4 Raw
31 lines · plain
1// RUN: mlir-opt %s --split-input-file --tosa-to-linalg-pipeline -verify-diagnostics2 3 4// -----5 6// check that -tosa-validate level checking kick in7func.func @tensor_with_unknown_rank(%arg0: tensor<*xi32>) -> tensor<*xi32> {8  // expected-error@+1 {{'tosa.abs' op failed level check: unranked tensor}}9  %0 = "tosa.abs"(%arg0) : (tensor<*xi32>) -> tensor<*xi32>10  return %0 : tensor<*xi32>11}12 13// -----14 15// check that tosa verify kick in16func.func @test_avg_pool2d_zero_dim_input(%arg0: tensor<1x0x?x9xf32>, %arg1: tensor<1xf32>, %arg2: tensor<1xf32>) -> tensor<1x7x7x9xf32> {17  // expected-error@+1 {{'tosa.avg_pool2d' op operand #0 must be 4-d tosa-conformant tensor, but got 'tensor<1x0x?x9xf32>'}}18    %0 = "tosa.avg_pool2d"(%arg0, %arg1, %arg2) {acc_type = f32, kernel = array<i64: 2, 2>, pad = array<i64: 0, 1, 0, 1>, stride = array<i64: 1, 1>}19      : (tensor<1x0x?x9xf32>, tensor<1xf32>, tensor<1xf32>) -> tensor<1x7x7x9xf32>20    return %0 : tensor<1x7x7x9xf32>21}22 23// -----24 25// check that --tosa-to-linalg kick in26func.func @avg_pool2d_with_unsupported_quant_type(%arg0: tensor<1x7x7x9x!quant.uniform<i8:f32, 0.01>>, %arg1: tensor<1xi8>, %arg2: tensor<1xi8>) -> tensor<1x7x7x9x!quant.uniform<i8:f32, 0.01>> {27  // expected-error@+1 {{failed to legalize operation 'tosa.avg_pool2d'}}28  %0 = "tosa.avg_pool2d"(%arg0, %arg1, %arg2) {acc_type = i32, kernel = array<i64: 2, 2>, pad = array<i64: 0, 1, 0, 1>, stride = array<i64: 1, 1>} : (tensor<1x7x7x9x!quant.uniform<i8:f32, 0.01>>, tensor<1xi8>, tensor<1xi8>) -> tensor<1x7x7x9x!quant.uniform<i8:f32, 0.01>>29  return %0 : tensor<1x7x7x9x!quant.uniform<i8:f32, 0.01>>30}31