1//-------------------------------------------------------------------------------------------------- 2// Enable all supported profiles to focus the verification of expected level errors. 3//-------------------------------------------------------------------------------------------------- 4 5// RUN: mlir-opt %s -split-input-file -verify-diagnostics --tosa-validate="profile=bi,mi,mt" 6 7 8func.func @test_argmax(%arg0: tensor<1x1x1x1x29x29x4xf32>) -> tensor<1x1x1x1x29x4xi32> { 9 // expected-error@+1 {{'tosa.argmax' op failed level check: operand rank(shape) <= MAX_RANK}} 10 %0 = "tosa.argmax"(%arg0) {axis = 4 : i32} : (tensor<1x1x1x1x29x29x4xf32>) -> tensor<1x1x1x1x29x4xi32> 11 return %0 : tensor<1x1x1x1x29x4xi32> 12} 13 14// ----- 15 16func.func @test_reduce_all(%arg0: tensor<1x1x1x1x13x21x3xi1>) -> tensor<1x1x1x1x1x21x3xi1> { 17 // expected-error@+1 {{'tosa.reduce_all' op failed level check: operand rank(shape) <= MAX_RANK}} 18 %0 = "tosa.reduce_all"(%arg0) {axis = 4 : i32} : (tensor<1x1x1x1x13x21x3xi1>) -> tensor<1x1x1x1x1x21x3xi1> 19 return %0 : tensor<1x1x1x1x1x21x3xi1> 20} 21 22// ----- 23 24func.func @test_reduce_any(%arg0: tensor<1x1x1x1x13x21x3xi1>) -> tensor<1x1x1x1x13x21x3xi1> { 25 // expected-error@+1 {{'tosa.reduce_any' op failed level check: operand rank(shape) <= MAX_RANK}} 26 %0 = "tosa.reduce_any"(%arg0) {axis = 0 : i32} : (tensor<1x1x1x1x13x21x3xi1>) -> tensor<1x1x1x1x13x21x3xi1> 27 return %0 : tensor<1x1x1x1x13x21x3xi1> 28} 29 30// ----- 31 32func.func @test_reduce_max(%arg0: tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32> { 33 // expected-error@+1 {{'tosa.reduce_max' op failed level check: operand rank(shape) <= MAX_RANK}} 34 %0 = "tosa.reduce_max"(%arg0) {axis = 0 : i32} : (tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32> 35 return %0 : tensor<1x1x1x1x13x21x3xf32> 36} 37 38// ----- 39 40func.func @test_reduce_min(%arg0: tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32> { 41 // expected-error@+1 {{'tosa.reduce_min' op failed level check: operand rank(shape) <= MAX_RANK}} 42 %0 = "tosa.reduce_min"(%arg0) {axis = 0 : i32} : (tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32> 43 return %0 : tensor<1x1x1x1x13x21x3xf32> 44} 45 46// ----- 47 48func.func @test_reduce_prod(%arg0: tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32> { 49 // expected-error@+1 {{'tosa.reduce_prod' op failed level check: operand rank(shape) <= MAX_RANK}} 50 %0 = "tosa.reduce_prod"(%arg0) {axis = 0 : i32} : (tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32> 51 return %0 : tensor<1x1x1x1x13x21x3xf32> 52} 53 54// ----- 55 56func.func @test_reduce_sum(%arg0: tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32> { 57 // expected-error@+1 {{'tosa.reduce_sum' op failed level check: operand rank(shape) <= MAX_RANK}} 58 %0 = "tosa.reduce_sum"(%arg0) {axis = 0 : i32} : (tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32> 59 return %0 : tensor<1x1x1x1x13x21x3xf32> 60} 61 62// ----- 63 64func.func @test_concat(%arg0: tensor<1x1x1x13x21x3x8xf32>, %arg1: tensor<1x1x1x13x21x3x8xf32>) -> tensor<1x1x1x26x21x3x8xf32> { 65 // expected-error@+1 {{'tosa.concat' op failed level check: operand rank(shape) <= MAX_RANK}} 66 %0 = "tosa.concat"(%arg0, %arg1) {axis = 3 : i32} : (tensor<1x1x1x13x21x3x8xf32>, tensor<1x1x1x13x21x3x8xf32>) -> tensor<1x1x1x26x21x3x8xf32> 67 return %0 : tensor<1x1x1x26x21x3x8xf32> 68} 69 70// ----- 71 72func.func @test_reshape(%arg0: tensor<13x21x3xf32>) -> tensor<1x1x1x1x1x1x819xf32> { 73 // expected-error@+1 {{'tosa.reshape' op failed level check: result rank(shape) <= MAX_RANK}} 74 %0 = "tosa.reshape"(%arg0) {new_shape = array<i64: 1, 1, 1, 1, 1, 1, 819>} : (tensor<13x21x3xf32>) -> tensor<1x1x1x1x1x1x819xf32> 75 return %0 : tensor<1x1x1x1x1x1x819xf32> 76} 77 78// ----- 79 80func.func @test_reverse(%arg0: tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32> { 81 // expected-error@+1 {{'tosa.reverse' op failed level check: operand rank(shape) <= MAX_RANK}} 82 %0 = "tosa.reverse"(%arg0) {axis = 0 : i32} : (tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32> 83 return %0 : tensor<1x1x1x1x13x21x3xf32> 84} 85 86// ----- 87// CHECK-LABEL: slice 88func.func @test_slice(%arg0: tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x4x11x1xf32> { 89 %0 = tosa.const_shape {value = dense<[0, 0, 0, 0, 6, 8, 0]> : tensor<7xindex>} : () -> !tosa.shape<7> 90 %1 = tosa.const_shape {value = dense<[1, 1, 1, 1, 4, 11, 1]> : tensor<7xindex>} : () -> !tosa.shape<7> 91 // expected-error@+1 {{'tosa.slice' op failed level check: operand rank(shape) <= MAX_RANK}} 92 %2= tosa.slice %arg0, %0, %1 : (tensor<1x1x1x1x13x21x3xf32>, !tosa.shape<7>, !tosa.shape<7>) -> tensor<1x1x1x1x4x11x1xf32> 93 return %2 : tensor<1x1x1x1x4x11x1xf32> 94} 95 96// ----- 97// CHECK-LABEL: tile 98func.func @test_tile(%arg0: tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x39x21x6xf32> { 99 %cst = tosa.const_shape { value = dense<[1, 1, 1, 1, 3, 1, 2]> : tensor<7xindex> } : () -> !tosa.shape<7> 100 // expected-error@+1 {{'tosa.tile' op failed level check: operand rank(shape) <= MAX_RANK}} 101 %0 = tosa.tile %arg0, %cst : (tensor<1x1x1x1x13x21x3xf32>, !tosa.shape<7>) -> tensor<1x1x1x1x39x21x6xf32> 102 return %0 : tensor<1x1x1x1x39x21x6xf32> 103} 104 105// ----- 106 107func.func @test_transpose(%arg0: tensor<13x21x3x1x1x1x1xf32>) -> tensor<3x13x21x1x1x1x1xf32> { 108 %0 = "tosa.const"() {value = dense<[2, 0, 1, 3, 4, 5, 6]> : tensor<7xi32>} : () -> tensor<7xi32> 109 // expected-error@+1 {{'tosa.transpose' op failed level check: operand rank(shape) <= MAX_RANK}} 110 %1 = "tosa.transpose"(%arg0, %0) : (tensor<13x21x3x1x1x1x1xf32>, tensor<7xi32>) -> tensor<3x13x21x1x1x1x1xf32> 111 return %1 : tensor<3x13x21x1x1x1x1xf32> 112} 113 114// ----- 115 116func.func @test_const(%arg0 : tensor<1x1xi32>) -> tensor<1x1x1x1x1x1x1xi32> { 117 // expected-error@+1 {{'tosa.const' op failed level check: result rank(shape) <= MAX_RA}} 118 %0 = "tosa.const"() {value = dense<0> : tensor<1x1x1x1x1x1x1xi32>} : () -> tensor<1x1x1x1x1x1x1xi32> 119 return %0: tensor<1x1x1x1x1x1x1xi32> 120} 121 122// ----- 123 124func.func @test_const_i2(%arg0 : tensor<1xi2>) { 125 // expected-error@+1 {{'tosa.const' op is not profile-aligned: element type 'i2' is not legal}} 126 %0 = "tosa.const"() {value = dense<0> : tensor<1xi2>} : () -> tensor<1xi2> 127 return 128} 129 130// ----- 131 132func.func @test_const_ui32(%arg0 : tensor<1xui32>) { 133 // expected-error@+1 {{'tosa.const' op is not profile-aligned: element type 'ui32' is not legal}} 134 %0 = "tosa.const"() {value = dense<0> : tensor<1xui32>} : () -> tensor<1xui32> 135 return 136} 137 138// ----- 139 140func.func @test_const_f64(%arg0 : tensor<1xf64>) { 141 // expected-error@+1 {{'tosa.const' op is not profile-aligned: element type 'f64' is not legal}} 142 %0 = "tosa.const"() {value = dense<0.0> : tensor<1xf64>} : () -> tensor<1xf64> 143 return 144} 145 146// ----- 147 148func.func @test_const_ui8(%arg0 : tensor<1xui8>) { 149 // expected-error@+1 {{'tosa.const' op is not profile-aligned: element type 'ui8' is not legal}} 150 %0 = "tosa.const"() {value = dense<0> : tensor<1xui8>} : () -> tensor<1xui8> 151 return 152} 153 154// ----- 155 156func.func @test_avgpool2d_kernel_y(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> { 157 // expected-error@+1 {{'tosa.avg_pool2d' op failed level check: kernel <= MAX_KERNEL}} 158 %0 = "tosa.avg_pool2d"(%arg0) {kernel = array<i64: 8193, 1>, pad = array<i64: 4, 4, 4, 4>, stride = array<i64: 1, 1>, acc_type = f32} : 159 (tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> 160 return %0 : tensor<1x32x32x8xf32> 161} 162 163// ----- 164 165func.func @test_avgpool2d_kernel_x(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> { 166 // expected-error@+1 {{'tosa.avg_pool2d' op failed level check: kernel <= MAX_KERNEL}} 167 %0 = "tosa.avg_pool2d"(%arg0) {kernel = array<i64: 1, 8193>, pad = array<i64: 4, 4, 4, 4>, stride = array<i64: 1, 1>, acc_type = f32} : 168 (tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> 169 return %0 : tensor<1x32x32x8xf32> 170} 171 172// ----- 173 174func.func @test_avgpool2d_stride_y(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> { 175 // expected-error@+1 {{'tosa.avg_pool2d' op failed level check: stride <= MAX_STRIDE}} 176 %0 = "tosa.avg_pool2d"(%arg0) {kernel = array<i64: 1, 1>, pad = array<i64: 4, 4, 4, 4>, stride = array<i64: 8193, 1>, acc_type = f32} : 177 (tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> 178 return %0 : tensor<1x32x32x8xf32> 179} 180 181// ----- 182 183func.func @test_avgpool2d_stride_x(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> { 184 // expected-error@+1 {{'tosa.avg_pool2d' op failed level check: stride <= MAX_STRIDE}} 185 %0 = "tosa.avg_pool2d"(%arg0) {kernel = array<i64: 1, 1>, pad = array<i64: 4, 4, 4, 4>, stride = array<i64: 1, 8193>, acc_type = f32} : 186 (tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> 187 return %0 : tensor<1x32x32x8xf32> 188} 189 190 191// ----- 192 193func.func @test_avgpool2d_pad_top(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> { 194 // expected-error@+1 {{'tosa.avg_pool2d' op failed level check: pad <= MAX_KERNEL}} 195 %0 = "tosa.avg_pool2d"(%arg0) {kernel = array<i64: 1, 1>, pad = array<i64: 8193, 4, 4, 4>, stride = array<i64: 1, 1>, acc_type = f32} : 196 (tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> 197 return %0 : tensor<1x32x32x8xf32> 198} 199 200// ----- 201 202func.func @test_avgpool2d_pad_bottom(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> { 203 // expected-error@+1 {{'tosa.avg_pool2d' op failed level check: pad <= MAX_KERNEL}} 204 %0 = "tosa.avg_pool2d"(%arg0) {kernel = array<i64: 1, 1>, pad = array<i64: 4, 8193, 4, 4>, stride = array<i64: 1, 1>, acc_type = f32} : 205 (tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> 206 return %0 : tensor<1x32x32x8xf32> 207} 208 209// ----- 210 211func.func @test_avgpool2d_pad_left(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> { 212 // expected-error@+1 {{'tosa.avg_pool2d' op failed level check: pad <= MAX_KERNEL}} 213 %0 = "tosa.avg_pool2d"(%arg0) {kernel = array<i64: 1, 1>, pad = array<i64: 4, 4, 8193, 4>, stride = array<i64: 1, 1>, acc_type = f32} : 214 (tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> 215 return %0 : tensor<1x32x32x8xf32> 216} 217 218// ----- 219 220func.func @test_avgpool2d_pad_right(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> { 221 // expected-error@+1 {{'tosa.avg_pool2d' op failed level check: pad <= MAX_KERNEL}} 222 %0 = "tosa.avg_pool2d"(%arg0) {kernel = array<i64: 1, 1>, pad = array<i64: 4, 4, 4, 8193>, stride = array<i64: 1, 1>, acc_type = f32} : 223 (tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> 224 return %0 : tensor<1x32x32x8xf32> 225} 226 227// ----- 228 229func.func @test_conv2d_dilation_y(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<16x2x2x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x32x32x16xf32> { 230 // expected-error@+1 {{'tosa.conv2d' op failed level check: dilation_y * KH <= MAX_KERNEL}} 231 %0 = "tosa.conv2d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 4097, 1>, pad = array<i64: 0, 1, 0, 1>, stride = array<i64: 1, 1>} : 232 (tensor<1x32x32x8xf32>, tensor<16x2x2x8xf32>, tensor<16xf32>) -> tensor<1x32x32x16xf32> 233 return %0 : tensor<1x32x32x16xf32> 234} 235 236// ----- 237 238func.func @test_conv2d_dilation_x(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<16x2x2x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x32x32x16xf32> { 239 // expected-error@+1 {{'tosa.conv2d' op failed level check: dilation_x * KW <= MAX_KERNEL}} 240 %0 = "tosa.conv2d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 4097>, pad = array<i64: 0, 1, 0, 1>, stride = array<i64: 1, 1>} : 241 (tensor<1x32x32x8xf32>, tensor<16x2x2x8xf32>, tensor<16xf32>) -> tensor<1x32x32x16xf32> 242 return %0 : tensor<1x32x32x16xf32> 243} 244 245// ----- 246 247func.func @test_conv2d_pad_top(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<16x2x2x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x32x32x16xf32> { 248 // expected-error@+1 {{'tosa.conv2d' op failed level check: pad <= MAX_KERNEL}} 249 %0 = "tosa.conv2d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 1>, pad = array<i64: 8193, 1, 0, 1>, stride = array<i64: 1, 1>} : 250 (tensor<1x32x32x8xf32>, tensor<16x2x2x8xf32>, tensor<16xf32>) -> tensor<1x32x32x16xf32> 251 return %0 : tensor<1x32x32x16xf32> 252} 253 254// ----- 255 256func.func @test_conv2d_pad_bottom(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<16x2x2x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x32x32x16xf32> { 257 // expected-error@+1 {{'tosa.conv2d' op failed level check: pad <= MAX_KERNEL}} 258 %0 = "tosa.conv2d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 1>, pad = array<i64: 0, 8193, 0, 1>, stride = array<i64: 1, 1>} : 259 (tensor<1x32x32x8xf32>, tensor<16x2x2x8xf32>, tensor<16xf32>) -> tensor<1x32x32x16xf32> 260 return %0 : tensor<1x32x32x16xf32> 261} 262 263// ----- 264 265func.func @test_conv2d_pad_left(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<16x2x2x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x32x32x16xf32> { 266 // expected-error@+1 {{'tosa.conv2d' op failed level check: pad <= MAX_KERNEL}} 267 %0 = "tosa.conv2d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 1>, pad = array<i64: 0, 1, 8193, 1>, stride = array<i64: 1, 1>} : 268 (tensor<1x32x32x8xf32>, tensor<16x2x2x8xf32>, tensor<16xf32>) -> tensor<1x32x32x16xf32> 269 return %0 : tensor<1x32x32x16xf32> 270} 271 272// ----- 273 274func.func @test_conv2d_pad_right(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<16x2x2x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x32x32x16xf32> { 275 // expected-error@+1 {{'tosa.conv2d' op failed level check: pad <= MAX_KERNEL}} 276 %0 = "tosa.conv2d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 1>, pad = array<i64: 0, 1, 0, 8193>, stride = array<i64: 1, 1>} : 277 (tensor<1x32x32x8xf32>, tensor<16x2x2x8xf32>, tensor<16xf32>) -> tensor<1x32x32x16xf32> 278 return %0 : tensor<1x32x32x16xf32> 279} 280 281// ----- 282 283func.func @test_conv2d_stride_y(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<16x2x2x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x32x32x16xf32> { 284 // expected-error@+1 {{'tosa.conv2d' op failed level check: stride <= MAX_STRIDE}} 285 %0 = "tosa.conv2d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 1>, pad = array<i64: 0, 1, 0, 1>, stride = array<i64: 8193, 1>} : 286 (tensor<1x32x32x8xf32>, tensor<16x2x2x8xf32>, tensor<16xf32>) -> tensor<1x32x32x16xf32> 287 return %0 : tensor<1x32x32x16xf32> 288} 289 290// ----- 291 292func.func @test_conv2d_stride_x(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<16x2x2x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x32x32x16xf32> { 293 // expected-error@+1 {{'tosa.conv2d' op failed level check: stride <= MAX_STRIDE}} 294 %0 = "tosa.conv2d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 1>, pad = array<i64: 0, 1, 0, 1>, stride = array<i64: 1, 8193>} : 295 (tensor<1x32x32x8xf32>, tensor<16x2x2x8xf32>, tensor<16xf32>) -> tensor<1x32x32x16xf32> 296 return %0 : tensor<1x32x32x16xf32> 297} 298 299// ----- 300 301func.func @test_conv3d_dilation_d(%arg0: tensor<1x1x32x32x8xf32>, %arg1: tensor<16x2x2x2x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x1x32x32x16xf32> { 302 // expected-error@+1 {{'tosa.conv3d' op failed level check: dilation_d * KD <= MAX_KERNEL}} 303 %0 = "tosa.conv3d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 4097, 1, 1>, pad = array<i64: 0, 1, 0, 1, 0, 1>, stride = array<i64: 1, 1, 1>} : 304 (tensor<1x1x32x32x8xf32>, tensor<16x2x2x2x8xf32>, tensor<16xf32>) -> tensor<1x1x32x32x16xf32> 305 return %0 : tensor<1x1x32x32x16xf32> 306} 307 308// ----- 309 310func.func @test_conv3d_dilation_y(%arg0: tensor<1x1x32x32x8xf32>, %arg1: tensor<16x2x2x2x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x1x32x32x16xf32> { 311 // expected-error@+1 {{'tosa.conv3d' op failed level check: dilation_y * KH <= MAX_KERNEL}} 312 %0 = "tosa.conv3d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 4097, 1>, pad = array<i64: 0, 1, 0, 1, 0, 1>, stride = array<i64: 1, 1, 1>} : 313 (tensor<1x1x32x32x8xf32>, tensor<16x2x2x2x8xf32>, tensor<16xf32>) -> tensor<1x1x32x32x16xf32> 314 return %0 : tensor<1x1x32x32x16xf32> 315} 316 317// ----- 318 319func.func @test_conv3d_dilation_x(%arg0: tensor<1x1x32x32x8xf32>, %arg1: tensor<16x2x2x2x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x1x32x32x16xf32> { 320 // expected-error@+1 {{'tosa.conv3d' op failed level check: dilation_x * KW <= MAX_KERNEL}} 321 %0 = "tosa.conv3d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 1, 4097>, pad = array<i64: 0, 1, 0, 1, 0, 1>, stride = array<i64: 1, 1, 1>} : 322 (tensor<1x1x32x32x8xf32>, tensor<16x2x2x2x8xf32>, tensor<16xf32>) -> tensor<1x1x32x32x16xf32> 323 return %0 : tensor<1x1x32x32x16xf32> 324} 325 326// ----- 327 328func.func @test_conv3d_pad_d0(%arg0: tensor<1x1x32x32x8xf32>, %arg1: tensor<16x2x2x2x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x1x32x32x16xf32> { 329 // expected-error@+1 {{'tosa.conv3d' op failed level check: pad <= MAX_KERNEL}} 330 %0 = "tosa.conv3d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 1, 1>, pad = array<i64: 8193, 1, 0, 1, 0, 1>, stride = array<i64: 1, 1, 1>} : 331 (tensor<1x1x32x32x8xf32>, tensor<16x2x2x2x8xf32>, tensor<16xf32>) -> tensor<1x1x32x32x16xf32> 332 return %0 : tensor<1x1x32x32x16xf32> 333} 334 335// ----- 336 337func.func @test_conv3d_pad_d1(%arg0: tensor<1x1x32x32x8xf32>, %arg1: tensor<16x2x2x2x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x1x32x32x16xf32> { 338 // expected-error@+1 {{'tosa.conv3d' op failed level check: pad <= MAX_KERNEL}} 339 %0 = "tosa.conv3d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 1, 1>, pad = array<i64: 1, 8193, 0, 1, 0, 1>, stride = array<i64: 1, 1, 1>} : 340 (tensor<1x1x32x32x8xf32>, tensor<16x2x2x2x8xf32>, tensor<16xf32>) -> tensor<1x1x32x32x16xf32> 341 return %0 : tensor<1x1x32x32x16xf32> 342} 343 344// ----- 345 346func.func @test_conv3d_pad_top(%arg0: tensor<1x1x32x32x8xf32>, %arg1: tensor<16x2x2x2x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x1x32x32x16xf32> { 347 // expected-error@+1 {{'tosa.conv3d' op failed level check: pad <= MAX_KERNEL}} 348 %0 = "tosa.conv3d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 1, 1>, pad = array<i64: 0, 1, 8193, 1, 0, 1>, stride = array<i64: 1, 1, 1>} : 349 (tensor<1x1x32x32x8xf32>, tensor<16x2x2x2x8xf32>, tensor<16xf32>) -> tensor<1x1x32x32x16xf32> 350 return %0 : tensor<1x1x32x32x16xf32> 351} 352 353// ----- 354 355func.func @test_conv3d_pad_bottom(%arg0: tensor<1x1x32x32x8xf32>, %arg1: tensor<16x2x2x2x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x1x32x32x16xf32> { 356 // expected-error@+1 {{'tosa.conv3d' op failed level check: pad <= MAX_KERNEL}} 357 %0 = "tosa.conv3d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 1, 1>, pad = array<i64: 0, 1, 0, 8193, 0, 1>, stride = array<i64: 1, 1, 1>} : 358 (tensor<1x1x32x32x8xf32>, tensor<16x2x2x2x8xf32>, tensor<16xf32>) -> tensor<1x1x32x32x16xf32> 359 return %0 : tensor<1x1x32x32x16xf32> 360} 361 362// ----- 363 364func.func @test_conv3d_pad_left(%arg0: tensor<1x1x32x32x8xf32>, %arg1: tensor<16x2x2x2x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x1x32x32x16xf32> { 365 // expected-error@+1 {{'tosa.conv3d' op failed level check: pad <= MAX_KERNEL}} 366 %0 = "tosa.conv3d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 1, 1>, pad = array<i64: 0, 1, 0, 1, 8193, 1>, stride = array<i64: 1, 1, 1>} : 367 (tensor<1x1x32x32x8xf32>, tensor<16x2x2x2x8xf32>, tensor<16xf32>) -> tensor<1x1x32x32x16xf32> 368 return %0 : tensor<1x1x32x32x16xf32> 369} 370 371// ----- 372 373func.func @test_conv3d_pad_right(%arg0: tensor<1x1x32x32x8xf32>, %arg1: tensor<16x2x2x2x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x1x32x32x16xf32> { 374 // expected-error@+1 {{'tosa.conv3d' op failed level check: pad <= MAX_KERNEL}} 375 %0 = "tosa.conv3d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 1, 1>, pad = array<i64: 0, 1, 0, 1, 0, 8193>, stride = array<i64: 1, 1, 1>} : 376 (tensor<1x1x32x32x8xf32>, tensor<16x2x2x2x8xf32>, tensor<16xf32>) -> tensor<1x1x32x32x16xf32> 377 return %0 : tensor<1x1x32x32x16xf32> 378} 379 380// ----- 381 382func.func @test_conv3d_stride_d(%arg0: tensor<1x1x32x32x8xf32>, %arg1: tensor<16x2x2x2x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x1x32x32x16xf32> { 383 // expected-error@+1 {{'tosa.conv3d' op failed level check: stride <= MAX_STRIDE}} 384 %0 = "tosa.conv3d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 1, 1>, pad = array<i64: 0, 1, 0, 1, 0, 1>, stride = array<i64: 8193, 1, 1>} : 385 (tensor<1x1x32x32x8xf32>, tensor<16x2x2x2x8xf32>, tensor<16xf32>) -> tensor<1x1x32x32x16xf32> 386 return %0 : tensor<1x1x32x32x16xf32> 387} 388 389// ----- 390 391func.func @test_conv3d_stride_y(%arg0: tensor<1x1x32x32x8xf32>, %arg1: tensor<16x2x2x2x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x1x32x32x16xf32> { 392 // expected-error@+1 {{'tosa.conv3d' op failed level check: stride <= MAX_STRIDE}} 393 %0 = "tosa.conv3d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 1, 1>, pad = array<i64: 0, 1, 0, 1, 0, 1>, stride = array<i64: 1, 8193, 1>} : 394 (tensor<1x1x32x32x8xf32>, tensor<16x2x2x2x8xf32>, tensor<16xf32>) -> tensor<1x1x32x32x16xf32> 395 return %0 : tensor<1x1x32x32x16xf32> 396} 397 398// ----- 399 400func.func @test_conv3d_stride_x(%arg0: tensor<1x1x32x32x8xf32>, %arg1: tensor<16x2x2x2x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x1x32x32x16xf32> { 401 // expected-error@+1 {{'tosa.conv3d' op failed level check: stride <= MAX_STRIDE}} 402 %0 = "tosa.conv3d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 1, 1>, pad = array<i64: 0, 1, 0, 1, 0, 1>, stride = array<i64: 1, 1, 8193>} : 403 (tensor<1x1x32x32x8xf32>, tensor<16x2x2x2x8xf32>, tensor<16xf32>) -> tensor<1x1x32x32x16xf32> 404 return %0 : tensor<1x1x32x32x16xf32> 405} 406 407// ----- 408 409func.func @test_depthwise_conv2d_dilation_y(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<2x2x8x8xf32>, %arg2: tensor<64xf32>) -> tensor<1x32x32x64xf32> { 410 // expected-error@+1 {{'tosa.depthwise_conv2d' op failed level check: dilation_y * KH <= MAX_KERNEL}} 411 %0 = "tosa.depthwise_conv2d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 4097, 1>, pad = array<i64: 0, 1, 0, 1>, stride = array<i64: 1, 1>} : 412 (tensor<1x32x32x8xf32>, tensor<2x2x8x8xf32>, tensor<64xf32>) -> tensor<1x32x32x64xf32> 413 return %0 : tensor<1x32x32x64xf32> 414} 415 416// ----- 417 418func.func @test_depthwise_conv2d_dilation_x(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<2x2x8x8xf32>, %arg2: tensor<64xf32>) -> tensor<1x32x32x64xf32> { 419 // expected-error@+1 {{'tosa.depthwise_conv2d' op failed level check: dilation_x * KW <= MAX_KERNEL}} 420 %0 = "tosa.depthwise_conv2d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 4097>, pad = array<i64: 0, 1, 0, 1>, stride = array<i64: 1, 1>} : 421 (tensor<1x32x32x8xf32>, tensor<2x2x8x8xf32>, tensor<64xf32>) -> tensor<1x32x32x64xf32> 422 return %0 : tensor<1x32x32x64xf32> 423} 424 425// ----- 426 427func.func @test_depthwise_conv2d_pad_top(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<2x2x8x8xf32>, %arg2: tensor<64xf32>) -> tensor<1x32x32x64xf32> { 428 // expected-error@+1 {{'tosa.depthwise_conv2d' op failed level check: pad <= MAX_KERNEL}} 429 %0 = "tosa.depthwise_conv2d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 1>, pad = array<i64: 8193, 1, 0, 1>, stride = array<i64: 1, 1>} : 430 (tensor<1x32x32x8xf32>, tensor<2x2x8x8xf32>, tensor<64xf32>) -> tensor<1x32x32x64xf32> 431 return %0 : tensor<1x32x32x64xf32> 432} 433 434// ----- 435 436func.func @test_depthwise_conv2d_pad_bottom(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<2x2x8x8xf32>, %arg2: tensor<64xf32>) -> tensor<1x32x32x64xf32> { 437 // expected-error@+1 {{'tosa.depthwise_conv2d' op failed level check: pad <= MAX_KERNEL}} 438 %0 = "tosa.depthwise_conv2d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 1>, pad = array<i64: 0, 8193, 0, 1>, stride = array<i64: 1, 1>} : 439 (tensor<1x32x32x8xf32>, tensor<2x2x8x8xf32>, tensor<64xf32>) -> tensor<1x32x32x64xf32> 440 return %0 : tensor<1x32x32x64xf32> 441} 442 443// ----- 444 445func.func @test_depthwise_conv2d_pad_left(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<2x2x8x8xf32>, %arg2: tensor<64xf32>) -> tensor<1x32x32x64xf32> { 446 // expected-error@+1 {{'tosa.depthwise_conv2d' op failed level check: pad <= MAX_KERNEL}} 447 %0 = "tosa.depthwise_conv2d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 1>, pad = array<i64: 0, 1, 8193, 1>, stride = array<i64: 1, 1>} : 448 (tensor<1x32x32x8xf32>, tensor<2x2x8x8xf32>, tensor<64xf32>) -> tensor<1x32x32x64xf32> 449 return %0 : tensor<1x32x32x64xf32> 450} 451 452// ----- 453 454func.func @test_depthwise_conv2d_pad_right(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<2x2x8x8xf32>, %arg2: tensor<64xf32>) -> tensor<1x32x32x64xf32> { 455 // expected-error@+1 {{'tosa.depthwise_conv2d' op failed level check: pad <= MAX_KERNEL}} 456 %0 = "tosa.depthwise_conv2d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 1>, pad = array<i64: 0, 1, 0, 8193>, stride = array<i64: 1, 1>} : 457 (tensor<1x32x32x8xf32>, tensor<2x2x8x8xf32>, tensor<64xf32>) -> tensor<1x32x32x64xf32> 458 return %0 : tensor<1x32x32x64xf32> 459} 460 461// ----- 462 463func.func @test_depthwise_conv2d_stride_y(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<2x2x8x8xf32>, %arg2: tensor<64xf32>) -> tensor<1x32x32x64xf32> { 464 // expected-error@+1 {{'tosa.depthwise_conv2d' op failed level check: stride <= MAX_STRIDE}} 465 %0 = "tosa.depthwise_conv2d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 1>, pad = array<i64: 0, 1, 0, 1>, stride = array<i64: 8193, 1>} : 466 (tensor<1x32x32x8xf32>, tensor<2x2x8x8xf32>, tensor<64xf32>) -> tensor<1x32x32x64xf32> 467 return %0 : tensor<1x32x32x64xf32> 468} 469 470// ----- 471 472func.func @test_depthwise_conv2d_stride_x(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<2x2x8x8xf32>, %arg2: tensor<64xf32>) -> tensor<1x32x32x64xf32> { 473 // expected-error@+1 {{'tosa.depthwise_conv2d' op failed level check: stride <= MAX_STRIDE}} 474 %0 = "tosa.depthwise_conv2d"(%arg0, %arg1, %arg2) {acc_type = f32, dilation = array<i64: 1, 1>, pad = array<i64: 0, 1, 0, 1>, stride = array<i64: 1, 8193>} : 475 (tensor<1x32x32x8xf32>, tensor<2x2x8x8xf32>, tensor<64xf32>) -> tensor<1x32x32x64xf32> 476 return %0 : tensor<1x32x32x64xf32> 477} 478 479// ----- 480 481func.func @test_fft2d_real_h(%arg0: tensor<32x8193x32xf32>, %arg1: tensor<32x32x32xf32>) -> (tensor<32x32x32xf32>, tensor<32x32x32xf32>) { 482 // expected-error@+1 {{'tosa.fft2d' op failed level check: H <= MAX_KERNEL}} 483 %0, %1 = "tosa.fft2d"(%arg0, %arg1) { inverse = false } : 484 (tensor<32x8193x32xf32>, tensor<32x32x32xf32>) -> (tensor<32x32x32xf32>, tensor<32x32x32xf32>) 485 return %0, %1 : tensor<32x32x32xf32>, tensor<32x32x32xf32> 486} 487 488// ----- 489 490func.func @test_fft2d_real_w(%arg0: tensor<32x32x8193xf32>, %arg1: tensor<32x32x32xf32>) -> (tensor<32x32x32xf32>, tensor<32x32x32xf32>) { 491 // expected-error@+1 {{'tosa.fft2d' op failed level check: W <= MAX_KERNEL}} 492 %0, %1 = "tosa.fft2d"(%arg0, %arg1) { inverse = false } : 493 (tensor<32x32x8193xf32>, tensor<32x32x32xf32>) -> (tensor<32x32x32xf32>, tensor<32x32x32xf32>) 494 return %0, %1 : tensor<32x32x32xf32>, tensor<32x32x32xf32> 495} 496 497// ----- 498 499func.func @test_fft2d_imag_h(%arg0: tensor<32x32x32xf32>, %arg1: tensor<32x8193x32xf32>) -> (tensor<32x32x32xf32>, tensor<32x32x32xf32>) { 500 // expected-error@+1 {{'tosa.fft2d' op failed level check: H <= MAX_KERNEL}} 501 %0, %1 = "tosa.fft2d"(%arg0, %arg1) { inverse = false } : 502 (tensor<32x32x32xf32>, tensor<32x8193x32xf32>) -> (tensor<32x32x32xf32>, tensor<32x32x32xf32>) 503 return %0, %1 : tensor<32x32x32xf32>, tensor<32x32x32xf32> 504} 505 506// ----- 507 508func.func @test_fft2d_imag_w(%arg0: tensor<32x32x32xf32>, %arg1: tensor<32x32x8193xf32>) -> (tensor<32x32x32xf32>, tensor<32x32x32xf32>) { 509 // expected-error@+1 {{'tosa.fft2d' op failed level check: W <= MAX_KERNEL}} 510 %0, %1 = "tosa.fft2d"(%arg0, %arg1) { inverse = false } : 511 (tensor<32x32x32xf32>, tensor<32x32x8193xf32>) -> (tensor<32x32x32xf32>, tensor<32x32x32xf32>) 512 return %0, %1 : tensor<32x32x32xf32>, tensor<32x32x32xf32> 513} 514 515// ----- 516 517func.func @test_maxpool2d_stride_y(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> { 518 // expected-error@+1 {{'tosa.max_pool2d' op failed level check: stride <= MAX_STRIDE}} 519 %0 = "tosa.max_pool2d"(%arg0) {kernel = array<i64: 1, 1>, pad = array<i64: 4, 4, 4, 4>, stride = array<i64: 8193, 1>} : 520 (tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> 521 return %0 : tensor<1x32x32x8xf32> 522} 523 524// ----- 525 526func.func @test_maxpool2d_kernel_x(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> { 527 // expected-error@+1 {{'tosa.max_pool2d' op failed level check: kernel <= MAX_KERNEL}} 528 %0 = "tosa.max_pool2d"(%arg0) {kernel = array<i64: 1, 8193>, pad = array<i64: 4, 4, 4, 4>, stride = array<i64: 1, 1>} : 529 (tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> 530 return %0 : tensor<1x32x32x8xf32> 531} 532 533// ----- 534 535func.func @test_maxpool2d_stride_y(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> { 536 // expected-error@+1 {{'tosa.max_pool2d' op failed level check: stride <= MAX_STRIDE}} 537 %0 = "tosa.max_pool2d"(%arg0) {kernel = array<i64: 1, 1>, pad = array<i64: 4, 4, 4, 4>, stride = array<i64: 8193, 1>} : 538 (tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> 539 return %0 : tensor<1x32x32x8xf32> 540} 541 542// ----- 543 544func.func @test_maxpool2d_stride_x(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> { 545 // expected-error@+1 {{'tosa.max_pool2d' op failed level check: stride <= MAX_STRIDE}} 546 %0 = "tosa.max_pool2d"(%arg0) {kernel = array<i64: 1, 1>, pad = array<i64: 4, 4, 4, 4>, stride = array<i64: 1, 8193>} : 547 (tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> 548 return %0 : tensor<1x32x32x8xf32> 549} 550 551 552// ----- 553 554func.func @test_maxpool2d_pad_top(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> { 555 // expected-error@+1 {{'tosa.max_pool2d' op failed level check: pad <= MAX_KERNEL}} 556 %0 = "tosa.max_pool2d"(%arg0) {kernel = array<i64: 1, 1>, pad = array<i64: 8193, 4, 4, 4>, stride = array<i64: 1, 1>} : 557 (tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> 558 return %0 : tensor<1x32x32x8xf32> 559} 560 561// ----- 562 563func.func @test_maxpool2d_pad_bottom(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> { 564 // expected-error@+1 {{'tosa.max_pool2d' op failed level check: pad <= MAX_KERNEL}} 565 %0 = "tosa.max_pool2d"(%arg0) {kernel = array<i64: 1, 1>, pad = array<i64: 4, 8193, 4, 4>, stride = array<i64: 1, 1>} : 566 (tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> 567 return %0 : tensor<1x32x32x8xf32> 568} 569 570// ----- 571 572func.func @test_maxpool2d_pad_left(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> { 573 // expected-error@+1 {{'tosa.max_pool2d' op failed level check: pad <= MAX_KERNEL}} 574 %0 = "tosa.max_pool2d"(%arg0) {kernel = array<i64: 1, 1>, pad = array<i64: 4, 4, 8193, 4>, stride = array<i64: 1, 1>} : 575 (tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> 576 return %0 : tensor<1x32x32x8xf32> 577} 578 579// ----- 580 581func.func @test_maxpool2d_pad_right(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> { 582 // expected-error@+1 {{'tosa.max_pool2d' op failed level check: pad <= MAX_KERNEL}} 583 %0 = "tosa.max_pool2d"(%arg0) {kernel = array<i64: 1, 1>, pad = array<i64: 4, 4, 4, 8193>, stride = array<i64: 1, 1>} : 584 (tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> 585 return %0 : tensor<1x32x32x8xf32> 586} 587 588// ----- 589 590func.func @test_rfft2d_input_h(%arg0: tensor<13x8193x16xf32>) -> (tensor<13x8x9xf32>, tensor<13x8x9xf32>) { 591 // expected-error@+1 {{'tosa.rfft2d' op failed level check: H <= MAX_KERNEL}} 592 %0, %1 = "tosa.rfft2d"(%arg0) {} : (tensor<13x8193x16xf32>) -> (tensor<13x8x9xf32>, tensor<13x8x9xf32>) 593 return %0, %1 : tensor<13x8x9xf32>, tensor<13x8x9xf32> 594} 595 596// ----- 597 598func.func @test_rfft2d_input_w(%arg0: tensor<13x8x8193xf32>) -> (tensor<13x8x9xf32>, tensor<13x8x9xf32>) { 599 // expected-error@+1 {{'tosa.rfft2d' op failed level check: W <= MAX_KERNEL}} 600 %0, %1 = "tosa.rfft2d"(%arg0) {} : (tensor<13x8x8193xf32>) -> (tensor<13x8x9xf32>, tensor<13x8x9xf32>) 601 return %0, %1 : tensor<13x8x9xf32>, tensor<13x8x9xf32> 602} 603 604// ----- 605 606func.func @test_transpose_conv2d_weight_h(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<16x8193x1x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x32x32x16xf32> { 607 // expected-error@+1 {{'tosa.transpose_conv2d' op failed level check: KH <= MAX_KERNEL}} 608 %0 = "tosa.transpose_conv2d"(%arg0, %arg1, %arg2) {acc_type = f32, out_pad = array<i64: 0, 0, 0, 0>, out_shape = array<i64: 1, 32, 32, 16>, stride = array<i64: 1, 1>} : 609 (tensor<1x32x32x8xf32>, tensor<16x8193x1x8xf32>, tensor<16xf32>) -> tensor<1x32x32x16xf32> 610 return %0 : tensor<1x32x32x16xf32> 611} 612 613// ----- 614 615func.func @test_transpose_conv2d_weight_w(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<16x1x8193x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x32x32x16xf32> { 616 // expected-error@+1 {{'tosa.transpose_conv2d' op failed level check: KW <= MAX_KERNEL}} 617 %0 = "tosa.transpose_conv2d"(%arg0, %arg1, %arg2) {acc_type = f32, out_pad = array<i64: 0, 0, 0, 0>, out_shape = array<i64: 1, 32, 32, 16>, stride = array<i64: 1, 1>} : 618 (tensor<1x32x32x8xf32>, tensor<16x1x8193x8xf32>, tensor<16xf32>) -> tensor<1x32x32x16xf32> 619 return %0 : tensor<1x32x32x16xf32> 620} 621 622// ----- 623 624func.func @test_transpose_conv2d_pad_top(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<16x1x1x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x32x32x16xf32> { 625 // expected-error@+1 {{'tosa.transpose_conv2d' op failed level check: pad <= MAX_KERNEL}} 626 %0 = "tosa.transpose_conv2d"(%arg0, %arg1, %arg2) {acc_type = f32, out_pad = array<i64: 8193, 0, 0, 0>, out_shape = array<i64: 1, 32, 32, 16>, stride = array<i64: 1, 1>} : 627 (tensor<1x32x32x8xf32>, tensor<16x1x1x8xf32>, tensor<16xf32>) -> tensor<1x32x32x16xf32> 628 return %0 : tensor<1x32x32x16xf32> 629} 630 631// ----- 632 633func.func @test_transpose_conv2d_pad_bottom(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<16x1x1x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x32x32x16xf32> { 634 // expected-error@+1 {{'tosa.transpose_conv2d' op failed level check: pad <= MAX_KERNEL}} 635 %0 = "tosa.transpose_conv2d"(%arg0, %arg1, %arg2) {acc_type = f32, out_pad = array<i64: 0, 8193, 0, 0>, out_shape = array<i64: 1, 32, 32, 16>, stride = array<i64: 1, 1>} : 636 (tensor<1x32x32x8xf32>, tensor<16x1x1x8xf32>, tensor<16xf32>) -> tensor<1x32x32x16xf32> 637 return %0 : tensor<1x32x32x16xf32> 638} 639 640// ----- 641 642func.func @test_transpose_conv2d_pad_left(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<16x1x1x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x32x32x16xf32> { 643 // expected-error@+1 {{'tosa.transpose_conv2d' op failed level check: pad <= MAX_KERNEL}} 644 %0 = "tosa.transpose_conv2d"(%arg0, %arg1, %arg2) {acc_type = f32, out_pad = array<i64: 0, 0, 8193, 0>, out_shape = array<i64: 1, 32, 32, 16>, stride = array<i64: 1, 1>} : 645 (tensor<1x32x32x8xf32>, tensor<16x1x1x8xf32>, tensor<16xf32>) -> tensor<1x32x32x16xf32> 646 return %0 : tensor<1x32x32x16xf32> 647} 648 649// ----- 650 651func.func @test_transpose_conv2d_pad_right(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<16x1x1x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x32x32x16xf32> { 652 // expected-error@+1 {{'tosa.transpose_conv2d' op failed level check: pad <= MAX_KERNEL}} 653 %0 = "tosa.transpose_conv2d"(%arg0, %arg1, %arg2) {acc_type = f32, out_pad = array<i64: 0, 0, 0, 8193>, out_shape = array<i64: 1, 32, 32, 16>, stride = array<i64: 1, 1>} : 654 (tensor<1x32x32x8xf32>, tensor<16x1x1x8xf32>, tensor<16xf32>) -> tensor<1x32x32x16xf32> 655 return %0 : tensor<1x32x32x16xf32> 656} 657 658// ----- 659 660func.func @test_transpose_conv2d_stride_y(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<16x1x1x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x32x32x16xf32> { 661 // expected-error@+1 {{'tosa.transpose_conv2d' op failed level check: stride <= MAX_STRIDE}} 662 %0 = "tosa.transpose_conv2d"(%arg0, %arg1, %arg2) {acc_type = f32, out_pad = array<i64: 0, 0, 0, 0>, out_shape = array<i64: 1, 32, 32, 16>, stride = array<i64: 8193, 1>} : 663 (tensor<1x32x32x8xf32>, tensor<16x1x1x8xf32>, tensor<16xf32>) -> tensor<1x32x32x16xf32> 664 return %0 : tensor<1x32x32x16xf32> 665} 666 667// ----- 668 669func.func @test_transpose_conv2d_stride_x(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<16x1x1x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x32x32x16xf32> { 670 // expected-error@+1 {{'tosa.transpose_conv2d' op failed level check: stride <= MAX_STRIDE}} 671 %0 = "tosa.transpose_conv2d"(%arg0, %arg1, %arg2) {acc_type = f32, out_pad = array<i64: 0, 0, 0, 0>, out_shape = array<i64: 1, 32, 32, 16>, stride = array<i64: 1, 8193>} : 672 (tensor<1x32x32x8xf32>, tensor<16x1x1x8xf32>, tensor<16xf32>) -> tensor<1x32x32x16xf32> 673 return %0 : tensor<1x32x32x16xf32> 674} 675 676// ----- 677 678func.func @test_resize_scale_y(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x64x64x8xf32> { 679 // expected-error@+1 {{'tosa.resize' op failed level check: scale_y_n/scale_y_d <= MAX_SCALE}} 680 %1 = "tosa.resize"(%arg0) { scale = array<i64: 257, 1, 4, 2>, offset = array<i64: -1, -1>, border = array<i64: 1, 1>, mode = "BILINEAR"} : 681 (tensor<1x32x32x8xf32>) -> tensor<1x64x64x8xf32> 682 return %1 : tensor<1x64x64x8xf32> 683} 684 685// ----- 686 687func.func @test_resize_scale_x(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x64x64x8xf32> { 688 // expected-error@+1 {{'tosa.resize' op failed level check: scale_x_n/scale_x_d <= MAX_SCALE}} 689 %1 = "tosa.resize"(%arg0) { scale = array<i64: 4, 2, 257, 1>, offset = array<i64: -1, -1>, border = array<i64: 1, 1>, mode = "BILINEAR"} : 690 (tensor<1x32x32x8xf32>) -> tensor<1x64x64x8xf32> 691 return %1 : tensor<1x64x64x8xf32> 692} 693 694// ----- 695 696// CHECK-LABEL: @test_cond_if 697func.func @test_cond_if(%arg0: tensor<1x1x1x1x1x1x1xf32>, %arg1: tensor<1x1x1x1x1x1x1xf32>, %arg2: tensor<i1>) -> tensor<1x1x1x1x1x1x1xf32> { 698 %0 = "tosa.cond_if"(%arg2, %arg0, %arg1) ({ 699 ^bb0(%arg3: tensor<1x1x1x1x1x1x1xf32>, %arg4: tensor<1x1x1x1x1x1x1xf32>): 700 "tosa.yield"(%arg3) : (tensor<1x1x1x1x1x1x1xf32>) -> () 701 }, { 702 ^bb0(%arg3: tensor<1x1x1x1x1x1x1xf32>, %arg4: tensor<1x1x1x1x1x1x1xf32>): 703 "tosa.yield"(%arg4) : (tensor<1x1x1x1x1x1x1xf32>) -> () 704 }) : (tensor<i1>, tensor<1x1x1x1x1x1x1xf32>, tensor<1x1x1x1x1x1x1xf32>) -> tensor<1x1x1x1x1x1x1xf32> 705 return %0 : tensor<1x1x1x1x1x1x1xf32> 706} 707 708// ----- 709 710// CHECK-LABEL: @test_while_loop 711func.func @test_while_loop(%arg0: tensor<1x1x1x1x1x1x1xf32>, %arg1: tensor<i32>) { 712 %0 = "tosa.const"() {value = dense<0> : tensor<i32>} : () -> tensor<i32> 713 %1:2 = "tosa.while_loop"(%0, %arg0) ({ 714 ^bb0(%arg3: tensor<i32>, %arg4: tensor<1x1x1x1x1x1x1xf32>): 715 %2 = "tosa.greater_equal"(%arg3, %arg1) : (tensor<i32>, tensor<i32>) -> tensor<i1> 716 %3 = "tosa.logical_not"(%2) : (tensor<i1>) -> tensor<i1> 717 "tosa.yield"(%3) : (tensor<i1>) -> () 718 }, { 719 ^bb0(%arg3: tensor<i32>, %arg4: tensor<1x1x1x1x1x1x1xf32>): 720 %2 = "tosa.const"() {value = dense<1> : tensor<i32>} : () -> tensor<i32> 721 %3 = "tosa.add"(%arg3, %2) : (tensor<i32>, tensor<i32>) -> tensor<i32> 722 "tosa.yield"(%3, %arg4) : (tensor<i32>, tensor<1x1x1x1x1x1x1xf32>) -> () 723 }) : (tensor<i32>, tensor<1x1x1x1x1x1x1xf32>) -> (tensor<i32>, tensor<1x1x1x1x1x1x1xf32>) 724 return 725} 726 727// ----- 728 729// CHECK-LABEL: @test_custom 730func.func @test_custom(%arg0: tensor<1x1x1x1x1x1x10xi32>) -> tensor<1x1x1x1x1x1x10xi32> { 731 %0 = "tosa.custom"(%arg0) {operator_name="custom_test", domain_name="tosa_mlir_test", implementation_attrs=""} : 732 (tensor<1x1x1x1x1x1x10xi32>) -> (tensor<1x1x1x1x1x1x10xi32>) 733 return %0 : tensor<1x1x1x1x1x1x10xi32> 734} 735 736// ----- 737 738// CHECK-LABEL: unranked_tensor 739func.func @test_unranked_tensor(%arg0: tensor<*xf32>) { 740 %0 = tosa.const_shape {value = dense<[0]> : tensor<1xindex>} : () -> !tosa.shape<1> 741 %1 = tosa.const_shape {value = dense<[1]> : tensor<1xindex>} : () -> !tosa.shape<1> 742 743 // expected-error@+1 {{'tosa.slice' op failed level check: unranked tensor}} 744 %2= tosa.slice %arg0, %0, %1 : (tensor<*xf32>, !tosa.shape<1>, !tosa.shape<1>) -> tensor<*xf32> 745 return 746} 747