2038 lines · plain
1// RUN: mlir-opt %s -split-input-file -verify-diagnostics2 3func.func @broadcast_to_scalar(%arg0: f32) -> f32 {4 // expected-error@+1 {{custom op 'vector.broadcast' invalid kind of type specified: expected builtin.vector, but found 'f32'}}5 %0 = vector.broadcast %arg0 : f32 to f326}7 8// -----9 10func.func @broadcast_rank_too_high(%arg0: vector<4x4xf32>) {11 // expected-error@+1 {{'vector.broadcast' op source rank higher than destination rank}}12 %1 = vector.broadcast %arg0 : vector<4x4xf32> to vector<4xf32>13}14 15// -----16 17func.func @broadcast_rank_too_high_0d(%arg0: vector<1xf32>) {18 // expected-error@+1 {{'vector.broadcast' op source rank higher than destination rank}}19 %1 = vector.broadcast %arg0 : vector<1xf32> to vector<f32>20}21 22// -----23 24func.func @broadcast_dim1_mismatch(%arg0: vector<7xf32>) {25 // expected-error@+1 {{'vector.broadcast' op dimension mismatch (7 vs. 3)}}26 %1 = vector.broadcast %arg0 : vector<7xf32> to vector<3xf32>27}28 29// -----30 31func.func @broadcast_dim2_mismatch(%arg0: vector<4x8xf32>) {32 // expected-error@+1 {{'vector.broadcast' op dimension mismatch (4 vs. 1)}}33 %1 = vector.broadcast %arg0 : vector<4x8xf32> to vector<1x8xf32>34}35 36// -----37 38func.func @broadcast_scalable_unit_dim(%arg0: vector<[1]xf32>) {39 // expected-error@+1 {{'vector.broadcast' op dimension mismatch ([1] vs. [4])}}40 %0 = vector.broadcast %arg0 : vector<[1]xf32> to vector<[4]xf32>41}42 43// -----44 45func.func @broadcast_fixed_to_scalable(%arg0: vector<2xf32>) {46 // expected-error@+1 {{'vector.broadcast' op dimension mismatch (2 vs. [2])}}47 %0 = vector.broadcast %arg0 : vector<2xf32> to vector<[2]xf32>48}49 50// -----51 52func.func @broadcast_scalable_to_fixed(%arg0: vector<[1]xf32>) {53 // expected-error@+1 {{'vector.broadcast' op dimension mismatch ([1] vs. 1)}}54 %0 = vector.broadcast %arg0 : vector<[1]xf32> to vector<4x1xf32>55}56 57// -----58 59func.func @broadcast_unknown(%arg0: memref<4x8xf32>) {60 // expected-error@+1 {{'vector.broadcast' op source type is not a vector}}61 %1 = vector.broadcast %arg0 : memref<4x8xf32> to vector<1x8xf32>62}63 64// -----65 66func.func @fma_vector_4xi32(%arg0: vector<4xi32>) {67 // expected-error@+1 {{'vector.fma' op operand #0 must be vector of floating-point value}}68 %1 = vector.fma %arg0, %arg0, %arg0 : vector<4xi32>69}70 71// -----72 73func.func @shuffle_elt_type_mismatch(%arg0: vector<2xf32>, %arg1: vector<2xi32>) {74 // expected-error@+1 {{'vector.shuffle' op failed to verify that second operand v2 and result have same element type}}75 %1 = vector.shuffle %arg0, %arg1 [0, 1] : vector<2xf32>, vector<2xi32>76}77 78// -----79 80func.func @shuffle_rank_mismatch(%arg0: vector<2xf32>, %arg1: vector<4x2xf32>) {81 // expected-error@+1 {{'vector.shuffle' op rank mismatch}}82 %1 = vector.shuffle %arg0, %arg1 [0, 1] : vector<2xf32>, vector<4x2xf32>83}84 85// -----86 87func.func @shuffle_rank_mismatch_0d(%arg0: vector<f32>, %arg1: vector<1xf32>) {88 // expected-error@+1 {{'vector.shuffle' op rank mismatch}}89 %1 = vector.shuffle %arg0, %arg1 [0, 1] : vector<f32>, vector<1xf32>90}91 92// -----93 94func.func @shuffle_trailing_dim_size_mismatch(%arg0: vector<2x2xf32>, %arg1: vector<2x4xf32>) {95 // expected-error@+1 {{'vector.shuffle' op dimension mismatch}}96 %1 = vector.shuffle %arg0, %arg1 [0, 1] : vector<2x2xf32>, vector<2x4xf32>97}98 99// -----100 101func.func @shuffle_index_out_of_range(%arg0: vector<2xf32>, %arg1: vector<2xf32>) {102 // expected-error@+1 {{'vector.shuffle' op mask index #2 out of range}}103 %1 = vector.shuffle %arg0, %arg1 [0, 4] : vector<2xf32>, vector<2xf32>104}105 106// -----107 108func.func @shuffle_scalable_vec(%arg0: vector<[2]xf32>, %arg1: vector<[2]xf32>) {109 // expected-error@+1 {{'vector.shuffle' op operand #0 must be fixed-length vector of any type values}}110 %1 = vector.shuffle %arg0, %arg1 [0, 1, 2, 3] : vector<[2]xf32>, vector<[2]xf32>111}112 113// -----114 115func.func @shuffle_empty_mask(%arg0: vector<2xf32>, %arg1: vector<2xf32>) {116 // expected-error@+1 {{'vector.shuffle' op invalid mask length}}117 %1 = vector.shuffle %arg0, %arg1 [] : vector<2xf32>, vector<2xf32>118}119 120// -----121 122func.func @extract_vector_type(%arg0: index) {123 // expected-error@+1 {{invalid kind of type specified: expected builtin.vector, but found 'index'}}124 %1 = vector.extract %arg0[] : index from index125}126 127// -----128 129func.func @extract_position_rank_overflow(%arg0: vector<4x8x16xf32>) {130 // expected-error@+1 {{expected position attribute of rank no greater than vector rank}}131 %1 = vector.extract %arg0[0, 0, 0, 0] : f32 from vector<4x8x16xf32>132}133 134// -----135 136func.func @extract_position_rank_overflow_generic(%arg0: vector<4x8x16xf32>) {137 // expected-error@+1 {{expected position attribute of rank no greater than vector rank}}138 %1 = "vector.extract" (%arg0) <{static_position = array<i64: 0, 0, 0, 0>}> : (vector<4x8x16xf32>) -> (vector<16xf32>)139}140 141// -----142 143func.func @extract_position_overflow(%arg0: vector<4x8x16xf32>) {144 // expected-error@+1 {{expected position attribute #2 to be a non-negative integer smaller than the corresponding vector dimension}}145 %1 = vector.extract %arg0[0, 43, 0] : f32 from vector<4x8x16xf32>146}147 148// -----149 150func.func @extract_precise_position_overflow(%arg0: vector<4x8x16xf32>) {151 // expected-error@+1 {{expected position attribute #3 to be a non-negative integer smaller than the corresponding vector dimension}}152 %1 = vector.extract %arg0[3, 7, 16] : f32 from vector<4x8x16xf32>153}154 155// -----156 157func.func @extract_0d_result(%arg0: vector<f32>) {158 // expected-error@+1 {{expected a scalar instead of a 0-d vector as the result type}}159 %1 = vector.extract %arg0[] : vector<f32> from vector<f32>160}161 162// -----163 164func.func @extract_position_overflow(%arg0: vector<4x8x16xf32>) {165 // expected-error@+1 {{expected position attribute #3 to be a non-negative integer smaller than the corresponding vector dimension or poison (-1)}}166 %1 = vector.extract %arg0[0, 0, -5] : f32 from vector<4x8x16xf32>167}168 169// -----170 171func.func @insert_vector_type(%a: f32, %b: vector<4x8x16xf32>) {172 // expected-error@+1 {{expected position attribute of rank no greater than dest vector rank}}173 %1 = vector.insert %a, %b[3, 3, 3, 3, 3, 3] : f32 into vector<4x8x16xf32>174}175 176// -----177 178func.func @insert_vector_type(%a: vector<4xf32>, %b: vector<4x8x16xf32>) {179 // expected-error@+1 {{expected position attribute rank + source rank to match dest vector rank}}180 %1 = vector.insert %a, %b[3] : vector<4xf32> into vector<4x8x16xf32>181}182 183// -----184 185func.func @insert_vector_type(%a: f32, %b: vector<4x8x16xf32>) {186 // expected-error@+1 {{expected position attribute rank to match the dest vector rank}}187 %1 = vector.insert %a, %b[3, 3] : f32 into vector<4x8x16xf32>188}189 190// -----191 192func.func @insert_position_overflow(%a: f32, %b: vector<4x8x16xf32>) {193 // expected-error@+1 {{expected position attribute #3 to be a non-negative integer smaller than the corresponding dest vector dimension}}194 %1 = vector.insert %a, %b[0, 0, -5] : f32 into vector<4x8x16xf32>195}196 197// -----198 199func.func @insert_precise_position_overflow(%a: f32, %b: vector<4x8x16xf32>) {200 // expected-error@+1 {{expected position attribute #1 to be a non-negative integer smaller than the corresponding dest vector dimension}}201 %1 = vector.insert %a, %b[4, 7, 15] : f32 into vector<4x8x16xf32>202}203 204// -----205 206func.func @insert_0d_value_to_store(%a: vector<f32>, %b: vector<4x8x16xf32>) {207 // expected-error@+1 {{expected a scalar instead of a 0-d vector as the source operand}}208 %1 = vector.insert %a, %b[0, 0, 0] : vector<f32> into vector<4x8x16xf32>209}210 211// -----212 213func.func @outerproduct_num_operands(%arg0: f32) {214 // expected-error@+1 {{expected at least 2 operands}}215 %1 = vector.outerproduct %arg0 : f32, f32216}217// -----218 219func.func @outerproduct_non_vector_operand(%arg0: f32) {220 // expected-error@+1 {{expected vector type for operand #1}}221 %1 = vector.outerproduct %arg0, %arg0 : f32, f32222}223 224// -----225 226func.func @outerproduct_operand_1(%arg0: vector<4xf32>, %arg1: vector<4x8xf32>) {227 // expected-error@+1 {{expected 1-d vector for operand #1}}228 %1 = vector.outerproduct %arg1, %arg1 : vector<4x8xf32>, vector<4x8xf32>229}230 231// -----232 233func.func @outerproduct_operand_2(%arg0: vector<4xf32>, %arg1: vector<4x8xf32>) {234 // expected-error@+1 {{expected 1-d vector for operand #2}}235 %1 = vector.outerproduct %arg0, %arg1 : vector<4xf32>, vector<4x8xf32>236}237 238// -----239 240func.func @outerproduct_result_generic(%arg0: vector<4xf32>, %arg1: vector<8xf32>) {241 // expected-error@+1 {{expected 2-d vector result}}242 %1 = "vector.outerproduct" (%arg0, %arg1) : (vector<4xf32>, vector<8xf32>) -> (vector<8xf32>)243}244 245// -----246 247func.func @outerproduct_operand_1_dim_generic(%arg0: vector<4xf32>, %arg1: vector<8xf32>) {248 // expected-error@+1 {{expected #1 operand dim to match result dim #1}}249 %1 = "vector.outerproduct" (%arg0, %arg1) : (vector<4xf32>, vector<8xf32>) -> (vector<8x16xf32>)250}251 252// -----253 254func.func @outerproduct_operand_2_dim_generic(%arg0: vector<4xf32>, %arg1: vector<8xf32>) {255 // expected-error@+1 {{expected #2 operand dim to match result dim #2}}256 %1 = "vector.outerproduct" (%arg0, %arg1) : (vector<4xf32>, vector<8xf32>) -> (vector<4x16xf32>)257}258 259// -----260 261func.func @outerproduct_axpy_operand(%arg0: vector<4x8xf32>, %arg1: f32) {262 // expected-error@+1 {{expected 1-d vector for operand #1}}263 %1 = vector.outerproduct %arg0, %arg1 : vector<4x8xf32>, f32264}265 266// -----267 268func.func @outerproduct_axpy_result_generic(%arg0: vector<4xf32>, %arg1: f32) {269 // expected-error@+1 {{expected 1-d vector result}}270 %1 = "vector.outerproduct" (%arg0, %arg1) : (vector<4xf32>, f32) -> (vector<4x8xf32>)271}272 273// -----274 275func.func @outerproduct_axpy_operand_dim_generic(%arg0: vector<8xf32>, %arg1: f32) {276 // expected-error@+1 {{expected #1 operand dim to match result dim #1}}277 %1 = "vector.outerproduct" (%arg0, %arg1) : (vector<8xf32>, f32) -> (vector<16xf32>)278}279 280// -----281 282func.func @outerproduct_operand_3_result_type_generic(%arg0: vector<4xf32>, %arg1: vector<8xf32>, %arg2: vector<4x16xf32>) {283 // expected-error@+1 {{expected operand #3 of same type as result type}}284 %1 = "vector.outerproduct" (%arg0, %arg1, %arg2) : (vector<4xf32>, vector<8xf32>, vector<4x16xf32>) -> (vector<4x8xf32>)285}286 287// -----288 289func.func @test_vector.transfer_read(%arg0: memref<?x?xf32>) {290 %c3 = arith.constant 3 : index291 %cst = arith.constant 3.0 : f32292 // expected-error@+1 {{requires two types}}293 %0 = vector.transfer_read %arg0[%c3, %c3], %cst { permutation_map = affine_map<()->(0)> } : memref<?x?xf32>294}295 296// -----297 298#map1 = affine_map<(d0, d1, d2) -> (d0, 0, 0)>299func.func @main(%m: memref<1xi32>, %2: vector<1x32xi1>) -> vector<1x32xi32> {300 %0 = arith.constant 1 : index301 %1 = arith.constant 1 : i32302 // expected-error@+1 {{expected the same rank for the vector and the results of the permutation map}}303 %3 = vector.transfer_read %m[%0], %1, %2 { permutation_map = #map1 } : memref<1xi32>, vector<1x32xi32>304 return %3 : vector<1x32xi32>305}306 307// -----308 309#map1 = affine_map<(d0, d1, d2) -> (d0, 0, 0)>310func.func @test_vector.transfer_write(%m: memref<1xi32>, %2: vector<1x32xi32>) -> vector<1x32xi32> {311 %0 = arith.constant 1 : index312 %1 = arith.constant 1 : i32313 // expected-error@+1 {{expected the same rank for the vector and the results of the permutation map}}314 %3 = vector.transfer_write %2, %m[%0], %1 { permutation_map = #map1 } : vector<1x32xi32>, memref<1xi32>315 return %3 : vector<1x32xi32>316}317 318// -----319 320func.func @test_vector.transfer_read(%arg0: vector<4x3xf32>) {321 %c3 = arith.constant 3 : index322 %f0 = arith.constant 0.0 : f32323 %vf0 = vector.broadcast %f0 : f32 to vector<4x3xf32>324 // expected-error@+1 {{ requires memref or ranked tensor type}}325 %0 = vector.transfer_read %arg0[%c3, %c3], %vf0 : vector<4x3xf32>, vector<1x1x2x3xf32>326}327 328// -----329 330func.func @test_vector.transfer_read(%arg0: memref<4x3xf32>) {331 %c3 = arith.constant 3 : index332 %f0 = arith.constant 0.0 : f32333 %vf0 = vector.broadcast %f0 : f32 to vector<4x3xf32>334 // expected-error@+1 {{ requires vector type}}335 %0 = vector.transfer_read %arg0[%c3, %c3], %vf0 : memref<4x3xf32>, f32336}337 338// -----339 340func.func @test_vector.transfer_read(%arg0: memref<?x?xf32>) {341 %c3 = arith.constant 3 : index342 %cst = arith.constant 3.0 : f32343 // expected-error@+1 {{requires 2 indices}}344 %0 = vector.transfer_read %arg0[%c3, %c3, %c3], %cst { permutation_map = affine_map<()->(0)> } : memref<?x?xf32>, vector<128xf32>345}346 347// -----348 349func.func @test_vector.transfer_read(%arg0: memref<?x?xf32>) {350 %c3 = arith.constant 3 : index351 %cst = arith.constant 3.0 : f32352 // expected-error@+1 {{requires 2 indices}}353 %0 = vector.transfer_read %arg0[%c3], %cst { permutation_map = affine_map<()->(0)> } : memref<?x?xf32>, vector<128xf32>354}355 356// -----357 358func.func @test_vector.transfer_read(%arg0: memref<?x?xf32>) {359 %c3 = arith.constant 3 : index360 %cst = arith.constant 3.0 : f32361 // expected-error@+1 {{requires a permutation_map with input dims of the same rank as the source type}}362 %0 = vector.transfer_read %arg0[%c3, %c3], %cst {permutation_map = affine_map<(d0)->(d0)>} : memref<?x?xf32>, vector<128xf32>363}364 365// -----366 367func.func @test_vector.transfer_read(%arg0: memref<?x?xf32>) {368 %c3 = arith.constant 3 : index369 %cst = arith.constant 3.0 : f32370 // expected-error@+1 {{requires a permutation_map with result dims of the same rank as the vector type}}371 %0 = vector.transfer_read %arg0[%c3, %c3], %cst {permutation_map = affine_map<(d0, d1)->(d0, d1)>} : memref<?x?xf32>, vector<128xf32>372}373 374// -----375 376func.func @test_vector.transfer_read(%arg0: memref<?x?xf32>) {377 %c3 = arith.constant 3 : index378 %cst = arith.constant 3.0 : f32379 // expected-error@+1 {{requires a projected permutation_map (at most one dim or the zero constant can appear in each result)}}380 %0 = vector.transfer_read %arg0[%c3, %c3], %cst {permutation_map = affine_map<(d0, d1)->(d0 + d1)>} : memref<?x?xf32>, vector<128xf32>381}382 383// -----384 385func.func @test_vector.transfer_read(%arg0: memref<?x?xf32>) {386 %c3 = arith.constant 3 : index387 %cst = arith.constant 3.0 : f32388 // expected-error@+1 {{requires a projected permutation_map (at most one dim or the zero constant can appear in each result)}}389 %0 = vector.transfer_read %arg0[%c3, %c3], %cst {permutation_map = affine_map<(d0, d1)->(d0 + 1)>} : memref<?x?xf32>, vector<128xf32>390}391 392// -----393 394func.func @test_vector.transfer_read(%arg0: memref<?x?xf32>) {395 %c3 = arith.constant 3 : index396 %cst = arith.constant 3.0 : f32397 // expected-error@+1 {{requires a projected permutation_map (at most one dim or the zero constant can appear in each result)}}398 %0 = vector.transfer_read %arg0[%c3, %c3], %cst {permutation_map = affine_map<(d0, d1)->(1)>} : memref<?x?xf32>, vector<128xf32>399}400 401// -----402 403func.func @test_vector.transfer_read(%arg0: memref<?x?x?xf32>) {404 %c3 = arith.constant 3 : index405 %cst = arith.constant 3.0 : f32406 // expected-error@+1 {{requires a permutation_map that is a permutation (found one dim used more than once)}}407 %0 = vector.transfer_read %arg0[%c3, %c3, %c3], %cst {permutation_map = affine_map<(d0, d1, d2)->(d0, d0)>} : memref<?x?x?xf32>, vector<3x7xf32>408}409 410// -----411 412func.func @test_vector.transfer_read(%arg0: memref<?x?x?xf32>) {413 %c1 = arith.constant 1 : i1414 %c3 = arith.constant 3 : index415 %cst = arith.constant 3.0 : f32416 // expected-note@+1 {{prior use here}}417 %mask = vector.broadcast %c1 : i1 to vector<3x8x7xi1>418 // expected-error@+1 {{expects different type than prior uses: 'vector<3x7xi1>' vs 'vector<3x8x7xi1>'}}419 %0 = vector.transfer_read %arg0[%c3, %c3, %c3], %cst, %mask {permutation_map = affine_map<(d0, d1, d2)->(d0, 0, d2)>} : memref<?x?x?xf32>, vector<3x8x7xf32>420}421 422// -----423 424func.func @test_vector.transfer_read(%arg0: memref<?x?xvector<4x3xf32>>) {425 %c3 = arith.constant 3 : index426 %f0 = arith.constant 0.0 : f32427 %vf0 = vector.broadcast %f0 : f32 to vector<4x3xf32>428 // expected-error@+1 {{requires source vector element and vector result ranks to match}}429 %0 = vector.transfer_read %arg0[%c3, %c3], %vf0 {permutation_map = affine_map<(d0, d1)->(d0, d1)>} : memref<?x?xvector<4x3xf32>>, vector<3xf32>430}431 432// -----433 434func.func @test_vector.transfer_read(%arg0: memref<?x?xvector<6xf32>>) {435 %c3 = arith.constant 3 : index436 %f0 = arith.constant 0.0 : f32437 %vf0 = vector.broadcast %f0 : f32 to vector<6xf32>438 // expected-error@+1 {{requires the bitwidth of the minor 1-D vector to be an integral multiple of the bitwidth of the minor 1-D vector of the source}}439 %0 = vector.transfer_read %arg0[%c3, %c3], %vf0 : memref<?x?xvector<6xf32>>, vector<3xf32>440}441 442// -----443 444func.func @test_vector.transfer_read(%arg0: memref<?x?xvector<2x3xf32>>) {445 %c3 = arith.constant 3 : index446 %f0 = arith.constant 0.0 : f32447 %vf0 = vector.broadcast %f0 : f32 to vector<2x3xf32>448 // expected-error@+1 {{ expects the in_bounds attr of same rank as permutation_map results: affine_map<(d0, d1) -> (d0, d1)>}}449 %0 = vector.transfer_read %arg0[%c3, %c3], %vf0 {in_bounds = [true], permutation_map = affine_map<(d0, d1)->(d0, d1)>} : memref<?x?xvector<2x3xf32>>, vector<1x1x2x3xf32>450}451 452// -----453 454func.func @test_vector.transfer_read(%arg0: memref<?x?xvector<2x3xf32>>) {455 %c3 = arith.constant 3 : index456 %f0 = arith.constant 0.0 : f32457 %vf0 = vector.broadcast %f0 : f32 to vector<2x3xf32>458 %mask = vector.broadcast %c1 : f32 to vector<2x3xi1>459 // expected-error@+1 {{does not support masks with vector element type}}460 %0 = vector.transfer_read %arg0[%c3, %c3], %vf0, %mask {permutation_map = affine_map<(d0, d1)->(d0, d1)>} : memref<?x?xvector<2x3xf32>>, vector<1x1x2x3xf32>461}462 463// -----464 465func.func @test_vector.transfer_read(%arg0: memref<?xindex>) -> vector<3x4xindex> {466 %c3 = arith.constant 3 : index467 // expected-error@+1 {{expected a custom permutation_map when rank(source) != rank(destination)}}468 %0 = vector.transfer_read %arg0[%c3], %c3 : memref<?xindex>, vector<3x4xindex>469 return %0 : vector<3x4xindex>470}471 472// -----473 474func.func @test_vector.transfer_write(%arg0: memref<?xvector<2xindex>>) {475 %c3 = arith.constant 3 : index476 // expected-error@+1 {{expected a custom permutation_map when rank(source) != rank(destination)}}477 %0 = vector.transfer_read %arg0[%c3], %c3 : memref<?xvector<2xindex>>, vector<2x3x4xindex>478 return %0 : vector<2x3x4xindex>479}480 481// -----482 483func.func @test_vector.transfer_write(%arg0: memref<?x?xf32>) {484 %c3 = arith.constant 3 : index485 %cst = arith.constant 3.0 : f32486 // expected-error@+1 {{requires two types}}487 vector.transfer_write %arg0, %arg0[%c3, %c3] : memref<?x?xf32>488}489 490// -----491 492func.func @test_vector.transfer_write(%arg0: memref<vector<4x3xf32>>) {493 %c3 = arith.constant 3 : index494 %f0 = arith.constant 0.0 : f32495 %vf0 = vector.broadcast %f0 : f32 to vector<4x3xf32>496 // expected-error@+1 {{ requires vector type}}497 vector.transfer_write %arg0, %arg0[%c3, %c3] : memref<vector<4x3xf32>>, vector<4x3xf32>498}499 500// -----501 502func.func @test_vector.transfer_write(%arg0: vector<4x3xf32>) {503 %c3 = arith.constant 3 : index504 %f0 = arith.constant 0.0 : f32505 %vf0 = vector.broadcast %f0 : f32 to vector<4x3xf32>506 // expected-error@+1 {{ requires memref or ranked tensor type}}507 vector.transfer_write %arg0, %arg0[%c3, %c3] : vector<4x3xf32>, f32508}509 510// -----511 512func.func @test_vector.transfer_write(%arg0: memref<?x?xf32>) {513 %c3 = arith.constant 3 : index514 %cst = arith.constant dense<3.0> : vector<128 x f32>515 // expected-error@+1 {{expected 5 operand types but had 4}}516 %0 = "vector.transfer_write"(%cst, %arg0, %c3, %c3, %c3) {permutation_map = affine_map<()->(0)>} : (vector<128xf32>, memref<?x?xf32>, index, index) -> ()517}518 519// -----520 521func.func @test_vector.transfer_write(%arg0: memref<?x?xf32>) {522 %c3 = arith.constant 3 : index523 %cst = arith.constant dense<3.0> : vector<128 x f32>524 // expected-error@+1 {{requires 2 indices}}525 vector.transfer_write %cst, %arg0[%c3, %c3, %c3] {permutation_map = affine_map<()->(0)>} : vector<128xf32>, memref<?x?xf32>526}527 528// -----529 530func.func @test_vector.transfer_write(%arg0: memref<?x?xf32>) {531 %c3 = arith.constant 3 : index532 %cst = arith.constant dense<3.0> : vector<128 x f32>533 // expected-error@+1 {{requires 2 indices}}534 vector.transfer_write %cst, %arg0[%c3] {permutation_map = affine_map<()->(0)>} : vector<128xf32>, memref<?x?xf32>535}536 537// -----538 539func.func @test_vector.transfer_write(%arg0: memref<?x?xf32>) {540 %c3 = arith.constant 3 : index541 %cst = arith.constant dense<3.0> : vector<128 x f32>542 // expected-error@+1 {{requires a permutation_map with input dims of the same rank as the source type}}543 vector.transfer_write %cst, %arg0[%c3, %c3] {permutation_map = affine_map<(d0)->(d0)>} : vector<128xf32>, memref<?x?xf32>544}545 546// -----547 548func.func @test_vector.transfer_write(%arg0: memref<?x?xf32>) {549 %c3 = arith.constant 3 : index550 %cst = arith.constant dense<3.0> : vector<128 x f32>551 // expected-error@+1 {{requires a permutation_map with result dims of the same rank as the vector type}}552 vector.transfer_write %cst, %arg0[%c3, %c3] {permutation_map = affine_map<(d0, d1)->(d0, d1)>} : vector<128xf32>, memref<?x?xf32>553}554 555// -----556 557func.func @test_vector.transfer_write(%arg0: memref<?x?xf32>) {558 %c3 = arith.constant 3 : index559 %cst = arith.constant dense<3.0> : vector<128 x f32>560 // expected-error@+1 {{requires a projected permutation_map (at most one dim or the zero constant can appear in each result)}}561 vector.transfer_write %cst, %arg0[%c3, %c3] {permutation_map = affine_map<(d0, d1)->(d0 + d1)>} : vector<128xf32>, memref<?x?xf32>562}563 564// -----565 566func.func @test_vector.transfer_write(%arg0: memref<?x?xf32>) {567 %c3 = arith.constant 3 : index568 %cst = arith.constant dense<3.0> : vector<128 x f32>569 // expected-error@+1 {{requires a projected permutation_map (at most one dim or the zero constant can appear in each result)}}570 vector.transfer_write %cst, %arg0[%c3, %c3] {permutation_map = affine_map<(d0, d1)->(d0 + 1)>} : vector<128xf32>, memref<?x?xf32>571}572 573// -----574 575func.func @test_vector.transfer_write(%arg0: memref<?x?xf32>) {576 %c3 = arith.constant 3 : index577 %cst = arith.constant dense<3.0> : vector<128 x f32>578 // expected-error@+1 {{requires a projected permutation_map (at most one dim or the zero constant can appear in each result)}}579 vector.transfer_write %cst, %arg0[%c3, %c3] {permutation_map = affine_map<(d0, d1)->(1)>} : vector<128xf32>, memref<?x?xf32>580}581 582// -----583 584func.func @test_vector.transfer_write(%arg0: memref<?x?x?xf32>) {585 %c3 = arith.constant 3 : index586 %cst = arith.constant dense<3.0> : vector<3 x 7 x f32>587 // expected-error@+1 {{requires a permutation_map that is a permutation (found one dim used more than once)}}588 vector.transfer_write %cst, %arg0[%c3, %c3, %c3] {permutation_map = affine_map<(d0, d1, d2)->(d0, d0)>} : vector<3x7xf32>, memref<?x?x?xf32>589}590 591// -----592 593func.func @test_vector.transfer_write(%arg0: memref<?xf32>, %arg1: vector<7xf32>) {594 %c3 = arith.constant 3 : index595 %cst = arith.constant 3.0 : f32596 // expected-error@+1 {{should not have broadcast dimensions}}597 vector.transfer_write %arg1, %arg0[%c3]598 {permutation_map = affine_map<(d0) -> (0)>}599 : vector<7xf32>, memref<?xf32>600}601 602// -----603 604func.func @test_vector.transfer_write(%arg0: memref<?xindex>, %arg1: vector<3x4xindex>) {605 %c3 = arith.constant 3 : index606 // expected-error@+1 {{expected a custom permutation_map when rank(source) != rank(destination)}}607 vector.transfer_write %arg1, %arg0[%c3, %c3] : vector<3x4xindex>, memref<?xindex>608}609 610// -----611 612func.func @test_vector.transfer_write(%arg0: memref<?xvector<2xindex>>, %arg1: vector<2x3x4xindex>) {613 %c3 = arith.constant 3 : index614 // expected-error@+1 {{expected a custom permutation_map when rank(source) != rank(destination)}}615 vector.transfer_write %arg1, %arg0[%c3, %c3] : vector<2x3x4xindex>, memref<?xvector<2xindex>>616}617 618// -----619 620func.func @insert_strided_slice(%a: vector<4x4xf32>, %b: vector<4x8x16xf32>) {621 // expected-error@+1 {{expected offsets of same size as destination vector rank}}622 %1 = vector.insert_strided_slice %a, %b {offsets = [100], strides = [1, 1]} : vector<4x4xf32> into vector<4x8x16xf32>623}624 625// -----626 627func.func @insert_strided_slice(%a: vector<4x4xf32>, %b: vector<4x8x16xf32>) {628 // expected-error@+1 {{expected strides of same size as source vector rank}}629 %1 = vector.insert_strided_slice %a, %b {offsets = [2, 2, 2], strides = [1]} : vector<4x4xf32> into vector<4x8x16xf32>630}631 632// -----633 634func.func @insert_strided_slice(%a: vector<4x4xf32>, %b: vector<4x8x16xf32>) {635 // expected-error@+1 {{expected source rank to be no greater than destination rank}}636 %1 = vector.insert_strided_slice %b, %a {offsets = [2, 2], strides = [1, 1, 1]} : vector<4x8x16xf32> into vector<4x4xf32>637}638 639// -----640 641func.func @insert_strided_slice(%a: vector<4x4xf32>, %b: vector<4x8x16xf32>) {642 // expected-error@+1 {{op expected offsets dimension 0 to be confined to [0, 4)}}643 %1 = vector.insert_strided_slice %a, %b {offsets = [100,100,100], strides = [1, 1]} : vector<4x4xf32> into vector<4x8x16xf32>644}645 646// -----647 648func.func @insert_strided_slice(%a: vector<4x4xf32>, %b: vector<4x8x16xf32>) {649 // expected-error@+1 {{op expected strides to be confined to [1, 2)}}650 %1 = vector.insert_strided_slice %a, %b {offsets = [2, 2, 2], strides = [100, 100]} : vector<4x4xf32> into vector<4x8x16xf32>651}652 653// -----654 655func.func @insert_strided_slice(%a: vector<4x4xf32>, %b: vector<4x8x16xf32>) {656 // expected-error@+1 {{op expected sum(offsets, source vector shape) dimension 1 to be confined to [1, 9)}}657 %1 = vector.insert_strided_slice %a, %b {offsets = [2, 7, 2], strides = [1, 1]} : vector<4x4xf32> into vector<4x8x16xf32>658}659 660// -----661 662func.func @insert_strided_slice_scalable(%a : vector<1x1x[2]xi32>, %b: vector<1x4x[4]xi32>) -> vector<1x4x[4]xi32> {663 // expected-error@+1 {{op expected size at idx=2 to match the corresponding base size from the input vector (2 vs 4)}}664 %0 = vector.insert_strided_slice %a, %b {offsets = [0, 3, 0], strides = [1, 1, 1]} : vector<1x1x[2]xi32> into vector<1x4x[4]xi32>665 return %0 : vector<1x4x[4]xi32>666}667 668// -----669 670func.func @insert_strided_slice_scalable(%a : vector<1x1x4xi32>, %b: vector<1x4x[4]xi32>) -> vector<1x4x[4]xi32> {671 // expected-error@+1 {{op mismatching scalable flags (at source vector idx=2)}}672 %0 = vector.insert_strided_slice %a, %b {offsets = [0, 3, 0], strides = [1, 1, 1]} : vector<1x1x4xi32> into vector<1x4x[4]xi32>673 return %0 : vector<1x4x[4]xi32>674}675 676// -----677 678func.func @extract_strided_slice(%arg0: vector<4x8x16xf32>) {679 // expected-error@+1 {{expected offsets, sizes and strides attributes of same size}}680 %1 = vector.extract_strided_slice %arg0 {offsets = [100], sizes = [2, 2], strides = [1, 1]} : vector<4x8x16xf32> to vector<2x2x16xf32>681}682 683// -----684 685func.func @extract_strided_slice(%arg0: vector<4x8x16xf32>) {686 // expected-error@+1 {{expected offsets attribute of rank no greater than vector rank}}687 %1 = vector.extract_strided_slice %arg0 {offsets = [2, 2, 2, 2], sizes = [2, 2, 2, 2], strides = [1, 1, 1, 1]} : vector<4x8x16xf32> to vector<2x2x16xf32>688}689 690// -----691 692func.func @extract_strided_slice(%arg0: vector<4x8x16xf32>) {693 // expected-error@+1 {{op expected offsets dimension 0 to be confined to [0, 4)}}694 %1 = vector.extract_strided_slice %arg0 {offsets = [100], sizes = [100], strides = [100]} : vector<4x8x16xf32> to vector<100x8x16xf32>695}696 697// -----698 699func.func @extract_strided_slice(%arg0: vector<4x8x16xf32>) {700 // expected-error@+1 {{op expected sizes dimension 0 to be confined to [1, 5)}}701 %1 = vector.extract_strided_slice %arg0 {offsets = [2], sizes = [100], strides = [100]} : vector<4x8x16xf32> to vector<100x8x16xf32>702}703 704// -----705 706func.func @extract_strided_slice(%arg0: vector<4x8x16xf32>) {707 // expected-error@+1 {{op expected strides to be confined to [1, 2)}}708 %1 = vector.extract_strided_slice %arg0 {offsets = [2], sizes = [1], strides = [100]} : vector<4x8x16xf32> to vector<1x8x16xf32>709}710 711// -----712 713func.func @extract_strided_slice_scalable(%arg0 : vector<1x4x[4]xi32>) -> vector<1x1x[2]xi32> {714 // expected-error@+1 {{op expected size at idx=2 to match the corresponding base size from the input vector (2 vs 4)}}715 %1 = vector.extract_strided_slice %arg0 {offsets = [0, 3, 0], sizes = [1, 1, 2], strides = [1, 1, 1]} : vector<1x4x[4]xi32> to vector<1x1x[2]xi32>716 return %1 : vector<1x1x[2]xi32>717 }718 719// -----720 721func.func @extract_strided_slice(%arg0: vector<4x8x16xf32>) {722 // expected-error@+1 {{op expected strides to be confined to [1, 2)}}723 %1 = vector.extract_strided_slice %arg0 {offsets = [2], sizes = [1], strides = [100]} : vector<4x8x16xf32> to vector<1x8x16xf32>724}725 726// -----727 728func.func @extract_strided_slice(%arg0: vector<4x8x16xf32>) {729 // expected-error@+1 {{op expected sum(offsets, sizes) dimension 0 to be confined to [1, 5)}}730 %1 = vector.extract_strided_slice %arg0 {offsets = [2], sizes = [3], strides = [1]} : vector<4x8x16xf32> to vector<3x8x16xf32>731}732 733// -----734 735func.func @extract_strided_slice(%arg0: vector<4x8x16xf32>) {736 // expected-error@+1 {{op expected result type to be 'vector<2x8x16xf32>'}}737 %1 = vector.extract_strided_slice %arg0 {offsets = [2], sizes = [2], strides = [1]} : vector<4x8x16xf32> to vector<3x1xf32>738}739 740// -----741 742#contraction_accesses = [743 affine_map<(b0, f0, f1, c0, c1) -> (c0, b0, c1, f0)>,744 affine_map<(b0, f0, f1, c0, c1) -> (b0, c1, c0, f1)>,745 affine_map<(b0, f0, f1, c0, c1) -> (b0, f0, f1)>,746 affine_map<(b0, f0, f1, c0, c1) -> (b0, f0, f1)>747]748#contraction_trait = {749 indexing_maps = #contraction_accesses,750 iterator_types = ["parallel", "parallel", "parallel", "reduction", "reduction"]751}752func.func @contraction(%arg0: vector<7x8x16x15xf32>, %arg1: vector<8x16x7x5xf32>,753 %arg2: vector<8x15x5xf32>, %arg3 : vector<8x15x8x5xf32>,754 %arg4 : index) {755 // expected-error@+1 {{expected an indexing map for each vector operand}}756 %0 = vector.contract #contraction_trait %arg0, %arg1, %arg2757 : vector<7x8x16x15xf32>, vector<8x16x7x5xf32> into vector<8x15x5xf32>758}759 760// -----761 762#contraction_accesses = [763 affine_map<(b0, f0, f1, c0, c1) -> (c0, c0, c1, f0)>,764 affine_map<(b0, f0, f1, c0, c1) -> (b0, c1, c0, f1)>,765 affine_map<(b0, f0, f1, c0, c1) -> (b0, f0, f1)>766]767#contraction_trait = {768 indexing_maps = #contraction_accesses,769 iterator_types = ["parallel", "parallel", "parallel", "reduction", "reduction"]770}771func.func @contraction(%arg0: vector<7x8x16x15xf32>, %arg1: vector<8x16x7x5xf32>,772 %arg2: vector<8x15x5xf32>, %arg3 : vector<8x15x8x5xf32>,773 %arg4 : index) {774 // expected-error@+1 {{expected indexing map 0 to be a projected permutation of its inputs}}775 %0 = vector.contract #contraction_trait %arg0, %arg1, %arg2776 : vector<7x8x16x15xf32>, vector<8x16x7x5xf32> into vector<8x15x5xf32>777}778 779// -----780 781#contraction_accesses = [782 affine_map<(b0, f0, f1, c0, c1) -> (c0, b0, c1, f0)>,783 affine_map<(b0, f0, f1, c0, c1)[s0] -> (b0, s0, c0, f1)>,784 affine_map<(b0, f0, f1, c0, c1) -> (b0, f0, f1)>785]786#contraction_trait = {787 indexing_maps = #contraction_accesses,788 iterator_types = ["parallel", "parallel", "parallel", "reduction", "reduction"]789}790func.func @contraction(%arg0: vector<7x8x16x15xf32>, %arg1: vector<8x16x7x5xf32>,791 %arg2: vector<8x15x5xf32>, %arg3 : vector<8x15x8x5xf32>,792 %arg4 : index) {793 // expected-error@+1 {{op expected indexing map 1 to have no symbols}}794 %0 = vector.contract #contraction_trait %arg0, %arg1, %arg2795 : vector<7x8x16x15xf32>, vector<8x16x7x5xf32> into vector<8x15x5xf32>796}797 798// -----799 800#contraction_accesses = [801 affine_map<(b0, f0, f1, c0, c1) -> (c0, b0, c1, f0)>,802 affine_map<(b0, f0, f1, c0, c1) -> (b0, c1, c0, f1)>,803 affine_map<(b0, f0, f1, c1) -> (b0, f0, f1)>804]805#contraction_trait = {806 indexing_maps = #contraction_accesses,807 iterator_types = ["parallel", "parallel", "parallel", "reduction", "reduction"]808}809func.func @contraction(%arg0: vector<7x8x16x15xf32>, %arg1: vector<8x16x7x5xf32>,810 %arg2: vector<8x15x5xf32>, %arg3 : vector<8x15x8x5xf32>,811 %arg4 : index) {812 // expected-error@+1 {{expected indexing map 2 to have 5 number of inputs}}813 %0 = vector.contract #contraction_trait %arg0, %arg1, %arg2814 : vector<7x8x16x15xf32>, vector<8x16x7x5xf32> into vector<8x15x5xf32>815}816 817// -----818 819#contraction_accesses = [820 affine_map<(b0, f0, f1, c0, c1) -> (c0, b0, c1, f0)>,821 affine_map<(b0, f0, f1, c0, c1) -> (b0, c1, f1)>,822 affine_map<(b0, f0, f1, c0, c1) -> (b0, f0, f1)>823]824#contraction_trait = {825 indexing_maps = #contraction_accesses,826 iterator_types = ["parallel", "parallel", "parallel", "reduction", "reduction"]827}828func.func @contraction(%arg0: vector<7x8x16x15xf32>, %arg1: vector<8x16x7x5xf32>,829 %arg2: vector<8x15x5xf32>, %arg3 : vector<8x15x8x5xf32>,830 %arg4 : index) {831 // expected-error@+1 {{expected indexing map 1 to have 4 number of outputs}}832 %0 = vector.contract #contraction_trait %arg0, %arg1, %arg2833 : vector<7x8x16x15xf32>, vector<8x16x7x5xf32> into vector<8x15x5xf32>834}835 836// -----837 838#contraction_accesses = [839 affine_map<(b0, f0, f1, b1, b2) -> (b1, b0, b2, f0)>,840 affine_map<(b0, f0, f1, b1, b2) -> (b0, b2, b1, f1)>,841 affine_map<(b0, f0, f1, b1, b2) -> (b0, f0, f1)>842]843#contraction_trait = {844 indexing_maps = #contraction_accesses,845 iterator_types = ["parallel", "parallel", "parallel", "parallel", "parallel"]846}847func.func @contraction(%arg0: vector<7x8x16x15xf32>, %arg1: vector<8x16x7x5xf32>,848 %arg2: vector<8x15x5xf32>, %arg3 : vector<8x15x8x5xf32>,849 %arg4 : index) {850 // expected-error@+1 {{op expected at least one contracting dimension pair}}851 %0 = vector.contract #contraction_trait %arg0, %arg1, %arg2852 : vector<7x8x16x15xf32>, vector<8x16x7x5xf32> into vector<8x15x5xf32>853}854 855// -----856 857#contraction_accesses = [858 affine_map<(b0, f0, f1, c0, c1) -> (c1, b0, c0, f0)>,859 affine_map<(b0, f0, f1, c0, c1) -> (b0, c1, c0, f1)>,860 affine_map<(b0, f0, f1, c0, c1) -> (b0, f0, f1)>861]862#contraction_trait = {863 indexing_maps = #contraction_accesses,864 iterator_types = ["parallel", "parallel", "parallel", "reduction", "reduction"]865}866func.func @contraction(%arg0: vector<7x8x16x15xf32>, %arg1: vector<8x16x7x5xf32>,867 %arg2: vector<8x15x5xf32>, %arg3 : vector<8x15x8x5xf32>,868 %arg4 : index) {869 // expected-error@+1 {{invalid contracting dimension map}}870 %0 = vector.contract #contraction_trait %arg0, %arg1, %arg2871 : vector<7x8x16x15xf32>, vector<8x16x7x5xf32> into vector<8x15x5xf32>872}873 874// -----875 876#contraction_accesses = [877 affine_map<(b0, f0, f1, c0, c1) -> (c0, b0, c1, f0)>,878 affine_map<(b0, f0, f1, c0, c1) -> (f1, c1, c0, b0)>,879 affine_map<(b0, f0, f1, c0, c1) -> (b0, f0, f1)>880]881#contraction_trait = {882 indexing_maps = #contraction_accesses,883 iterator_types = ["parallel", "parallel", "parallel", "reduction", "reduction"]884}885func.func @contraction(%arg0: vector<7x8x16x15xf32>, %arg1: vector<8x16x7x5xf32>,886 %arg2: vector<8x15x5xf32>, %arg3 : vector<8x15x8x5xf32>,887 %arg4 : index) {888 // expected-error@+1 {{invalid batch dimension map}}889 %0 = vector.contract #contraction_trait %arg0, %arg1, %arg2890 : vector<7x8x16x15xf32>, vector<8x16x7x5xf32> into vector<8x15x5xf32>891}892 893// -----894 895#contraction_accesses = [896 affine_map<(b0, f0, f1, c0, c1) -> (c0, b0, c1, f0)>,897 affine_map<(b0, f0, f1, c0, c1) -> (b0, c1, c0, f1)>,898 affine_map<(b0, f0, f1, c0, c1) -> (b0, f0, f1)>899]900#contraction_trait = {901 indexing_maps = #contraction_accesses,902 iterator_types = ["parallel", "parallel", "parallel", "reduction", "reduction"]903}904func.func @contraction(%arg0: vector<7x8x16x15xf32>, %arg1: vector<8x16x7x5xf32>,905 %arg2: vector<88x15x5xf32>, %arg3 : vector<8x15x8x5xf32>,906 %arg4 : index) {907 // expected-error@+1 {{invalid accumulator/result vector shape}}908 %0 = vector.contract #contraction_trait %arg0, %arg1, %arg2909 : vector<7x8x16x15xf32>, vector<8x16x7x5xf32> into vector<88x15x5xf32>910}911 912// -----913 914#contraction_accesses = [915 affine_map<(b0, f0, f1, c0, c1) -> (c0, b0, c1, f0)>,916 affine_map<(b0, f0, f1, c0, c1) -> (b0, c1, c0, f1)>,917 affine_map<(b0, f0, f1, c0, c1) -> (b0, f0, f1)>918]919#contraction_trait = {920 indexing_maps = #contraction_accesses,921 iterator_types = ["parallel", "parallel", "parallel", "reduction", "reduction"]922}923func.func @contraction(%arg0: vector<7x8x16x15xf32>, %arg1: vector<8x16x7x5xf32>,924 %arg2: vector<8x15x5xf32>, %arg3 : vector<8x15x8x5xf32>,925 %arg4 : index) {926 %lhs_mask = vector.constant_mask [7, 8, 16, 15] : vector<7x8x16x15xi1>927 %rhs_mask = vector.constant_mask [8, 16, 7, 5] : vector<8x16x7x5xi1>928 // expected-error@+1 {{expected zero or exactly 2 vector mask operands}}929 %0 = vector.contract #contraction_trait %arg0, %arg1, %arg2, %lhs_mask930 : vector<7x8x16x15xf32>, vector<8x16x7x5xf32> into vector<8x15x5xf32>931}932 933// -----934 935#contraction_accesses = [936 affine_map<(i, j, k) -> (i, k)>,937 affine_map<(i, j, k) -> (k, j)>,938 affine_map<(i, j, k) -> (i, j)>939 ]940#contraction_trait = {941 indexing_maps = #contraction_accesses,942 iterator_types = ["parallel", "parallel", "reduction"]943 }944func.func @contraction(%arg0: vector<4x3xi32>,945 %arg1: vector<3x7xf32>,946 %arg2: vector<4x7xf32>) -> vector<4x7xf32> {947 // expected-error@+1 {{'vector.contract' op failed to verify that lhs and rhs have same element type}}948 %0 = vector.contract #contraction_trait %arg0, %arg1, %arg2949 : vector<4x3xi32>, vector<3x7xf32> into vector<4x7xf32>950}951 952// -----953 954#contraction_accesses = [955 affine_map<(m, n, k) -> (m, k)>,956 affine_map<(m, n, k) -> (k, n)>,957 affine_map<(m, n, k) -> (n, m)>958]959#contraction_trait = {960 indexing_maps = #contraction_accesses,961 iterator_types = ["parallel", "parallel", "reduction"]962}963func.func @contraction(%arg0: vector<2x1xf32>, %arg1: vector<1x3xf32>, %arg2: vector<2x3xf32>)964-> vector<3x2xf32>965{966// expected-error@+1 {{invalid accumulator/result vector shape, expected: 'vector<3x2xf32>'}}967 %0 = vector.contract #contraction_trait %arg0, %arg1, %arg2968 : vector<2x1xf32>, vector<1x3xf32> into vector<2x3xf32>969 return %0 : vector<2x3xf32>970}971 972// -----973 974func.func @contract_with_dim_unused_by_lhs_and_rhs(%arg0 : vector<1x2xi32>, %arg1 : vector<2xi32>, %arg2 : vector<1xi32>) -> vector<1xi32> {975// expected-error@+1 {{'vector.contract' op expected all dimensions to be either a LHS or a RHS dimension}}976 %result = vector.contract {977 indexing_maps = [978 affine_map<(d0, d1, d2) -> (d0, d2)>,979 affine_map<(d0, d1, d2) -> (d2)>,980 affine_map<(d0, d1, d2) -> (d1)>981 ],982 iterator_types = ["reduction", "parallel", "reduction"],983 kind = #vector.kind<add>} %arg0, %arg1, %arg2 : vector<1x2xi32>, vector<2xi32> into vector<1xi32>984 return %result : vector<1xi32>985}986 987// -----988 989func.func @contract_missing_iterator_types(%arg0: vector<1x2xi32>, %arg1: vector<2xi32>, %arg2: vector<1xi32>) -> vector<1xi32> {990 // expected-error@+1 {{'vector.contract' expected "iterator_types" array attribute}}991 %0 = vector.contract {} %arg0, %arg1, %arg2 : vector<1x2xi32>, vector<2xi32> into vector<1xi32>992 return %0 : vector<1xi32>993}994 995// -----996 997func.func @create_mask_0d_no_operands() {998 %c1 = arith.constant 1 : index999 // expected-error@+1 {{must specify exactly one operand for 0-D create_mask}}1000 %0 = vector.create_mask : vector<i1>1001}1002 1003// -----1004 1005func.func @create_mask_0d_many_operands() {1006 %c1 = arith.constant 1 : index1007 %c2 = arith.constant 2 : index1008 %c3 = arith.constant 3 : index1009 // expected-error@+1 {{must specify exactly one operand for 0-D create_mask}}1010 %0 = vector.create_mask %c1, %c2, %c3 : vector<i1>1011}1012 1013// -----1014 1015func.func @create_mask() {1016 %c2 = arith.constant 2 : index1017 %c3 = arith.constant 3 : index1018 // expected-error@+1 {{must specify an operand for each result vector dimension}}1019 %0 = vector.create_mask %c3, %c2 : vector<4x3x7xi1>1020}1021 1022 1023// -----1024 1025func.func @constant_mask_0d_no_attr() {1026 // expected-error@+1 {{array attr must have length 1 for 0-D vectors}}1027 %0 = vector.constant_mask [] : vector<i1>1028}1029 1030// -----1031 1032func.func @constant_mask_0d_bad_attr() {1033 // expected-error@+1 {{mask dim size must be either 0 or 1 for 0-D vectors}}1034 %0 = vector.constant_mask [2] : vector<i1>1035}1036 1037// -----1038 1039func.func @constant_mask() {1040 // expected-error@+1 {{must specify array attr of size equal vector result rank}}1041 %0 = vector.constant_mask [3, 2, 7] : vector<4x3xi1>1042}1043 1044// -----1045 1046func.func @constant_mask_out_of_bounds() {1047 // expected-error@+1 {{array attr of size out of bounds of vector result dimension size}}1048 %0 = vector.constant_mask [-1, 2] : vector<4x3xi1>1049}1050 1051// -----1052 1053func.func @constant_mask_out_of_bounds() {1054 // expected-error@+1 {{array attr of size out of bounds of vector result dimension size}}1055 %0 = vector.constant_mask [3, 4] : vector<4x3xi1>1056}1057 1058// -----1059 1060func.func @constant_mask_with_zero_mask_dim_size() {1061 // expected-error@+1 {{expected all mask dim sizes to be zeros, as a result of conjunction with zero mask dim}}1062 %0 = vector.constant_mask [0, 2] : vector<4x3xi1>1063}1064 1065// -----1066 1067func.func @constant_mask_scalable_non_zero_dim_size() {1068 // expected-error@+1 {{only supports 'none set' or 'all set' scalable dimensions}}1069 %0 = vector.constant_mask [2] : vector<[8]xi1>1070}1071 1072// -----1073 1074func.func @print_no_result(%arg0 : f32) -> i32 {1075 // expected-error@+1 {{cannot name an operation with no results}}1076 %0 = vector.print %arg0 : f321077}1078 1079// -----1080 1081func.func private @print_needs_vector(%arg0: tensor<8xf32>) {1082 // expected-error@+1 {{op operand #0 must be , but got 'tensor<8xf32>'}}1083 vector.print %arg0 : tensor<8xf32>1084 return1085}1086 1087// -----1088 1089func.func @cannot_print_string_with_punctuation_set() {1090 // expected-error@+1 {{`source` or `punctuation` are not set when printing strings}}1091 vector.print str "Whoops!" punctuation <comma>1092 return1093}1094 1095// -----1096 1097func.func @cannot_print_string_with_source_set(%vec: vector<[4]xf32>) {1098 // expected-error@+1 {{`source` or `punctuation` are not set when printing strings}}1099 vector.print %vec: vector<[4]xf32> str "Yay!"1100 return1101}1102 1103// -----1104 1105 1106func.func @shape_cast_wrong_element_type(%arg0 : vector<5x1x3x2xf32>) {1107 // expected-error@+1 {{'vector.shape_cast' op has different source and result element types}}1108 %0 = vector.shape_cast %arg0 : vector<5x1x3x2xf32> to vector<15x2xi32>1109}1110 1111// -----1112 1113func.func @shape_cast_wrong_num_elements(%arg0 : vector<5x1x3x2xf32>) {1114 // expected-error@+1 {{'vector.shape_cast' op has different number of elements at source (30) and result (20)}}1115 %0 = vector.shape_cast %arg0 : vector<5x1x3x2xf32> to vector<10x2xf32>1116}1117 1118// -----1119 1120func.func @shape_cast_scalability_flag_is_dropped(%arg0 : vector<15x[2]xf32>) {1121 // expected-error@+1 {{different number of scalable dims at source (1) and result (0)}}1122 %0 = vector.shape_cast %arg0 : vector<15x[2]xf32> to vector<30xf32>1123}1124 1125// -----1126 1127func.func @shape_cast_scalability_flag_is_dropped(%arg0 : vector<2x[15]x[2]xf32>) {1128 // expected-error@+1 {{different number of scalable dims at source (2) and result (1)}}1129 %0 = vector.shape_cast %arg0 : vector<2x[15]x[2]xf32> to vector<30x[2]xf32>1130}1131 1132// -----1133 1134func.func @bitcast_not_vector(%arg0 : vector<5x1x3x2xf32>) {1135 // expected-error@+1 {{'vector.bitcast' invalid kind of type specified: expected builtin.vector, but found 'f32'}}1136 %0 = vector.bitcast %arg0 : vector<5x1x3x2xf32> to f321137}1138 1139// -----1140 1141func.func @bitcast_rank_mismatch_to_0d(%arg0 : vector<1xf32>) {1142 // expected-error@+1 {{op failed to verify that all of {source, result} have same rank}}1143 %0 = vector.bitcast %arg0 : vector<1xf32> to vector<f32>1144}1145 1146// -----1147 1148func.func @bitcast_rank_mismatch_from_0d(%arg0 : vector<f32>) {1149 // expected-error@+1 {{op failed to verify that all of {source, result} have same rank}}1150 %0 = vector.bitcast %arg0 : vector<f32> to vector<1xf32>1151}1152 1153// -----1154 1155func.func @bitcast_rank_mismatch(%arg0 : vector<5x1x3x2xf32>) {1156 // expected-error@+1 {{op failed to verify that all of {source, result} have same rank}}1157 %0 = vector.bitcast %arg0 : vector<5x1x3x2xf32> to vector<5x3x2xf32>1158}1159 1160// -----1161 1162func.func @bitcast_shape_mismatch(%arg0 : vector<5x1x3x2xf32>) {1163 // expected-error@+1 {{op dimension size mismatch}}1164 %0 = vector.bitcast %arg0 : vector<5x1x3x2xf32> to vector<5x2x3x2xf32>1165}1166 1167// -----1168 1169func.func @bitcast_sizemismatch(%arg0 : vector<5x1x3x2xf32>) {1170 // expected-error@+1 {{op source/result bitwidth of the minor 1-D vectors must be equal}}1171 %0 = vector.bitcast %arg0 : vector<5x1x3x2xf32> to vector<5x1x3x3xf16>1172}1173 1174// -----1175 1176func.func @reduce_unknown_kind(%arg0: vector<16xf32>) -> f32 {1177 // expected-error@+2 {{custom op 'vector.reduction' failed to parse Vector_CombiningKindAttr parameter 'value' which is to be a `::mlir::vector::CombiningKind`}}1178 // expected-error@+1 {{custom op 'vector.reduction' expected ::mlir::vector::CombiningKind to be one of: }}1179 %0 = vector.reduction <joho>, %arg0 : vector<16xf32> into f321180}1181 1182// -----1183 1184func.func @reduce_elt_type_mismatch(%arg0: vector<16xf32>) -> i32 {1185 // expected-error@+1 {{'vector.reduction' op failed to verify that source operand and result have same element type}}1186 %0 = vector.reduction <add>, %arg0 : vector<16xf32> into i321187}1188 1189// -----1190 1191func.func @reduce_unsupported_attr(%arg0: vector<16xf32>) -> i32 {1192 // expected-error@+1 {{expected '<'}}1193 %0 = vector.reduction 1234, %arg0 : vector<16xf32> into i321194}1195 1196// -----1197 1198func.func @reduce_unsupported_third_argument(%arg0: vector<16xf32>, %arg1: f32) -> f32 {1199 // expected-error@+1 {{expected ':'}}1200 %0 = vector.reduction <add>, %arg0, %arg1, %arg1 : vector<16xf32> into f321201}1202 1203// -----1204 1205func.func @reduce_unsupported_rank(%arg0: vector<4x16xf32>) -> f32 {1206 // expected-error@+1 {{'vector.reduction' op unsupported reduction rank: 2}}1207 %0 = vector.reduction <add>, %arg0 : vector<4x16xf32> into f321208}1209 1210// -----1211 1212func.func @multi_reduce_invalid_type(%arg0: vector<4x16xf32>, %acc: vector<16xf32>) -> f32 {1213 // expected-error@+1 {{'vector.multi_reduction' op destination type 'vector<16xf32>' is incompatible with source type 'vector<4x16xf32>'}}1214 %0 = vector.multi_reduction <mul>, %arg0, %acc [1] : vector<4x16xf32> to vector<16xf32>1215}1216 1217// -----1218 1219func.func @transpose_rank_mismatch_0d(%arg0: vector<f32>) {1220 // expected-error@+1 {{'vector.transpose' op vector result rank mismatch: 1}}1221 %0 = vector.transpose %arg0, [] : vector<f32> to vector<100xf32>1222}1223 1224// -----1225 1226func.func @transpose_rank_mismatch(%arg0: vector<4x16x11xf32>) {1227 // expected-error@+1 {{'vector.transpose' op vector result rank mismatch: 1}}1228 %0 = vector.transpose %arg0, [2, 1, 0] : vector<4x16x11xf32> to vector<100xf32>1229}1230 1231// -----1232 1233func.func @transpose_length_mismatch_0d(%arg0: vector<f32>) {1234 // expected-error@+1 {{'vector.transpose' op transposition length mismatch: 1}}1235 %0 = vector.transpose %arg0, [1] : vector<f32> to vector<f32>1236}1237 1238// -----1239 1240func.func @transpose_length_mismatch(%arg0: vector<4x4xf32>) {1241 // expected-error@+1 {{'vector.transpose' op transposition length mismatch: 3}}1242 %0 = vector.transpose %arg0, [2, 0, 1] : vector<4x4xf32> to vector<4x4xf32>1243}1244 1245// -----1246 1247func.func @transpose_index_oob(%arg0: vector<4x4xf32>) {1248 // expected-error@+1 {{'vector.transpose' op transposition index out of range: 2}}1249 %0 = vector.transpose %arg0, [2, 0] : vector<4x4xf32> to vector<4x4xf32>1250}1251 1252// -----1253 1254func.func @transpose_index_dup(%arg0: vector<4x4xf32>) {1255 // expected-error@+1 {{'vector.transpose' op duplicate position index: 0}}1256 %0 = vector.transpose %arg0, [0, 0] : vector<4x4xf32> to vector<4x4xf32>1257}1258 1259// -----1260 1261func.func @transpose_dim_size_mismatch(%arg0: vector<11x7x3x2xi32>) {1262 // expected-error@+1 {{'vector.transpose' op dimension size mismatch at: 0}}1263 %0 = vector.transpose %arg0, [3, 0, 1, 2] : vector<11x7x3x2xi32> to vector<2x3x7x11xi32>1264}1265 1266// -----1267 1268func.func @type_cast_layout(%arg0: memref<4x3xf32, affine_map<(d0, d1)[s0, s1, s2] -> (d0 * s0 + d1 * s1 + s2)>>) {1269 // expected-error@+1 {{expects operand to be a memref with identity layout}}1270 %0 = vector.type_cast %arg0: memref<4x3xf32, affine_map<(d0, d1)[s0, s1, s2] -> (d0 * s0 + d1 * s1 + s2)>> to memref<vector<4x3xf32>>1271}1272 1273// -----1274 1275func.func @store_unsupported_layout(%memref : memref<200x100xf32, affine_map<(d0, d1) -> (200*d0 + 2*d1)>>,1276 %i : index, %j : index, %value : vector<8xf32>) {1277 // expected-error@+1 {{'vector.store' op most minor memref dim must have unit stride}}1278 vector.store %value, %memref[%i, %j] : memref<200x100xf32, affine_map<(d0, d1) -> (200*d0 + 2*d1)>>,1279 vector<8xf32>1280 return1281}1282 1283// -----1284 1285func.func @vector_memref_mismatch(%memref : memref<200x100xvector<4xf32>>, %i : index,1286 %j : index, %value : vector<8xf32>) {1287 // expected-error@+1 {{'vector.store' op base memref and valueToStore vector types should match}}1288 vector.store %value, %memref[%i, %j] : memref<200x100xvector<4xf32>>, vector<8xf32>1289}1290 1291// -----1292 1293func.func @store_base_type_mismatch(%base : memref<?xf64>, %value : vector<16xf32>) {1294 %c0 = arith.constant 0 : index1295 // expected-error@+1 {{'vector.store' op base and valueToStore element type should match}}1296 vector.store %value, %base[%c0] : memref<?xf64>, vector<16xf32>1297}1298 1299// -----1300 1301func.func @store_memref_index_mismatch(%base : memref<?xf32>, %value : vector<16xf32>) {1302 // expected-error@+1 {{'vector.store' op requires 1 indices}}1303 vector.store %value, %base[] : memref<?xf32>, vector<16xf32>1304}1305 1306// -----1307 1308//===----------------------------------------------------------------------===//1309// vector.maskedload1310//===----------------------------------------------------------------------===//1311 1312func.func @maskedload_nonpositive_alignment(%base: memref<4xi32>, %mask: vector<32xi1>, %pass: vector<1xi32>, %index: index) {1313 // expected-error@below {{'vector.maskedload' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive and whose value is a power of two > 0}}1314 %val = vector.maskedload %base[%index], %mask, %pass { alignment = 0 } : memref<4xi32>, vector<32xi1>, vector<1xi32> into vector<1xi32>1315 return1316}1317 1318// -----1319 1320func.func @maskedload_non_power_of_2_alignment(%base: memref<4xi32>, %mask: vector<32xi1>, %pass: vector<1xi32>, %index: index) {1321 // expected-error@below {{'vector.maskedload' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive and whose value is a power of two > 0}}1322 %val = vector.maskedload %base[%index], %mask, %pass { alignment = 3 } : memref<4xi32>, vector<32xi1>, vector<1xi32> into vector<1xi32>1323 return1324}1325 1326// -----1327 1328func.func @maskedload_base_type_mismatch(%base: memref<?xf64>, %mask: vector<16xi1>, %pass: vector<16xf32>) {1329 %c0 = arith.constant 0 : index1330 // expected-error@+1 {{'vector.maskedload' op base and result element type should match}}1331 %0 = vector.maskedload %base[%c0], %mask, %pass : memref<?xf64>, vector<16xi1>, vector<16xf32> into vector<16xf32>1332}1333 1334// -----1335 1336func.func @maskedload_dim_mask_mismatch(%base: memref<?xf32>, %mask: vector<15xi1>, %pass: vector<16xf32>) {1337 %c0 = arith.constant 0 : index1338 // expected-error@+1 {{'vector.maskedload' op expected result shape to match mask shape}}1339 %0 = vector.maskedload %base[%c0], %mask, %pass : memref<?xf32>, vector<15xi1>, vector<16xf32> into vector<16xf32>1340}1341 1342// -----1343 1344func.func @maskedload_pass_thru_type_mask_mismatch(%base: memref<?xf32>, %mask: vector<16xi1>, %pass: vector<16xi32>) {1345 %c0 = arith.constant 0 : index1346 // expected-error@+1 {{'vector.maskedload' op expected pass_thru of same type as result type}}1347 %0 = vector.maskedload %base[%c0], %mask, %pass : memref<?xf32>, vector<16xi1>, vector<16xi32> into vector<16xf32>1348}1349 1350// -----1351 1352func.func @maskedload_memref_mismatch(%base: memref<?xf32>, %mask: vector<16xi1>, %pass: vector<16xf32>) {1353 // expected-error@+1 {{'vector.maskedload' op requires 1 indices}}1354 %0 = vector.maskedload %base[], %mask, %pass : memref<?xf32>, vector<16xi1>, vector<16xf32> into vector<16xf32>1355}1356 1357// -----1358 1359//===----------------------------------------------------------------------===//1360// vector.maskedstore1361//===----------------------------------------------------------------------===//1362 1363func.func @maskedstore_nonpositive_alignment(%base: memref<4xi32>, %mask: vector<32xi1>, %value: vector<1xi32>, %index: index) {1364 // expected-error@below {{'vector.maskedstore' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive and whose value is a power of two > 0}}1365 vector.maskedstore %base[%index], %mask, %value { alignment = 0 } : memref<4xi32>, vector<32xi1>, vector<1xi32> into vector<1xi32>1366 return1367}1368 1369// -----1370 1371func.func @maskedstore_non_power_of_2_alignment(%base: memref<4xi32>, %mask: vector<32xi1>, %value: vector<1xi32>, %index: index) {1372 // expected-error@below {{'vector.maskedstore' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive and whose value is a power of two > 0}}1373 vector.maskedstore %base[%index], %mask, %value { alignment = 3 } : memref<4xi32>, vector<32xi1>, vector<1xi32> into vector<1xi32>1374 return1375}1376 1377// -----1378 1379func.func @maskedstore_base_type_mismatch(%base: memref<?xf64>, %mask: vector<16xi1>, %value: vector<16xf32>) {1380 %c0 = arith.constant 0 : index1381 // expected-error@+1 {{'vector.maskedstore' op base and valueToStore element type should match}}1382 vector.maskedstore %base[%c0], %mask, %value : memref<?xf64>, vector<16xi1>, vector<16xf32>1383}1384 1385// -----1386 1387func.func @maskedstore_dim_mask_mismatch(%base: memref<?xf32>, %mask: vector<15xi1>, %value: vector<16xf32>) {1388 %c0 = arith.constant 0 : index1389 // expected-error@+1 {{'vector.maskedstore' op expected valueToStore shape to match mask shape}}1390 vector.maskedstore %base[%c0], %mask, %value : memref<?xf32>, vector<15xi1>, vector<16xf32>1391}1392 1393// -----1394 1395func.func @maskedstore_memref_mismatch(%base: memref<?xf32>, %mask: vector<16xi1>, %value: vector<16xf32>) {1396 %c0 = arith.constant 0 : index1397 // expected-error@+1 {{'vector.maskedstore' op requires 1 indices}}1398 vector.maskedstore %base[%c0, %c0], %mask, %value : memref<?xf32>, vector<16xi1>, vector<16xf32>1399}1400 1401// -----1402 1403func.func @gather_from_vector(%base: vector<16xf32>, %indices: vector<16xi32>,1404 %mask: vector<16xi1>, %pass_thru: vector<16xf32>) {1405 %c0 = arith.constant 0 : index1406 // expected-error@+1 {{'vector.gather' op operand #0 must be Tensor or MemRef of any type values, but got 'vector<16xf32>'}}1407 %0 = vector.gather %base[%c0][%indices], %mask, %pass_thru1408 : vector<16xf32>, vector<16xi32>, vector<16xi1>, vector<16xf32> into vector<16xf32>1409}1410 1411// -----1412 1413func.func @gather_base_type_mismatch(%base: memref<?xf64>, %indices: vector<16xi32>,1414 %mask: vector<16xi1>, %pass_thru: vector<16xf32>) {1415 %c0 = arith.constant 0 : index1416 // expected-error@+1 {{'vector.gather' op base and result element type should match}}1417 %0 = vector.gather %base[%c0][%indices], %mask, %pass_thru1418 : memref<?xf64>, vector<16xi32>, vector<16xi1>, vector<16xf32> into vector<16xf32>1419}1420 1421// -----1422 1423func.func @gather_memref_mismatch(%base: memref<?x?xf64>, %indices: vector<16xi32>,1424 %mask: vector<16xi1>, %pass_thru: vector<16xf64>) {1425 %c0 = arith.constant 0 : index1426 // expected-error@+1 {{'vector.gather' op requires 2 indices}}1427 %0 = vector.gather %base[%c0][%indices], %mask, %pass_thru1428 : memref<?x?xf64>, vector<16xi32>, vector<16xi1>, vector<16xf64> into vector<16xf64>1429}1430 1431// -----1432 1433func.func @gather_rank_mismatch(%base: memref<?xf32>, %indices: vector<16xi32>,1434 %mask: vector<16xi1>, %pass_thru: vector<16xf32>) {1435 %c0 = arith.constant 0 : index1436 // expected-error@+1 {{'vector.gather' op expected result dim to match indices dim}}1437 %0 = vector.gather %base[%c0][%indices], %mask, %pass_thru1438 : memref<?xf32>, vector<16xi32>, vector<16xi1>, vector<16xf32> into vector<2x16xf32>1439}1440 1441// -----1442 1443func.func @gather_dim_indices_mismatch(%base: memref<?xf32>, %indices: vector<17xi32>,1444 %mask: vector<16xi1>, %pass_thru: vector<16xf32>) {1445 %c0 = arith.constant 0 : index1446 // expected-error@+1 {{'vector.gather' op expected result dim to match indices dim}}1447 %0 = vector.gather %base[%c0][%indices], %mask, %pass_thru1448 : memref<?xf32>, vector<17xi32>, vector<16xi1>, vector<16xf32> into vector<16xf32>1449}1450 1451// -----1452 1453func.func @gather_dim_mask_mismatch(%base: memref<?xf32>, %indices: vector<16xi32>,1454 %mask: vector<17xi1>, %pass_thru: vector<16xf32>) {1455 %c0 = arith.constant 0 : index1456 // expected-error@+1 {{'vector.gather' op expected result dim to match mask dim}}1457 %0 = vector.gather %base[%c0][%indices], %mask, %pass_thru1458 : memref<?xf32>, vector<16xi32>, vector<17xi1>, vector<16xf32> into vector<16xf32>1459}1460 1461// -----1462 1463func.func @gather_pass_thru_type_mismatch(%base: memref<?xf32>, %indices: vector<16xi32>,1464 %mask: vector<16xi1>, %pass_thru: vector<16xf64>) {1465 %c0 = arith.constant 0 : index1466 // expected-error@+1 {{'vector.gather' op expected pass_thru of same type as result type}}1467 %0 = vector.gather %base[%c0][%indices], %mask, %pass_thru1468 : memref<?xf32>, vector<16xi32>, vector<16xi1>, vector<16xf64> into vector<16xf32>1469}1470 1471// -----1472 1473func.func @gather_nonpositive_alignment(%base: memref<16xf32>, %indices: vector<16xi32>,1474 %mask: vector<16xi1>, %pass_thru: vector<16xf32>, %c0 : index) {1475 // expected-error@+2 {{'vector.gather' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive and whose value is a power of two > 0}}1476 %0 = vector.gather %base[%c0][%indices], %mask, %pass_thru1477 { alignment = 0 } : memref<16xf32>, vector<16xi32>, vector<16xi1>, vector<16xf32> into vector<16xf32>1478}1479 1480// -----1481 1482func.func @gather_non_power_of_two_alignment(%base: memref<16xf32>, %indices: vector<16xi32>,1483 %mask: vector<16xi1>, %pass_thru: vector<16xf32>, %c0 : index) {1484 // expected-error@+2 {{'vector.gather' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive and whose value is a power of two > 0}}1485 %0 = vector.gather %base[%c0][%indices], %mask, %pass_thru1486 { alignment = 3 } : memref<16xf32>, vector<16xi32>, vector<16xi1>, vector<16xf32> into vector<16xf32>1487}1488 1489// -----1490 1491func.func @scatter_to_vector(%base: vector<16xf32>, %indices: vector<16xi32>,1492 %mask: vector<16xi1>, %pass_thru: vector<16xf32>) {1493 %c0 = arith.constant 0 : index1494 // expected-error@+1 {{'vector.scatter' op operand #0 must be Tensor or MemRef of any type values, but got 'vector<16xf32>'}}1495 vector.scatter %base[%c0][%indices], %mask, %pass_thru1496 : vector<16xf32>, vector<16xi32>, vector<16xi1>, vector<16xf32>1497}1498 1499// -----1500 1501 1502func.func @scatter_base_type_mismatch(%base: memref<?xf64>, %indices: vector<16xi32>,1503 %mask: vector<16xi1>, %value: vector<16xf32>) {1504 %c0 = arith.constant 0 : index1505 // expected-error@+1 {{'vector.scatter' op base and valueToStore element type should match}}1506 vector.scatter %base[%c0][%indices], %mask, %value1507 : memref<?xf64>, vector<16xi32>, vector<16xi1>, vector<16xf32>1508}1509 1510// -----1511 1512func.func @scatter_memref_mismatch(%base: memref<?x?xf64>, %indices: vector<16xi32>,1513 %mask: vector<16xi1>, %value: vector<16xf64>) {1514 %c0 = arith.constant 0 : index1515 // expected-error@+1 {{'vector.scatter' op requires 2 indices}}1516 vector.scatter %base[%c0][%indices], %mask, %value1517 : memref<?x?xf64>, vector<16xi32>, vector<16xi1>, vector<16xf64>1518}1519 1520// -----1521 1522func.func @scatter_rank_mismatch(%base: memref<?xf32>, %indices: vector<16xi32>,1523 %mask: vector<16xi1>, %value: vector<2x16xf32>) {1524 %c0 = arith.constant 0 : index1525 // expected-error@+1 {{'vector.scatter' op expected valueToStore dim to match indices dim}}1526 vector.scatter %base[%c0][%indices], %mask, %value1527 : memref<?xf32>, vector<16xi32>, vector<16xi1>, vector<2x16xf32>1528}1529 1530// -----1531 1532func.func @scatter_dim_indices_mismatch(%base: memref<?xf32>, %indices: vector<17xi32>,1533 %mask: vector<16xi1>, %value: vector<16xf32>) {1534 %c0 = arith.constant 0 : index1535 // expected-error@+1 {{'vector.scatter' op expected valueToStore dim to match indices dim}}1536 vector.scatter %base[%c0][%indices], %mask, %value1537 : memref<?xf32>, vector<17xi32>, vector<16xi1>, vector<16xf32>1538}1539 1540// -----1541 1542func.func @scatter_dim_mask_mismatch(%base: memref<?xf32>, %indices: vector<16xi32>,1543 %mask: vector<17xi1>, %value: vector<16xf32>) {1544 %c0 = arith.constant 0 : index1545 // expected-error@+1 {{'vector.scatter' op expected valueToStore dim to match mask dim}}1546 vector.scatter %base[%c0][%indices], %mask, %value1547 : memref<?xf32>, vector<16xi32>, vector<17xi1>, vector<16xf32>1548}1549 1550// -----1551 1552func.func @scatter_nonpositive_alignment(%base: memref<?xf32>, %indices: vector<16xi32>,1553 %mask: vector<16xi1>, %value: vector<16xf32>, %c0: index) {1554 // expected-error@+1 {{'vector.scatter' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive and whose value is a power of two > 0}}1555 vector.scatter %base[%c0][%indices], %mask, %value { alignment = 0 }1556 : memref<?xf32>, vector<16xi32>, vector<16xi1>, vector<16xf32>1557}1558 1559// -----1560 1561func.func @scatter_non_power_of_2_alignment(%base: memref<?xf32>, %indices: vector<16xi32>,1562 %mask: vector<16xi1>, %value: vector<16xf32>, %c0: index) {1563 // expected-error@+1 {{'vector.scatter' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive and whose value is a power of two > 0}}1564 vector.scatter %base[%c0][%indices], %mask, %value { alignment = 3 }1565 : memref<?xf32>, vector<16xi32>, vector<16xi1>, vector<16xf32>1566}1567 1568// -----1569 1570func.func @expand_base_type_mismatch(%base: memref<?xf64>, %mask: vector<16xi1>, %pass_thru: vector<16xf32>) {1571 %c0 = arith.constant 0 : index1572 // expected-error@+1 {{'vector.expandload' op base and result element type should match}}1573 %0 = vector.expandload %base[%c0], %mask, %pass_thru : memref<?xf64>, vector<16xi1>, vector<16xf32> into vector<16xf32>1574}1575 1576// -----1577 1578func.func @expand_base_scalable(%base: memref<?xf32>, %mask: vector<[16]xi1>, %pass_thru: vector<[16]xf32>) {1579 %c0 = arith.constant 0 : index1580 // expected-error@+1 {{'vector.expandload' op operand #2 must be fixed-length vector of 1-bit signless integer values, but got 'vector<[16]xi1>}}1581 %0 = vector.expandload %base[%c0], %mask, %pass_thru : memref<?xf32>, vector<[16]xi1>, vector<[16]xf32> into vector<[16]xf32>1582}1583 1584// -----1585 1586func.func @expand_dim_mask_mismatch(%base: memref<?xf32>, %mask: vector<17xi1>, %pass_thru: vector<16xf32>) {1587 %c0 = arith.constant 0 : index1588 // expected-error@+1 {{'vector.expandload' op expected result dim to match mask dim}}1589 %0 = vector.expandload %base[%c0], %mask, %pass_thru : memref<?xf32>, vector<17xi1>, vector<16xf32> into vector<16xf32>1590}1591 1592// -----1593 1594func.func @expand_pass_thru_mismatch(%base: memref<?xf32>, %mask: vector<16xi1>, %pass_thru: vector<17xf32>) {1595 %c0 = arith.constant 0 : index1596 // expected-error@+1 {{'vector.expandload' op expected pass_thru of same type as result type}}1597 %0 = vector.expandload %base[%c0], %mask, %pass_thru : memref<?xf32>, vector<16xi1>, vector<17xf32> into vector<16xf32>1598}1599 1600// -----1601 1602func.func @expand_memref_mismatch(%base: memref<?x?xf32>, %mask: vector<16xi1>, %pass_thru: vector<16xf32>) {1603 %c0 = arith.constant 0 : index1604 // expected-error@+1 {{'vector.expandload' op requires 2 indices}}1605 %0 = vector.expandload %base[%c0], %mask, %pass_thru : memref<?x?xf32>, vector<16xi1>, vector<16xf32> into vector<16xf32>1606}1607 1608// -----1609 1610func.func @expand_nonpositive_alignment(%base: memref<?xf32>, %mask: vector<16xi1>, %pass_thru: vector<16xf32>, %c0: index) {1611 // expected-error@+1 {{'vector.expandload' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive and whose value is a power of two > 0}}1612 %0 = vector.expandload %base[%c0], %mask, %pass_thru { alignment = 0 } : memref<?xf32>, vector<16xi1>, vector<16xf32> into vector<16xf32>1613}1614 1615// -----1616 1617func.func @expand_non_power_of_2_alignment(%base: memref<?xf32>, %mask: vector<16xi1>, %pass_thru: vector<16xf32>, %c0: index) {1618 // expected-error@+1 {{'vector.expandload' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive and whose value is a power of two > 0}}1619 %0 = vector.expandload %base[%c0], %mask, %pass_thru { alignment = 3 } : memref<?xf32>, vector<16xi1>, vector<16xf32> into vector<16xf32>1620}1621 1622// -----1623 1624func.func @compress_base_type_mismatch(%base: memref<?xf64>, %mask: vector<16xi1>, %value: vector<16xf32>) {1625 %c0 = arith.constant 0 : index1626 // expected-error@+1 {{'vector.compressstore' op base and valueToStore element type should match}}1627 vector.compressstore %base[%c0], %mask, %value : memref<?xf64>, vector<16xi1>, vector<16xf32>1628}1629 1630// -----1631 1632func.func @compress_scalable(%base: memref<?xf32>, %mask: vector<[16]xi1>, %value: vector<[16]xf32>) {1633 %c0 = arith.constant 0 : index1634 // expected-error@+1 {{'vector.compressstore' op operand #2 must be fixed-length vector of 1-bit signless integer values, but got 'vector<[16]xi1>}}1635 vector.compressstore %base[%c0], %mask, %value : memref<?xf32>, vector<[16]xi1>, vector<[16]xf32>1636}1637 1638// -----1639 1640func.func @compress_dim_mask_mismatch(%base: memref<?xf32>, %mask: vector<17xi1>, %value: vector<16xf32>) {1641 %c0 = arith.constant 0 : index1642 // expected-error@+1 {{'vector.compressstore' op expected valueToStore dim to match mask dim}}1643 vector.compressstore %base[%c0], %mask, %value : memref<?xf32>, vector<17xi1>, vector<16xf32>1644}1645 1646// -----1647 1648func.func @compress_memref_mismatch(%base: memref<?x?xf32>, %mask: vector<16xi1>, %value: vector<16xf32>) {1649 %c0 = arith.constant 0 : index1650 // expected-error@+1 {{'vector.compressstore' op requires 2 indices}}1651 vector.compressstore %base[%c0, %c0, %c0], %mask, %value : memref<?x?xf32>, vector<16xi1>, vector<16xf32>1652}1653 1654// -----1655 1656func.func @compress_nonpositive_alignment(%base: memref<?xf32>, %mask: vector<16xi1>, %value: vector<16xf32>, %c0: index) {1657 // expected-error @below {{'vector.compressstore' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive and whose value is a power of two > 0}}1658 vector.compressstore %base[%c0], %mask, %value { alignment = 0 } : memref<?xf32>, vector<16xi1>, vector<16xf32>1659}1660 1661// -----1662 1663func.func @compress_non_power_of_2_alignment(%base: memref<?xf32>, %mask: vector<16xi1>, %value: vector<16xf32>, %c0: index) {1664 // expected-error @below {{'vector.compressstore' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive and whose value is a power of two > 0}}1665 vector.compressstore %base[%c0], %mask, %value { alignment = 3 } : memref<?xf32>, vector<16xi1>, vector<16xf32>1666}1667 1668// -----1669 1670func.func @scan_reduction_dim_constraint(%arg0: vector<2x3xi32>, %arg1: vector<3xi32>) -> vector<3xi32> {1671 // expected-error@+1 {{'vector.scan' op reduction dimension 5 has to be less than 2}}1672 %0:2 = vector.scan <add>, %arg0, %arg1 {inclusive = true, reduction_dim = 5} :1673 vector<2x3xi32>, vector<3xi32>1674 return %0#1 : vector<3xi32>1675}1676 1677// -----1678 1679func.func @scan_ival_rank_constraint(%arg0: vector<2x3xi32>, %arg1: vector<1x3xi32>) -> vector<1x3xi32> {1680 // expected-error@+1 {{initial value rank 2 has to be equal to 1}}1681 %0:2 = vector.scan <add>, %arg0, %arg1 {inclusive = true, reduction_dim = 0} :1682 vector<2x3xi32>, vector<1x3xi32>1683 return %0#1 : vector<1x3xi32>1684}1685 1686// -----1687 1688func.func @scan_incompatible_shapes(%arg0: vector<2x3xi32>, %arg1: vector<5xi32>) -> vector<2x3xi32> {1689 // expected-error@+1 {{incompatible input/initial value shapes}}1690 %0:2 = vector.scan <add>, %arg0, %arg1 {inclusive = true, reduction_dim = 0} :1691 vector<2x3xi32>, vector<5xi32>1692 return %0#0 : vector<2x3xi32>1693}1694 1695// -----1696 1697func.func @scan_unsupported_kind(%arg0: vector<2x3xf32>, %arg1: vector<3xf32>) -> vector<2x3xf32> {1698 // expected-error@+1 {{'vector.scan' op unsupported reduction type 'f32' for kind 'xor'}}1699 %0:2 = vector.scan <xor>, %arg0, %arg1 {inclusive = true, reduction_dim = 0} :1700 vector<2x3xf32>, vector<3xf32>1701 return %0#0 : vector<2x3xf32>1702}1703 1704 1705// -----1706 1707func.func @vector_mask_multiple_ops(%t0: tensor<?xf32>, %t1: tensor<?xf32>, %idx: index, %val: vector<16xf32>, %m0: vector<16xi1>) {1708 %ft0 = arith.constant 0.0 : f321709 // expected-error@+1 {{'vector.mask' op expects only one operation to mask}}1710 vector.mask %m0 {1711 vector.transfer_write %val, %t0[%idx] : vector<16xf32>, tensor<?xf32>1712 vector.transfer_write %val, %t1[%idx] : vector<16xf32>, tensor<?xf32>1713 } : vector<16xi1>1714 return1715}1716 1717// -----1718 1719func.func @vector_mask_shape_mismatch(%a: vector<8xi32>, %m0: vector<16xi1>) -> i32 {1720 // expected-error@+1 {{'vector.mask' op expects a 'vector<8xi1>' mask for the maskable operation}}1721 %0 = vector.mask %m0 { vector.reduction <add>, %a : vector<8xi32> into i32 } : vector<16xi1> -> i321722 return %0 : i321723}1724 1725// -----1726 1727func.func @vector_mask_passthru_type_mismatch(%t0: tensor<f32>, %m0: vector<i1>) -> vector<f32> {1728 %ft0 = arith.constant 0.0 : f321729 // expected-error@+1 {{'vector.mask' op operand #0 must be vector of 1-bit signless integer values, but got 'vector<i1>'}}1730 %0 = vector.mask %m0 { vector.transfer_read %t0[], %ft0 : tensor<f32>, vector<f32> } : vector<i1> -> vector<f32>1731 return %0 : vector<f32>1732}1733 1734// -----1735 1736// expected-note@+1 {{prior use here}}1737func.func @vector_mask_passthru_type_mismatch(%t0: tensor<?xf32>, %idx: index, %m0: vector<16xi1>, %pt0: vector<16xi32>) -> vector<16xf32> {1738 %ft0 = arith.constant 0.0 : f321739 // expected-error@+1 {{use of value '%pt0' expects different type than prior uses: 'vector<16xf32>' vs 'vector<16xi32>'}}1740 %0 = vector.mask %m0, %pt0 { vector.transfer_read %t0[%idx], %ft0 : tensor<?xf32>, vector<16xf32> } : vector<16xi1> -> vector<16xf32>1741 return %0 : vector<16xf32>1742}1743 1744// -----1745 1746func.func @vector_mask_passthru_no_return(%val: vector<16xf32>, %t0: tensor<?xf32>, %idx: index, %m0: vector<16xi1>, %pt0: vector<16xf32>) {1747 // expected-error@+1 {{'vector.mask' op expects result type to match maskable operation result type}}1748 vector.mask %m0, %pt0 { vector.transfer_write %val, %t0[%idx] : vector<16xf32>, tensor<?xf32> } : vector<16xi1> -> vector<16xf32>1749 return1750}1751// -----1752 1753func.func @vector_mask_non_maskable_op(%a : vector<3x4xf32>) -> vector<3x4xf32> {1754 %m0 = vector.constant_mask [2, 2] : vector<3x4xi1>1755 // expected-error@+1 {{'vector.mask' op expects a MaskableOpInterface within the mask region}}1756 %0 = vector.mask %m0 { arith.addf %a, %a : vector<3x4xf32> } : vector<3x4xi1> -> vector<3x4xf32>1757 return %0 : vector<3x4xf32>1758}1759 1760// -----1761 1762func.func @vector_mask_0d_mask(%arg0: tensor<2x4xi32>,1763 %idx0: index, %idx1: index,1764 %m0: vector<i1>) -> vector<1x1x4xi32> {1765 %cst = arith.constant 0 : i321766 // expected-error@+1 {{'vector.mask' op operand #0 must be vector of 1-bit signless integer values, but got 'vector<i1>'}}1767 %res = vector.mask %m0 {1768 %0 = vector.transfer_read %arg0[%idx0, %idx1], %cst {permutation_map = affine_map<(d0, d1) -> (0, 0, 0)>}1769 : tensor<2x4xi32>, vector<1x1x4xi32>1770 vector.yield %0 : vector<1x1x4xi32>1771 } : vector<i1> -> vector<1x1x4xi32>1772 return %res : vector<1x1x4xi32>1773}1774 1775// -----1776 1777func.func @vector_mask_empty_passthru_no_return_type(%mask : vector<8xi1>,1778 %passthru : vector<8xi32>) {1779 // expected-error@+1 {{'vector.mask' expects a result if passthru operand is provided}}1780 vector.mask %mask, %passthru { } : vector<8xi1>1781 return1782}1783 1784// -----1785 1786func.func @vector_mask_non_empty_external_return(%t: tensor<?xf32>, %idx: index,1787 %m: vector<16xi1>, %ext: vector<16xf32>) -> vector<16xf32> {1788 %ft0 = arith.constant 0.0 : f321789 // expected-error@+1 {{'vector.mask' op expects all the results from the MaskableOpInterface to match all the values returned by the terminator}}1790 %0 = vector.mask %m {1791 %1 =vector.transfer_read %t[%idx], %ft0 : tensor<?xf32>, vector<16xf32>1792 vector.yield %ext : vector<16xf32>1793 } : vector<16xi1> -> vector<16xf32>1794 1795 return %0 : vector<16xf32>1796}1797 1798// -----1799 1800func.func @vector_mask_empty_passthru_empty_return_type(%mask : vector<8xi1>,1801 %passthru : vector<8xi32>) {1802 // expected-error@+1 {{'vector.mask' expects a result if passthru operand is provided}}1803 vector.mask %mask, %passthru { } : vector<8xi1> -> ()1804 return1805}1806 1807// -----1808 1809func.func @vector_mask_non_empty_mixed_return(%t: tensor<?xf32>, %idx: index,1810 %m: vector<16xi1>, %ext: vector<16xf32>) -> (vector<16xf32>, vector<16xf32>) {1811 %ft0 = arith.constant 0.0 : f321812 // expected-error@+1 {{'vector.mask' op expects number of results to match maskable operation number of results}}1813 %0:2 = vector.mask %m {1814 %1 =vector.transfer_read %t[%idx], %ft0 : tensor<?xf32>, vector<16xf32>1815 vector.yield %1, %ext : vector<16xf32>, vector<16xf32>1816 } : vector<16xi1> -> (vector<16xf32>, vector<16xf32>)1817 1818 return %0#0, %0#1 : vector<16xf32>, vector<16xf32>1819}1820 1821// -----1822 1823func.func @vector_scalable_insert_unaligned(%subv: vector<4xi32>, %vec: vector<[16]xi32>) {1824 // expected-error@+1 {{op failed to verify that position is a multiple of the source length.}}1825 %0 = vector.scalable.insert %subv, %vec[2] : vector<4xi32> into vector<[16]xi32>1826}1827 1828// -----1829 1830func.func @vector_scalable_extract_unaligned(%vec: vector<[16]xf32>) {1831 // expected-error@+1 {{op failed to verify that position is a multiple of the result length.}}1832 %0 = vector.scalable.extract %vec[5] : vector<4xf32> from vector<[16]xf32>1833}1834 1835// -----1836 1837func.func @integer_vector_contract(%arg0: vector<16x32xsi8>, %arg1: vector<32x16xsi8>, %arg2: vector<16x16xsi32>) -> vector<16x16xsi32> {1838 // expected-error@+1 {{op only supports signless integer types}}1839 %0 = vector.contract {1840 indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d2)>, affine_map<(d0, d1, d2) -> (d2, d1)>, affine_map<(d0, d1, d2) -> (d0, d1)>],1841 iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>1842 } %arg0, %arg1, %arg2 : vector<16x32xsi8>, vector<32x16xsi8> into vector<16x16xsi32>1843 return %0: vector<16x16xsi32>1844}1845 1846// -----1847 1848func.func @invalid_outerproduct(%src : memref<?xf32>) {1849 %idx = arith.constant 0 : index1850 %0 = vector.load %src[%idx] : memref<?xf32>, vector<[4]xf32>1851 %1 = vector.load %src[%idx] : memref<?xf32>, vector<4xf32>1852 1853 // expected-error @+1 {{expected either both or only #2 operand dim to be scalable}}1854 %op = vector.outerproduct %0, %1 : vector<[4]xf32>, vector<4xf32>1855 1856 return1857}1858 1859// -----1860 1861func.func @invalid_outerproduct1(%src : memref<?xf32>, %lhs : vector<[4]x[4]xf32>, %rhs : vector<[4]xf32>) {1862 %idx = arith.constant 0 : index1863 1864 // expected-error @+1 {{'vector.outerproduct' op expected 1-d vector for operand #1}}1865 %op = vector.outerproduct %lhs, %rhs : vector<[4]x[4]xf32>, vector<[4]xf32>1866}1867 1868// -----1869 1870func.func @deinterleave_zero_dim_fail(%vec : vector<f32>) {1871 // expected-error @+1 {{'vector.deinterleave' op operand #0 must be vector of any type values, but got 'vector<f32>}}1872 %0, %1 = vector.deinterleave %vec : vector<f32> -> vector<f32>1873 return1874}1875 1876// -----1877 1878func.func @deinterleave_one_dim_fail(%vec : vector<1xf32>) {1879 // expected-error @+1 {{'vector.deinterleave' op failed to verify that the trailing dimension of the source vector has an even number of elements}}1880 %0, %1 = vector.deinterleave %vec : vector<1xf32> -> vector<1xf32>1881 return1882}1883 1884// -----1885 1886func.func @deinterleave_oversized_output_fail(%vec : vector<4xf32>) {1887 // expected-error @+1 {{'vector.deinterleave' op failed to verify that the trailing dimension of the results is half the width of source trailing dimension}}1888 %0, %1 = "vector.deinterleave" (%vec) : (vector<4xf32>) -> (vector<8xf32>, vector<8xf32>)1889 return1890}1891 1892// -----1893 1894func.func @deinterleave_output_dim_size_mismatch(%vec : vector<4xf32>) {1895 // expected-error @+1 {{'vector.deinterleave' op failed to verify that the trailing dimension of the results is half the width of source trailing dimension}}1896 %0, %1 = "vector.deinterleave" (%vec) : (vector<4xf32>) -> (vector<4xf32>, vector<2xf32>)1897 return1898}1899 1900// -----1901 1902func.func @deinterleave_n_dim_rank_fail(%vec : vector<2x3x4xf32>) {1903 // expected-error @+1 {{'vector.deinterleave' op failed to verify that the trailing dimension of the results is half the width of source trailing dimension}}1904 %0, %1 = "vector.deinterleave" (%vec) : (vector<2x3x4xf32>) -> (vector<2x3x4xf32>, vector<2x3x2xf32>)1905 return1906}1907 1908// -----1909 1910func.func @deinterleave_scalable_dim_size_fail(%vec : vector<2x[4]xf32>) {1911 // expected-error @+1 {{'vector.deinterleave' op failed to verify that all of {res1, res2} have same type}}1912 %0, %1 = "vector.deinterleave" (%vec) : (vector<2x[4]xf32>) -> (vector<2x[2]xf32>, vector<2x[1]xf32>)1913 return1914}1915 1916// -----1917 1918func.func @deinterleave_scalable_rank_fail(%vec : vector<2x[4]xf32>) {1919 // expected-error @+1 {{'vector.deinterleave' op failed to verify that all of {res1, res2} have same type}}1920 %0, %1 = "vector.deinterleave" (%vec) : (vector<2x[4]xf32>) -> (vector<2x[2]xf32>, vector<[2]xf32>)1921 return1922}1923 1924// -----1925 1926func.func @to_elements_wrong_num_results(%a: vector<1x1x2xf32>) {1927 // expected-error @+1 {{operation defines 2 results but was provided 4 to bind}}1928 %0:4 = vector.to_elements %a : vector<1x1x2xf32>1929 return1930}1931 1932// -----1933 1934func.func @to_elements_wrong_result_type(%a: vector<2xf32>) -> i32 {1935 // expected-error @+3 {{use of value '%0' expects different type than prior uses: 'i32'}}1936 // expected-note @+1 {{prior use here}}1937 %0:2 = vector.to_elements %a : vector<2xf32>1938 return %0#0 : i321939}1940 1941// -----1942 1943func.func @from_elements_wrong_num_operands(%a: f32) {1944 // expected-error @+1 {{'vector.from_elements' number of operands and types do not match: got 1 operands and 2 types}}1945 vector.from_elements %a : vector<2xf32>1946 return1947}1948 1949// -----1950 1951// expected-note @+1 {{prior use here}}1952func.func @from_elements_wrong_operand_type(%a: f32, %b: i32) {1953 // expected-error @+1 {{use of value '%b' expects different type than prior uses: 'f32' vs 'i32'}}1954 vector.from_elements %a, %b : vector<2xf32>1955 return1956}1957// -----1958 1959func.func @invalid_from_elements_scalable(%a: f32, %b: i32) {1960 // expected-error @+1 {{'dest' must be fixed-length vector of any type values, but got 'vector<[2]xf32>'}}1961 vector.from_elements %a, %b : vector<[2]xf32>1962 return1963}1964 1965// -----1966 1967func.func @invalid_step_0d() {1968 // expected-error @+1 {{vector.step' op result #0 must be vector of index values of ranks 1, but got 'vector<f32>'}}1969 vector.step : vector<f32>1970 return1971}1972 1973// -----1974 1975func.func @invalid_step_2d() {1976 // expected-error @+1 {{vector.step' op result #0 must be vector of index values of ranks 1, but got 'vector<2x4xf32>'}}1977 vector.step : vector<2x4xf32>1978 return1979}1980 1981// -----1982 1983//===----------------------------------------------------------------------===//1984// vector.load1985//===----------------------------------------------------------------------===//1986 1987func.func @vector_load(%src : memref<?xi8>) {1988 %c0 = arith.constant 0 : index1989 // expected-error @+1 {{'vector.load' op destination memref has lower rank than the result vector}}1990 %0 = vector.load %src[%c0] : memref<?xi8>, vector<16x16xi8>1991 return1992}1993 1994// -----1995 1996func.func @load_nonpositive_alignment(%memref: memref<4xi32>, %c0: index) {1997 // expected-error @below {{'vector.load' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive and whose value is a power of two > 0}}1998 %val = vector.load %memref[%c0] { alignment = 0 } : memref<4xi32>, vector<4xi32>1999 return2000}2001 2002// -----2003 2004func.func @load_non_pow_of_2_alignment(%memref: memref<4xi32>, %c0: index) {2005 // expected-error @below {{'vector.load' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive and whose value is a power of two > 0}}2006 %val = vector.load %memref[%c0] { alignment = 3 } : memref<4xi32>, vector<4xi32>2007 return2008}2009 2010// -----2011 2012//===----------------------------------------------------------------------===//2013// vector.store2014//===----------------------------------------------------------------------===//2015 2016func.func @vector_store(%dest : memref<?xi8>, %vec : vector<16x16xi8>) {2017 %c0 = arith.constant 0 : index2018 // expected-error @+1 {{'vector.store' op source memref has lower rank than the vector to store}}2019 vector.store %vec, %dest[%c0] : memref<?xi8>, vector<16x16xi8>2020 return2021}2022 2023// -----2024 2025func.func @store_nonpositive_alignment(%memref: memref<4xi32>, %val: vector<4xi32>, %c0: index) {2026 // expected-error @below {{'vector.store' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive and whose value is a power of two > 0}}2027 vector.store %val, %memref[%c0] { alignment = 0 } : memref<4xi32>, vector<4xi32>2028 return2029}2030 2031// -----2032 2033func.func @store_non_pow_of_2_alignment(%memref: memref<4xi32>, %val: vector<4xi32>, %c0: index) {2034 // expected-error @below {{'vector.store' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive and whose value is a power of two > 0}}2035 vector.store %val, %memref[%c0] { alignment = 3 } : memref<4xi32>, vector<4xi32>2036 return2037}2038