1// RUN: mlir-opt %s -split-input-file -verify-diagnostics 2 3// ----- 4 5func.func @broadcast_to_scalar(%arg0: f32) -> f32 { 6 // expected-error@+1 {{custom op 'vector.broadcast' invalid kind of type specified}} 7 %0 = vector.broadcast %arg0 : f32 to f32 8} 9 10// ----- 11 12func.func @broadcast_rank_too_high(%arg0: vector<4x4xf32>) { 13 // expected-error@+1 {{'vector.broadcast' op source rank higher than destination rank}} 14 %1 = vector.broadcast %arg0 : vector<4x4xf32> to vector<4xf32> 15} 16 17// ----- 18 19func.func @broadcast_rank_too_high_0d(%arg0: vector<1xf32>) { 20 // expected-error@+1 {{'vector.broadcast' op source rank higher than destination rank}} 21 %1 = vector.broadcast %arg0 : vector<1xf32> to vector<f32> 22} 23 24// ----- 25 26func.func @broadcast_dim1_mismatch(%arg0: vector<7xf32>) { 27 // expected-error@+1 {{'vector.broadcast' op dimension mismatch (7 vs. 3)}} 28 %1 = vector.broadcast %arg0 : vector<7xf32> to vector<3xf32> 29} 30 31// ----- 32 33func.func @broadcast_dim2_mismatch(%arg0: vector<4x8xf32>) { 34 // expected-error@+1 {{'vector.broadcast' op dimension mismatch (4 vs. 1)}} 35 %1 = vector.broadcast %arg0 : vector<4x8xf32> to vector<1x8xf32> 36} 37 38// ----- 39 40func.func @broadcast_unknown(%arg0: memref<4x8xf32>) { 41 // expected-error@+1 {{'vector.broadcast' op source type is not a vector}} 42 %1 = vector.broadcast %arg0 : memref<4x8xf32> to vector<1x8xf32> 43} 44 45// ----- 46 47func.func @shuffle_elt_type_mismatch(%arg0: vector<2xf32>, %arg1: vector<2xi32>) { 48 // expected-error@+1 {{'vector.shuffle' op failed to verify that second operand v2 and result have same element type}} 49 %1 = vector.shuffle %arg0, %arg1 [0, 1] : vector<2xf32>, vector<2xi32> 50} 51 52// ----- 53 54func.func @shuffle_rank_mismatch(%arg0: vector<2xf32>, %arg1: vector<4x2xf32>) { 55 // expected-error@+1 {{'vector.shuffle' op rank mismatch}} 56 %1 = vector.shuffle %arg0, %arg1 [0, 1] : vector<2xf32>, vector<4x2xf32> 57} 58 59// ----- 60 61func.func @shuffle_trailing_dim_size_mismatch(%arg0: vector<2x2xf32>, %arg1: vector<2x4xf32>) { 62 // expected-error@+1 {{'vector.shuffle' op dimension mismatch}} 63 %1 = vector.shuffle %arg0, %arg1 [0, 1] : vector<2x2xf32>, vector<2x4xf32> 64} 65 66// ----- 67 68func.func @shuffle_index_out_of_range(%arg0: vector<2xf32>, %arg1: vector<2xf32>) { 69 // expected-error@+1 {{'vector.shuffle' op mask index #2 out of range}} 70 %1 = vector.shuffle %arg0, %arg1 [0, 4] : vector<2xf32>, vector<2xf32> 71} 72 73// ----- 74 75func.func @shuffle_empty_mask(%arg0: vector<2xf32>, %arg1: vector<2xf32>) { 76 // expected-error@+1 {{'vector.shuffle' op invalid mask length}} 77 %1 = vector.shuffle %arg0, %arg1 [] : vector<2xf32>, vector<2xf32> 78} 79 80// ----- 81 82func.func @extract_element(%arg0: vector<f32>) { 83 %c = arith.constant 3 : i32 84 // expected-error@+1 {{expected position to be empty with 0-D vector}} 85 %1 = vector.extractelement %arg0[%c : i32] : vector<f32> 86} 87 88// ----- 89 90func.func @extract_element(%arg0: vector<4xf32>) { 91 %c = arith.constant 3 : i32 92 // expected-error@+1 {{expected position for 1-D vector}} 93 %1 = vector.extractelement %arg0[] : vector<4xf32> 94} 95 96// ----- 97 98func.func @extract_element(%arg0: vector<4x4xf32>) { 99 %c = arith.constant 3 : i32 100 // expected-error@+1 {{unexpected >1 vector rank}} 101 %1 = vector.extractelement %arg0[%c : i32] : vector<4x4xf32> 102} 103 104// ----- 105 106func.func @extract_vector_type(%arg0: index) { 107 // expected-error@+1 {{invalid kind of type specified}} 108 %1 = vector.extract %arg0[] : index 109} 110 111// ----- 112 113func.func @extract_position_rank_overflow(%arg0: vector<4x8x16xf32>) { 114 // expected-error@+1 {{expected position attribute of rank smaller than vector}} 115 %1 = vector.extract %arg0[0, 0, 0, 0] : vector<4x8x16xf32> 116} 117 118// ----- 119 120func.func @extract_position_rank_overflow_generic(%arg0: vector<4x8x16xf32>) { 121 // expected-error@+1 {{expected position attribute of rank smaller than vector}} 122 %1 = "vector.extract" (%arg0) { position = [0, 0, 0, 0] } : (vector<4x8x16xf32>) -> (vector<16xf32>) 123} 124 125// ----- 126 127func.func @extract_position_overflow(%arg0: vector<4x8x16xf32>) { 128 // expected-error@+1 {{expected position attribute #2 to be a non-negative integer smaller than the corresponding vector dimension}} 129 %1 = vector.extract %arg0[0, 43, 0] : vector<4x8x16xf32> 130} 131 132// ----- 133 134func.func @extract_precise_position_overflow(%arg0: vector<4x8x16xf32>) { 135 // expected-error@+1 {{expected position attribute #3 to be a non-negative integer smaller than the corresponding vector dimension}} 136 %1 = vector.extract %arg0[3, 7, 16] : vector<4x8x16xf32> 137} 138 139// ----- 140 141func.func @extract_position_overflow(%arg0: vector<4x8x16xf32>) { 142 // expected-error@+1 {{expected position attribute #3 to be a non-negative integer smaller than the corresponding vector dimension}} 143 %1 = vector.extract %arg0[0, 0, -1] : vector<4x8x16xf32> 144} 145 146// ----- 147 148func.func @insert_element(%arg0: f32, %arg1: vector<f32>) { 149 %c = arith.constant 3 : i32 150 // expected-error@+1 {{expected position to be empty with 0-D vector}} 151 %0 = vector.insertelement %arg0, %arg1[%c : i32] : vector<f32> 152} 153 154// ----- 155 156func.func @insert_element(%arg0: f32, %arg1: vector<4xf32>) { 157 %c = arith.constant 3 : i32 158 // expected-error@+1 {{expected position for 1-D vector}} 159 %0 = vector.insertelement %arg0, %arg1[] : vector<4xf32> 160} 161 162// ----- 163 164func.func @insert_element(%arg0: f32, %arg1: vector<4x4xf32>) { 165 %c = arith.constant 3 : i32 166 // expected-error@+1 {{unexpected >1 vector rank}} 167 %0 = vector.insertelement %arg0, %arg1[%c : i32] : vector<4x4xf32> 168} 169 170// ----- 171 172func.func @insert_element_wrong_type(%arg0: i32, %arg1: vector<4xf32>) { 173 %c = arith.constant 3 : i32 174 // expected-error@+1 {{'vector.insertelement' op failed to verify that source operand type matches element type of result}} 175 %0 = "vector.insertelement" (%arg0, %arg1, %c) : (i32, vector<4xf32>, i32) -> (vector<4xf32>) 176} 177 178// ----- 179 180func.func @insert_vector_type(%a: f32, %b: vector<4x8x16xf32>) { 181 // expected-error@+1 {{expected position attribute of rank smaller than dest vector rank}} 182 %1 = vector.insert %a, %b[3, 3, 3, 3, 3, 3] : f32 into vector<4x8x16xf32> 183} 184 185// ----- 186 187func.func @insert_vector_type(%a: vector<4xf32>, %b: vector<4x8x16xf32>) { 188 // expected-error@+1 {{expected position attribute rank + source rank to match dest vector rank}} 189 %1 = vector.insert %a, %b[3] : vector<4xf32> into vector<4x8x16xf32> 190} 191 192// ----- 193 194func.func @insert_vector_type(%a: f32, %b: vector<4x8x16xf32>) { 195 // expected-error@+1 {{expected position attribute rank to match the dest vector rank}} 196 %1 = vector.insert %a, %b[3, 3] : f32 into vector<4x8x16xf32> 197} 198 199// ----- 200 201func.func @insert_position_overflow(%a: f32, %b: vector<4x8x16xf32>) { 202 // expected-error@+1 {{expected position attribute #3 to be a non-negative integer smaller than the corresponding dest vector dimension}} 203 %1 = vector.insert %a, %b[0, 0, -1] : f32 into vector<4x8x16xf32> 204} 205 206// ----- 207 208func.func @insert_precise_position_overflow(%a: f32, %b: vector<4x8x16xf32>) { 209 // expected-error@+1 {{expected position attribute #1 to be a non-negative integer smaller than the corresponding dest vector dimension}} 210 %1 = vector.insert %a, %b[4, 7, 15] : f32 into vector<4x8x16xf32> 211} 212 213// ----- 214 215func.func @outerproduct_num_operands(%arg0: f32) { 216 // expected-error@+1 {{expected at least 2 operands}} 217 %1 = vector.outerproduct %arg0 : f32, f32 218} 219// ----- 220 221func.func @outerproduct_non_vector_operand(%arg0: f32) { 222 // expected-error@+1 {{expected vector type for operand #1}} 223 %1 = vector.outerproduct %arg0, %arg0 : f32, f32 224} 225 226// ----- 227 228func.func @outerproduct_operand_1(%arg0: vector<4xf32>, %arg1: vector<4x8xf32>) { 229 // expected-error@+1 {{expected 1-d vector for operand #1}} 230 %1 = vector.outerproduct %arg1, %arg1 : vector<4x8xf32>, vector<4x8xf32> 231} 232 233// ----- 234 235func.func @outerproduct_operand_2(%arg0: vector<4xf32>, %arg1: vector<4x8xf32>) { 236 // expected-error@+1 {{expected 1-d vector for operand #2}} 237 %1 = vector.outerproduct %arg0, %arg1 : vector<4xf32>, vector<4x8xf32> 238} 239 240// ----- 241 242func.func @outerproduct_result_generic(%arg0: vector<4xf32>, %arg1: vector<8xf32>) { 243 // expected-error@+1 {{expected 2-d vector result}} 244 %1 = "vector.outerproduct" (%arg0, %arg1) : (vector<4xf32>, vector<8xf32>) -> (vector<8xf32>) 245} 246 247// ----- 248 249func.func @outerproduct_operand_1_dim_generic(%arg0: vector<4xf32>, %arg1: vector<8xf32>) { 250 // expected-error@+1 {{expected #1 operand dim to match result dim #1}} 251 %1 = "vector.outerproduct" (%arg0, %arg1) : (vector<4xf32>, vector<8xf32>) -> (vector<8x16xf32>) 252} 253 254// ----- 255 256func.func @outerproduct_operand_2_dim_generic(%arg0: vector<4xf32>, %arg1: vector<8xf32>) { 257 // expected-error@+1 {{expected #2 operand dim to match result dim #2}} 258 %1 = "vector.outerproduct" (%arg0, %arg1) : (vector<4xf32>, vector<8xf32>) -> (vector<4x16xf32>) 259} 260 261// ----- 262 263func.func @outerproduct_axpy_operand(%arg0: vector<4x8xf32>, %arg1: f32) { 264 // expected-error@+1 {{expected 1-d vector for operand #1}} 265 %1 = vector.outerproduct %arg0, %arg1 : vector<4x8xf32>, f32 266} 267 268// ----- 269 270func.func @outerproduct_axpy_result_generic(%arg0: vector<4xf32>, %arg1: f32) { 271 // expected-error@+1 {{expected 1-d vector result}} 272 %1 = "vector.outerproduct" (%arg0, %arg1) : (vector<4xf32>, f32) -> (vector<4x8xf32>) 273} 274 275// ----- 276 277func.func @outerproduct_axpy_operand_dim_generic(%arg0: vector<8xf32>, %arg1: f32) { 278 // expected-error@+1 {{expected #1 operand dim to match result dim #1}} 279 %1 = "vector.outerproduct" (%arg0, %arg1) : (vector<8xf32>, f32) -> (vector<16xf32>) 280} 281 282// ----- 283 284func.func @outerproduct_operand_3_result_type_generic(%arg0: vector<4xf32>, %arg1: vector<8xf32>, %arg2: vector<4x16xf32>) { 285 // expected-error@+1 {{expected operand #3 of same type as result type}} 286 %1 = "vector.outerproduct" (%arg0, %arg1, %arg2) : (vector<4xf32>, vector<8xf32>, vector<4x16xf32>) -> (vector<4x8xf32>) 287} 288 289// ----- 290 291func.func @test_vector.transfer_read(%arg0: memref<?x?xf32>) { 292 %c3 = arith.constant 3 : index 293 %cst = arith.constant 3.0 : f32 294 // expected-error@+1 {{requires two types}} 295 %0 = vector.transfer_read %arg0[%c3, %c3], %cst { permutation_map = affine_map<()->(0)> } : memref<?x?xf32> 296} 297 298// ----- 299 300func.func @test_vector.transfer_read(%arg0: vector<4x3xf32>) { 301 %c3 = arith.constant 3 : index 302 %f0 = arith.constant 0.0 : f32 303 %vf0 = vector.splat %f0 : vector<4x3xf32> 304 // expected-error@+1 {{ requires memref or ranked tensor type}} 305 %0 = vector.transfer_read %arg0[%c3, %c3], %vf0 : vector<4x3xf32>, vector<1x1x2x3xf32> 306} 307 308// ----- 309 310func.func @test_vector.transfer_read(%arg0: memref<4x3xf32>) { 311 %c3 = arith.constant 3 : index 312 %f0 = arith.constant 0.0 : f32 313 %vf0 = vector.splat %f0 : vector<4x3xf32> 314 // expected-error@+1 {{ requires vector type}} 315 %0 = vector.transfer_read %arg0[%c3, %c3], %vf0 : memref<4x3xf32>, f32 316} 317 318// ----- 319 320func.func @test_vector.transfer_read(%arg0: memref<?x?xf32>) { 321 %c3 = arith.constant 3 : index 322 %cst = arith.constant 3.0 : f32 323 // expected-error@+1 {{requires 2 indices}} 324 %0 = vector.transfer_read %arg0[%c3, %c3, %c3], %cst { permutation_map = affine_map<()->(0)> } : memref<?x?xf32>, vector<128xf32> 325} 326 327// ----- 328 329func.func @test_vector.transfer_read(%arg0: memref<?x?xf32>) { 330 %c3 = arith.constant 3 : index 331 %cst = arith.constant 3.0 : f32 332 // expected-error@+1 {{requires a permutation_map with input dims of the same rank as the source type}} 333 %0 = vector.transfer_read %arg0[%c3, %c3], %cst {permutation_map = affine_map<(d0)->(d0)>} : memref<?x?xf32>, vector<128xf32> 334} 335 336// ----- 337 338func.func @test_vector.transfer_read(%arg0: memref<?x?xf32>) { 339 %c3 = arith.constant 3 : index 340 %cst = arith.constant 3.0 : f32 341 // expected-error@+1 {{requires a permutation_map with result dims of the same rank as the vector type}} 342 %0 = vector.transfer_read %arg0[%c3, %c3], %cst {permutation_map = affine_map<(d0, d1)->(d0, d1)>} : memref<?x?xf32>, vector<128xf32> 343} 344 345// ----- 346 347func.func @test_vector.transfer_read(%arg0: memref<?x?xf32>) { 348 %c3 = arith.constant 3 : index 349 %cst = arith.constant 3.0 : f32 350 // expected-error@+1 {{requires a projected permutation_map (at most one dim or the zero constant can appear in each result)}} 351 %0 = vector.transfer_read %arg0[%c3, %c3], %cst {permutation_map = affine_map<(d0, d1)->(d0 + d1)>} : memref<?x?xf32>, vector<128xf32> 352} 353 354// ----- 355 356func.func @test_vector.transfer_read(%arg0: memref<?x?xf32>) { 357 %c3 = arith.constant 3 : index 358 %cst = arith.constant 3.0 : f32 359 // expected-error@+1 {{requires a projected permutation_map (at most one dim or the zero constant can appear in each result)}} 360 %0 = vector.transfer_read %arg0[%c3, %c3], %cst {permutation_map = affine_map<(d0, d1)->(d0 + 1)>} : memref<?x?xf32>, vector<128xf32> 361} 362 363// ----- 364 365func.func @test_vector.transfer_read(%arg0: memref<?x?x?xf32>) { 366 %c3 = arith.constant 3 : index 367 %cst = arith.constant 3.0 : f32 368 // expected-error@+1 {{requires a permutation_map that is a permutation (found one dim used more than once)}} 369 %0 = vector.transfer_read %arg0[%c3, %c3, %c3], %cst {permutation_map = affine_map<(d0, d1, d2)->(d0, d0)>} : memref<?x?x?xf32>, vector<3x7xf32> 370} 371 372// ----- 373 374func.func @test_vector.transfer_read(%arg0: memref<?x?x?xf32>) { 375 %c1 = arith.constant 1 : i1 376 %c3 = arith.constant 3 : index 377 %cst = arith.constant 3.0 : f32 378 // expected-note@+1 {{prior use here}} 379 %mask = vector.splat %c1 : vector<3x8x7xi1> 380 // expected-error@+1 {{expects different type than prior uses: 'vector<3x7xi1>' vs 'vector<3x8x7xi1>'}} 381 %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> 382} 383 384// ----- 385 386func.func @test_vector.transfer_read(%arg0: memref<?x?xvector<4x3xf32>>) { 387 %c3 = arith.constant 3 : index 388 %f0 = arith.constant 0.0 : f32 389 %vf0 = vector.splat %f0 : vector<4x3xf32> 390 // expected-error@+1 {{requires source vector element and vector result ranks to match}} 391 %0 = vector.transfer_read %arg0[%c3, %c3], %vf0 {permutation_map = affine_map<(d0, d1)->(d0, d1)>} : memref<?x?xvector<4x3xf32>>, vector<3xf32> 392} 393 394// ----- 395 396func.func @test_vector.transfer_read(%arg0: memref<?x?xvector<6xf32>>) { 397 %c3 = arith.constant 3 : index 398 %f0 = arith.constant 0.0 : f32 399 %vf0 = vector.splat %f0 : vector<6xf32> 400 // 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}} 401 %0 = vector.transfer_read %arg0[%c3, %c3], %vf0 : memref<?x?xvector<6xf32>>, vector<3xf32> 402} 403 404// ----- 405 406func.func @test_vector.transfer_read(%arg0: memref<?x?xvector<2x3xf32>>) { 407 %c3 = arith.constant 3 : index 408 %f0 = arith.constant 0.0 : f32 409 %vf0 = vector.splat %f0 : vector<2x3xf32> 410 // expected-error@+1 {{ expects the optional in_bounds attr of same rank as permutation_map results: affine_map<(d0, d1) -> (d0, d1)>}} 411 %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> 412} 413 414// ----- 415 416func.func @test_vector.transfer_read(%arg0: memref<?x?xvector<2x3xf32>>) { 417 %c3 = arith.constant 3 : index 418 %f0 = arith.constant 0.0 : f32 419 %vf0 = vector.splat %f0 : vector<2x3xf32> 420 // expected-error@+1 {{requires broadcast dimensions to be in-bounds}} 421 %0 = vector.transfer_read %arg0[%c3, %c3], %vf0 {in_bounds = [false, true], permutation_map = affine_map<(d0, d1)->(0, d1)>} : memref<?x?xvector<2x3xf32>>, vector<1x1x2x3xf32> 422} 423 424// ----- 425 426func.func @test_vector.transfer_read(%arg0: memref<?x?xvector<2x3xf32>>) { 427 %c3 = arith.constant 3 : index 428 %f0 = arith.constant 0.0 : f32 429 %vf0 = vector.splat %f0 : vector<2x3xf32> 430 %mask = vector.splat %c1 : vector<2x3xi1> 431 // expected-error@+1 {{does not support masks with vector element type}} 432 %0 = vector.transfer_read %arg0[%c3, %c3], %vf0, %mask {permutation_map = affine_map<(d0, d1)->(d0, d1)>} : memref<?x?xvector<2x3xf32>>, vector<1x1x2x3xf32> 433} 434 435// ----- 436 437func.func @test_vector.transfer_write(%arg0: memref<?x?xf32>) { 438 %c3 = arith.constant 3 : index 439 %cst = arith.constant 3.0 : f32 440 // expected-error@+1 {{requires two types}} 441 vector.transfer_write %arg0, %arg0[%c3, %c3] : memref<?x?xf32> 442} 443 444// ----- 445 446func.func @test_vector.transfer_write(%arg0: memref<vector<4x3xf32>>) { 447 %c3 = arith.constant 3 : index 448 %f0 = arith.constant 0.0 : f32 449 %vf0 = vector.splat %f0 : vector<4x3xf32> 450 // expected-error@+1 {{ requires vector type}} 451 vector.transfer_write %arg0, %arg0[%c3, %c3] : memref<vector<4x3xf32>>, vector<4x3xf32> 452} 453 454// ----- 455 456func.func @test_vector.transfer_write(%arg0: vector<4x3xf32>) { 457 %c3 = arith.constant 3 : index 458 %f0 = arith.constant 0.0 : f32 459 %vf0 = vector.splat %f0 : vector<4x3xf32> 460 // expected-error@+1 {{ requires memref or ranked tensor type}} 461 vector.transfer_write %arg0, %arg0[%c3, %c3] : vector<4x3xf32>, f32 462} 463 464// ----- 465 466func.func @test_vector.transfer_write(%arg0: memref<?x?xf32>) { 467 %c3 = arith.constant 3 : index 468 %cst = arith.constant dense<3.0> : vector<128 x f32> 469 // expected-error@+1 {{expected 5 operand types but had 4}} 470 %0 = "vector.transfer_write"(%cst, %arg0, %c3, %c3, %c3) {permutation_map = affine_map<()->(0)>} : (vector<128xf32>, memref<?x?xf32>, index, index) -> () 471} 472 473// ----- 474 475func.func @test_vector.transfer_write(%arg0: memref<?x?xf32>) { 476 %c3 = arith.constant 3 : index 477 %cst = arith.constant dense<3.0> : vector<128 x f32> 478 // expected-error@+1 {{requires 2 indices}} 479 vector.transfer_write %cst, %arg0[%c3, %c3, %c3] {permutation_map = affine_map<()->(0)>} : vector<128xf32>, memref<?x?xf32> 480} 481 482// ----- 483 484func.func @test_vector.transfer_write(%arg0: memref<?x?xf32>) { 485 %c3 = arith.constant 3 : index 486 %cst = arith.constant dense<3.0> : vector<128 x f32> 487 // expected-error@+1 {{requires a permutation_map with input dims of the same rank as the source type}} 488 vector.transfer_write %cst, %arg0[%c3, %c3] {permutation_map = affine_map<(d0)->(d0)>} : vector<128xf32>, memref<?x?xf32> 489} 490 491// ----- 492 493func.func @test_vector.transfer_write(%arg0: memref<?x?xf32>) { 494 %c3 = arith.constant 3 : index 495 %cst = arith.constant dense<3.0> : vector<128 x f32> 496 // expected-error@+1 {{requires a permutation_map with result dims of the same rank as the vector type}} 497 vector.transfer_write %cst, %arg0[%c3, %c3] {permutation_map = affine_map<(d0, d1)->(d0, d1)>} : vector<128xf32>, memref<?x?xf32> 498} 499 500// ----- 501 502func.func @test_vector.transfer_write(%arg0: memref<?x?xf32>) { 503 %c3 = arith.constant 3 : index 504 %cst = arith.constant dense<3.0> : vector<128 x f32> 505 // expected-error@+1 {{requires a projected permutation_map (at most one dim or the zero constant can appear in each result)}} 506 vector.transfer_write %cst, %arg0[%c3, %c3] {permutation_map = affine_map<(d0, d1)->(d0 + d1)>} : vector<128xf32>, memref<?x?xf32> 507} 508 509// ----- 510 511func.func @test_vector.transfer_write(%arg0: memref<?x?xf32>) { 512 %c3 = arith.constant 3 : index 513 %cst = arith.constant dense<3.0> : vector<128 x f32> 514 // expected-error@+1 {{requires a projected permutation_map (at most one dim or the zero constant can appear in each result)}} 515 vector.transfer_write %cst, %arg0[%c3, %c3] {permutation_map = affine_map<(d0, d1)->(d0 + 1)>} : vector<128xf32>, memref<?x?xf32> 516} 517 518// ----- 519 520func.func @test_vector.transfer_write(%arg0: memref<?x?x?xf32>) { 521 %c3 = arith.constant 3 : index 522 %cst = arith.constant dense<3.0> : vector<3 x 7 x f32> 523 // expected-error@+1 {{requires a permutation_map that is a permutation (found one dim used more than once)}} 524 vector.transfer_write %cst, %arg0[%c3, %c3, %c3] {permutation_map = affine_map<(d0, d1, d2)->(d0, d0)>} : vector<3x7xf32>, memref<?x?x?xf32> 525} 526 527// ----- 528 529func.func @test_vector.transfer_write(%arg0: memref<?xf32>, %arg1: vector<7xf32>) { 530 %c3 = arith.constant 3 : index 531 %cst = arith.constant 3.0 : f32 532 // expected-error@+1 {{should not have broadcast dimensions}} 533 vector.transfer_write %arg1, %arg0[%c3] 534 {permutation_map = affine_map<(d0) -> (0)>} 535 : vector<7xf32>, memref<?xf32> 536} 537 538// ----- 539 540func.func @insert_strided_slice(%a: vector<4x4xf32>, %b: vector<4x8x16xf32>) { 541 // expected-error@+1 {{expected offsets of same size as destination vector rank}} 542 %1 = vector.insert_strided_slice %a, %b {offsets = [100], strides = [1, 1]} : vector<4x4xf32> into vector<4x8x16xf32> 543} 544 545// ----- 546 547func.func @insert_strided_slice(%a: vector<4x4xf32>, %b: vector<4x8x16xf32>) { 548 // expected-error@+1 {{expected strides of same size as source vector rank}} 549 %1 = vector.insert_strided_slice %a, %b {offsets = [2, 2, 2], strides = [1]} : vector<4x4xf32> into vector<4x8x16xf32> 550} 551 552// ----- 553 554func.func @insert_strided_slice(%a: vector<4x4xf32>, %b: vector<4x8x16xf32>) { 555 // expected-error@+1 {{expected source rank to be smaller than destination rank}} 556 %1 = vector.insert_strided_slice %b, %a {offsets = [2, 2], strides = [1, 1, 1]} : vector<4x8x16xf32> into vector<4x4xf32> 557} 558 559// ----- 560 561func.func @insert_strided_slice(%a: vector<4x4xf32>, %b: vector<4x8x16xf32>) { 562 // expected-error@+1 {{op expected offsets dimension 0 to be confined to [0, 4)}} 563 %1 = vector.insert_strided_slice %a, %b {offsets = [100,100,100], strides = [1, 1]} : vector<4x4xf32> into vector<4x8x16xf32> 564} 565 566// ----- 567 568func.func @insert_strided_slice(%a: vector<4x4xf32>, %b: vector<4x8x16xf32>) { 569 // expected-error@+1 {{op expected strides to be confined to [1, 2)}} 570 %1 = vector.insert_strided_slice %a, %b {offsets = [2, 2, 2], strides = [100, 100]} : vector<4x4xf32> into vector<4x8x16xf32> 571} 572 573// ----- 574 575func.func @insert_strided_slice(%a: vector<4x4xf32>, %b: vector<4x8x16xf32>) { 576 // expected-error@+1 {{op expected sum(offsets, source vector shape) dimension 1 to be confined to [1, 9)}} 577 %1 = vector.insert_strided_slice %a, %b {offsets = [2, 7, 2], strides = [1, 1]} : vector<4x4xf32> into vector<4x8x16xf32> 578} 579 580// ----- 581 582func.func @extract_strided_slice(%arg0: vector<4x8x16xf32>) { 583 // expected-error@+1 {{expected offsets, sizes and strides attributes of same size}} 584 %1 = vector.extract_strided_slice %arg0 {offsets = [100], sizes = [2, 2], strides = [1, 1]} : vector<4x8x16xf32> to vector<2x2x16xf32> 585} 586 587// ----- 588 589func.func @extract_strided_slice(%arg0: vector<4x8x16xf32>) { 590 // expected-error@+1 {{expected offsets attribute of rank smaller than vector rank}} 591 %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> 592} 593 594// ----- 595 596func.func @extract_strided_slice(%arg0: vector<4x8x16xf32>) { 597 // expected-error@+1 {{expected offsets attribute of rank smaller than vector rank}} 598 %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> 599} 600 601// ----- 602 603func.func @extract_strided_slice(%arg0: vector<4x8x16xf32>) { 604 // expected-error@+1 {{op expected offsets dimension 0 to be confined to [0, 4)}} 605 %1 = vector.extract_strided_slice %arg0 {offsets = [100], sizes = [100], strides = [100]} : vector<4x8x16xf32> to vector<100x8x16xf32> 606} 607 608// ----- 609 610func.func @extract_strided_slice(%arg0: vector<4x8x16xf32>) { 611 // expected-error@+1 {{op expected sizes dimension 0 to be confined to [1, 5)}} 612 %1 = vector.extract_strided_slice %arg0 {offsets = [2], sizes = [100], strides = [100]} : vector<4x8x16xf32> to vector<100x8x16xf32> 613} 614 615// ----- 616 617func.func @extract_strided_slice(%arg0: vector<4x8x16xf32>) { 618 // expected-error@+1 {{op expected strides to be confined to [1, 2)}} 619 %1 = vector.extract_strided_slice %arg0 {offsets = [2], sizes = [1], strides = [100]} : vector<4x8x16xf32> to vector<1x8x16xf32> 620} 621 622// ----- 623 624func.func @extract_strided_slice(%arg0: vector<4x8x16xf32>) { 625 // expected-error@+1 {{op expected strides to be confined to [1, 2)}} 626 %1 = vector.extract_strided_slice %arg0 {offsets = [2], sizes = [1], strides = [100]} : vector<4x8x16xf32> to vector<1x8x16xf32> 627} 628 629// ----- 630 631func.func @extract_strided_slice(%arg0: vector<4x8x16xf32>) { 632 // expected-error@+1 {{op expected sum(offsets, sizes) dimension 0 to be confined to [1, 5)}} 633 %1 = vector.extract_strided_slice %arg0 {offsets = [2], sizes = [3], strides = [1]} : vector<4x8x16xf32> to vector<3x8x16xf32> 634} 635 636// ----- 637 638func.func @extract_strided_slice(%arg0: vector<4x8x16xf32>) { 639 // expected-error@+1 {{op expected result type to be 'vector<2x8x16xf32>'}} 640 %1 = vector.extract_strided_slice %arg0 {offsets = [2], sizes = [2], strides = [1]} : vector<4x8x16xf32> to vector<3x1xf32> 641} 642 643// ----- 644 645#contraction_accesses = [ 646 affine_map<(b0, f0, f1, c0, c1) -> (c0, b0, c1, f0)>, 647 affine_map<(b0, f0, f1, c0, c1) -> (b0, c1, c0, f1)>, 648 affine_map<(b0, f0, f1, c0, c1) -> (b0, f0, f1)>, 649 affine_map<(b0, f0, f1, c0, c1) -> (b0, f0, f1)> 650] 651#contraction_trait = { 652 indexing_maps = #contraction_accesses, 653 iterator_types = ["parallel", "parallel", "parallel", "reduction", "reduction"] 654} 655func.func @contraction(%arg0: vector<7x8x16x15xf32>, %arg1: vector<8x16x7x5xf32>, 656 %arg2: vector<8x15x5xf32>, %arg3 : vector<8x15x8x5xf32>, 657 %arg4 : index) { 658 // expected-error@+1 {{expected an indexing map for each vector operand}} 659 %0 = vector.contract #contraction_trait %arg0, %arg1, %arg2 660 : vector<7x8x16x15xf32>, vector<8x16x7x5xf32> into vector<8x15x5xf32> 661} 662 663// ----- 664 665#contraction_accesses = [ 666 affine_map<(b0, f0, f1, c0, c1) -> (c0, c0, c1, f0)>, 667 affine_map<(b0, f0, f1, c0, c1) -> (b0, c1, c0, f1)>, 668 affine_map<(b0, f0, f1, c0, c1) -> (b0, f0, f1)> 669] 670#contraction_trait = { 671 indexing_maps = #contraction_accesses, 672 iterator_types = ["parallel", "parallel", "parallel", "reduction", "reduction"] 673} 674func.func @contraction(%arg0: vector<7x8x16x15xf32>, %arg1: vector<8x16x7x5xf32>, 675 %arg2: vector<8x15x5xf32>, %arg3 : vector<8x15x8x5xf32>, 676 %arg4 : index) { 677 // expected-error@+1 {{expected indexing map 0 to be a projected permutation of its inputs}} 678 %0 = vector.contract #contraction_trait %arg0, %arg1, %arg2 679 : vector<7x8x16x15xf32>, vector<8x16x7x5xf32> into vector<8x15x5xf32> 680} 681 682// ----- 683 684#contraction_accesses = [ 685 affine_map<(b0, f0, f1, c0, c1) -> (c0, b0, c1, f0)>, 686 affine_map<(b0, f0, f1, c0, c1)[s0] -> (b0, s0, c0, f1)>, 687 affine_map<(b0, f0, f1, c0, c1) -> (b0, f0, f1)> 688] 689#contraction_trait = { 690 indexing_maps = #contraction_accesses, 691 iterator_types = ["parallel", "parallel", "parallel", "reduction", "reduction"] 692} 693func.func @contraction(%arg0: vector<7x8x16x15xf32>, %arg1: vector<8x16x7x5xf32>, 694 %arg2: vector<8x15x5xf32>, %arg3 : vector<8x15x8x5xf32>, 695 %arg4 : index) { 696 // expected-error@+1 {{op expected indexing map 1 to have no symbols}} 697 %0 = vector.contract #contraction_trait %arg0, %arg1, %arg2 698 : vector<7x8x16x15xf32>, vector<8x16x7x5xf32> into vector<8x15x5xf32> 699} 700 701// ----- 702 703#contraction_accesses = [ 704 affine_map<(b0, f0, f1, c0, c1) -> (c0, b0, c1, f0)>, 705 affine_map<(b0, f0, f1, c0, c1) -> (b0, c1, c0, f1)>, 706 affine_map<(b0, f0, f1, c1) -> (b0, f0, f1)> 707] 708#contraction_trait = { 709 indexing_maps = #contraction_accesses, 710 iterator_types = ["parallel", "parallel", "parallel", "reduction", "reduction"] 711} 712func.func @contraction(%arg0: vector<7x8x16x15xf32>, %arg1: vector<8x16x7x5xf32>, 713 %arg2: vector<8x15x5xf32>, %arg3 : vector<8x15x8x5xf32>, 714 %arg4 : index) { 715 // expected-error@+1 {{expected indexing map 2 to have 5 number of inputs}} 716 %0 = vector.contract #contraction_trait %arg0, %arg1, %arg2 717 : vector<7x8x16x15xf32>, vector<8x16x7x5xf32> into vector<8x15x5xf32> 718} 719 720// ----- 721 722#contraction_accesses = [ 723 affine_map<(b0, f0, f1, c0, c1) -> (c0, b0, c1, f0)>, 724 affine_map<(b0, f0, f1, c0, c1) -> (b0, c1, f1)>, 725 affine_map<(b0, f0, f1, c0, c1) -> (b0, f0, f1)> 726] 727#contraction_trait = { 728 indexing_maps = #contraction_accesses, 729 iterator_types = ["parallel", "parallel", "parallel", "reduction", "reduction"] 730} 731func.func @contraction(%arg0: vector<7x8x16x15xf32>, %arg1: vector<8x16x7x5xf32>, 732 %arg2: vector<8x15x5xf32>, %arg3 : vector<8x15x8x5xf32>, 733 %arg4 : index) { 734 // expected-error@+1 {{expected indexing map 1 to have 4 number of outputs}} 735 %0 = vector.contract #contraction_trait %arg0, %arg1, %arg2 736 : vector<7x8x16x15xf32>, vector<8x16x7x5xf32> into vector<8x15x5xf32> 737} 738 739// ----- 740 741#contraction_accesses = [ 742 affine_map<(b0, f0, f1, b1, b2) -> (b1, b0, b2, f0)>, 743 affine_map<(b0, f0, f1, b1, b2) -> (b0, b2, b1, f1)>, 744 affine_map<(b0, f0, f1, b1, b2) -> (b0, f0, f1)> 745] 746#contraction_trait = { 747 indexing_maps = #contraction_accesses, 748 iterator_types = ["parallel", "parallel", "parallel", "parallel", "parallel"] 749} 750func.func @contraction(%arg0: vector<7x8x16x15xf32>, %arg1: vector<8x16x7x5xf32>, 751 %arg2: vector<8x15x5xf32>, %arg3 : vector<8x15x8x5xf32>, 752 %arg4 : index) { 753 // expected-error@+1 {{op expected at least one contracting dimension pair}} 754 %0 = vector.contract #contraction_trait %arg0, %arg1, %arg2 755 : vector<7x8x16x15xf32>, vector<8x16x7x5xf32> into vector<8x15x5xf32> 756} 757 758// ----- 759 760#contraction_accesses = [ 761 affine_map<(b0, f0, f1, c0, c1) -> (c1, b0, c0, f0)>, 762 affine_map<(b0, f0, f1, c0, c1) -> (b0, c1, c0, f1)>, 763 affine_map<(b0, f0, f1, c0, c1) -> (b0, f0, f1)> 764] 765#contraction_trait = { 766 indexing_maps = #contraction_accesses, 767 iterator_types = ["parallel", "parallel", "parallel", "reduction", "reduction"] 768} 769func.func @contraction(%arg0: vector<7x8x16x15xf32>, %arg1: vector<8x16x7x5xf32>, 770 %arg2: vector<8x15x5xf32>, %arg3 : vector<8x15x8x5xf32>, 771 %arg4 : index) { 772 // expected-error@+1 {{invalid contracting dimension map}} 773 %0 = vector.contract #contraction_trait %arg0, %arg1, %arg2 774 : vector<7x8x16x15xf32>, vector<8x16x7x5xf32> into vector<8x15x5xf32> 775} 776 777// ----- 778 779#contraction_accesses = [ 780 affine_map<(b0, f0, f1, c0, c1) -> (c0, b0, c1, f0)>, 781 affine_map<(b0, f0, f1, c0, c1) -> (f1, c1, c0, b0)>, 782 affine_map<(b0, f0, f1, c0, c1) -> (b0, f0, f1)> 783] 784#contraction_trait = { 785 indexing_maps = #contraction_accesses, 786 iterator_types = ["parallel", "parallel", "parallel", "reduction", "reduction"] 787} 788func.func @contraction(%arg0: vector<7x8x16x15xf32>, %arg1: vector<8x16x7x5xf32>, 789 %arg2: vector<8x15x5xf32>, %arg3 : vector<8x15x8x5xf32>, 790 %arg4 : index) { 791 // expected-error@+1 {{invalid batch dimension map}} 792 %0 = vector.contract #contraction_trait %arg0, %arg1, %arg2 793 : vector<7x8x16x15xf32>, vector<8x16x7x5xf32> into vector<8x15x5xf32> 794} 795 796// ----- 797 798#contraction_accesses = [ 799 affine_map<(b0, f0, f1, c0, c1) -> (c0, b0, c1, f0)>, 800 affine_map<(b0, f0, f1, c0, c1) -> (b0, c1, c0, f1)>, 801 affine_map<(b0, f0, f1, c0, c1) -> (b0, f0, f1)> 802] 803#contraction_trait = { 804 indexing_maps = #contraction_accesses, 805 iterator_types = ["parallel", "parallel", "parallel", "reduction", "reduction"] 806} 807func.func @contraction(%arg0: vector<7x8x16x15xf32>, %arg1: vector<8x16x7x5xf32>, 808 %arg2: vector<88x15x5xf32>, %arg3 : vector<8x15x8x5xf32>, 809 %arg4 : index) { 810 // expected-error@+1 {{invalid accumulator/result vector shape}} 811 %0 = vector.contract #contraction_trait %arg0, %arg1, %arg2 812 : vector<7x8x16x15xf32>, vector<8x16x7x5xf32> into vector<88x15x5xf32> 813} 814 815// ----- 816 817#contraction_accesses = [ 818 affine_map<(b0, f0, f1, c0, c1) -> (c0, b0, c1, f0)>, 819 affine_map<(b0, f0, f1, c0, c1) -> (b0, c1, c0, f1)>, 820 affine_map<(b0, f0, f1, c0, c1) -> (b0, f0, f1)> 821] 822#contraction_trait = { 823 indexing_maps = #contraction_accesses, 824 iterator_types = ["parallel", "parallel", "parallel", "reduction", "reduction"] 825} 826func.func @contraction(%arg0: vector<7x8x16x15xf32>, %arg1: vector<8x16x7x5xf32>, 827 %arg2: vector<8x15x5xf32>, %arg3 : vector<8x15x8x5xf32>, 828 %arg4 : index) { 829 %lhs_mask = vector.constant_mask [7, 8, 16, 15] : vector<7x8x16x15xi1> 830 %rhs_mask = vector.constant_mask [8, 16, 7, 5] : vector<8x16x7x5xi1> 831 // expected-error@+1 {{expected zero or exactly 2 vector mask operands}} 832 %0 = vector.contract #contraction_trait %arg0, %arg1, %arg2, %lhs_mask 833 : vector<7x8x16x15xf32>, vector<8x16x7x5xf32> into vector<8x15x5xf32> 834} 835 836// ----- 837 838#contraction_accesses = [ 839 affine_map<(i, j, k) -> (i, k)>, 840 affine_map<(i, j, k) -> (k, j)>, 841 affine_map<(i, j, k) -> (i, j)> 842 ] 843#contraction_trait = { 844 indexing_maps = #contraction_accesses, 845 iterator_types = ["parallel", "parallel", "reduction"] 846 } 847func.func @contraction(%arg0: vector<4x3xi32>, 848 %arg1: vector<3x7xf32>, 849 %arg2: vector<4x7xf32>) -> vector<4x7xf32> { 850 // expected-error@+1 {{'vector.contract' op failed to verify that lhs and rhs have same element type}} 851 %0 = vector.contract #contraction_trait %arg0, %arg1, %arg2 852 : vector<4x3xi32>, vector<3x7xf32> into vector<4x7xf32> 853} 854 855// ----- 856 857#contraction_accesses = [ 858 affine_map<(m, n, k) -> (m, k)>, 859 affine_map<(m, n, k) -> (k, n)>, 860 affine_map<(m, n, k) -> (n, m)> 861] 862#contraction_trait = { 863 indexing_maps = #contraction_accesses, 864 iterator_types = ["parallel", "parallel", "reduction"] 865} 866func.func @contraction(%arg0: vector<2x1xf32>, %arg1: vector<1x3xf32>, %arg2: vector<2x3xf32>) 867-> vector<3x2xf32> 868{ 869// expected-error@+1 {{invalid accumulator/result vector shape, expected: 'vector<3x2xf32>'}} 870 %0 = vector.contract #contraction_trait %arg0, %arg1, %arg2 871 : vector<2x1xf32>, vector<1x3xf32> into vector<2x3xf32> 872 return %0 : vector<2x3xf32> 873} 874 875// ----- 876 877func.func @create_mask_0d_no_operands() { 878 %c1 = arith.constant 1 : index 879 // expected-error@+1 {{must specify exactly one operand for 0-D create_mask}} 880 %0 = vector.create_mask : vector<i1> 881} 882 883// ----- 884 885func.func @create_mask_0d_many_operands() { 886 %c1 = arith.constant 1 : index 887 %c2 = arith.constant 2 : index 888 %c3 = arith.constant 3 : index 889 // expected-error@+1 {{must specify exactly one operand for 0-D create_mask}} 890 %0 = vector.create_mask %c1, %c2, %c3 : vector<i1> 891} 892 893// ----- 894 895func.func @create_mask() { 896 %c2 = arith.constant 2 : index 897 %c3 = arith.constant 3 : index 898 // expected-error@+1 {{must specify an operand for each result vector dimension}} 899 %0 = vector.create_mask %c3, %c2 : vector<4x3x7xi1> 900} 901 902 903// ----- 904 905func.func @constant_mask_0d_no_attr() { 906 // expected-error@+1 {{array attr must have length 1 for 0-D vectors}} 907 %0 = vector.constant_mask [] : vector<i1> 908} 909 910// ----- 911 912func.func @constant_mask_0d_bad_attr() { 913 // expected-error@+1 {{mask dim size must be either 0 or 1 for 0-D vectors}} 914 %0 = vector.constant_mask [2] : vector<i1> 915} 916 917// ----- 918 919func.func @constant_mask() { 920 // expected-error@+1 {{must specify array attr of size equal vector result rank}} 921 %0 = vector.constant_mask [3, 2, 7] : vector<4x3xi1> 922} 923 924// ----- 925 926func.func @constant_mask_out_of_bounds() { 927 // expected-error@+1 {{array attr of size out of bounds of vector result dimension size}} 928 %0 = vector.constant_mask [-1, 2] : vector<4x3xi1> 929} 930 931// ----- 932 933func.func @constant_mask_out_of_bounds() { 934 // expected-error@+1 {{array attr of size out of bounds of vector result dimension size}} 935 %0 = vector.constant_mask [3, 4] : vector<4x3xi1> 936} 937 938// ----- 939 940func.func @constant_mask_with_zero_mask_dim_size() { 941 // expected-error@+1 {{expected all mask dim sizes to be zeros, as a result of conjunction with zero mask dim}} 942 %0 = vector.constant_mask [0, 2] : vector<4x3xi1> 943} 944 945// ----- 946 947func.func @constant_mask_scalable_non_zero_dim_size() { 948 // expected-error@+1 {{expected mask dim sizes for scalable masks to be 0}} 949 %0 = vector.constant_mask [2] : vector<[8]xi1> 950} 951 952// ----- 953 954func.func @print_no_result(%arg0 : f32) -> i32 { 955 // expected-error@+1 {{cannot name an operation with no results}} 956 %0 = vector.print %arg0 : f32 957} 958 959// ----- 960 961func.func @reshape_bad_input_shape(%arg0 : vector<3x2x4xf32>) { 962 %c2 = arith.constant 2 : index 963 %c3 = arith.constant 3 : index 964 %c6 = arith.constant 6 : index 965 %c9 = arith.constant 9 : index 966 // expected-error@+1 {{invalid input shape for vector type}} 967 %1 = vector.reshape %arg0, [%c3, %c6, %c3], [%c2, %c9], [4] 968 : vector<3x2x4xf32> to vector<2x3x4xf32> 969} 970 971// ----- 972 973func.func @reshape_bad_output_shape(%arg0 : vector<3x2x4xf32>) { 974 %c2 = arith.constant 2 : index 975 %c3 = arith.constant 3 : index 976 %c6 = arith.constant 6 : index 977 %c9 = arith.constant 9 : index 978 // expected-error@+1 {{invalid output shape for vector type}} 979 %1 = vector.reshape %arg0, [%c3, %c6], [%c2, %c9, %c3], [4] 980 : vector<3x2x4xf32> to vector<2x3x4xf32> 981} 982 983// ----- 984 985func.func @reshape_bad_input_output_shape_product(%arg0 : vector<3x2x4xf32>) { 986 %c2 = arith.constant 2 : index 987 %c3 = arith.constant 3 : index 988 %c6 = arith.constant 6 : index 989 %c9 = arith.constant 9 : index 990 // expected-error@+1 {{product of input and output shape sizes must match}} 991 %1 = vector.reshape %arg0, [%c3, %c6], [%c2, %c6], [4] 992 : vector<3x2x4xf32> to vector<2x3x4xf32> 993} 994 995// ----- 996 997func.func @reshape_bad_input_fixed_size(%arg0 : vector<3x2x5xf32>) { 998 %c2 = arith.constant 2 : index 999 %c3 = arith.constant 3 : index 1000 %c6 = arith.constant 6 : index 1001 %c9 = arith.constant 9 : index 1002 // expected-error@+1 {{fixed vector size must match input vector for dim 0}} 1003 %1 = vector.reshape %arg0, [%c3, %c6], [%c2, %c9], [4] 1004 : vector<3x2x5xf32> to vector<2x3x4xf32> 1005} 1006 1007// ----- 1008 1009func.func @reshape_bad_output_fixed_size(%arg0 : vector<3x2x4xf32>) { 1010 %c2 = arith.constant 2 : index 1011 %c3 = arith.constant 3 : index 1012 %c6 = arith.constant 6 : index 1013 %c9 = arith.constant 9 : index 1014 // expected-error@+1 {{fixed vector size must match output vector for dim 0}} 1015 %1 = vector.reshape %arg0, [%c3, %c6], [%c2, %c9], [4] 1016 : vector<3x2x4xf32> to vector<2x3x5xf32> 1017} 1018 1019// ----- 1020 1021func.func @shape_cast_wrong_element_type(%arg0 : vector<5x1x3x2xf32>) { 1022 // expected-error@+1 {{op source/result vectors must have same element type}} 1023 %0 = vector.shape_cast %arg0 : vector<5x1x3x2xf32> to vector<15x2xi32> 1024} 1025 1026// ----- 1027 1028func.func @shape_cast_wrong_num_elements(%arg0 : vector<5x1x3x2xf32>) { 1029 // expected-error@+1 {{op source/result number of elements must match}} 1030 %0 = vector.shape_cast %arg0 : vector<5x1x3x2xf32> to vector<10x2xf32> 1031} 1032 1033// ----- 1034 1035func.func @shape_cast_invalid_rank_reduction(%arg0 : vector<5x1x3x2xf32>) { 1036 // expected-error@+1 {{invalid shape cast}} 1037 %0 = vector.shape_cast %arg0 : vector<5x1x3x2xf32> to vector<2x15xf32> 1038} 1039 1040// ----- 1041 1042func.func @shape_cast_invalid_rank_expansion(%arg0 : vector<15x2xf32>) { 1043 // expected-error@+1 {{invalid shape cast}} 1044 %0 = vector.shape_cast %arg0 : vector<15x2xf32> to vector<5x2x3x1xf32> 1045} 1046 1047// ----- 1048 1049func.func @bitcast_not_vector(%arg0 : vector<5x1x3x2xf32>) { 1050 // expected-error@+1 {{'vector.bitcast' invalid kind of type specified}} 1051 %0 = vector.bitcast %arg0 : vector<5x1x3x2xf32> to f32 1052} 1053 1054// ----- 1055 1056func.func @bitcast_rank_mismatch_to_0d(%arg0 : vector<1xf32>) { 1057 // expected-error@+1 {{op failed to verify that all of {source, result} have same rank}} 1058 %0 = vector.bitcast %arg0 : vector<1xf32> to vector<f32> 1059} 1060 1061// ----- 1062 1063func.func @bitcast_rank_mismatch_from_0d(%arg0 : vector<f32>) { 1064 // expected-error@+1 {{op failed to verify that all of {source, result} have same rank}} 1065 %0 = vector.bitcast %arg0 : vector<f32> to vector<1xf32> 1066} 1067 1068// ----- 1069 1070func.func @bitcast_rank_mismatch(%arg0 : vector<5x1x3x2xf32>) { 1071 // expected-error@+1 {{op failed to verify that all of {source, result} have same rank}} 1072 %0 = vector.bitcast %arg0 : vector<5x1x3x2xf32> to vector<5x3x2xf32> 1073} 1074 1075// ----- 1076 1077func.func @bitcast_shape_mismatch(%arg0 : vector<5x1x3x2xf32>) { 1078 // expected-error@+1 {{op dimension size mismatch}} 1079 %0 = vector.bitcast %arg0 : vector<5x1x3x2xf32> to vector<5x2x3x2xf32> 1080} 1081 1082// ----- 1083 1084func.func @bitcast_sizemismatch(%arg0 : vector<5x1x3x2xf32>) { 1085 // expected-error@+1 {{op source/result bitwidth of the minor 1-D vectors must be equal}} 1086 %0 = vector.bitcast %arg0 : vector<5x1x3x2xf32> to vector<5x1x3x3xf16> 1087} 1088 1089// ----- 1090 1091func.func @reduce_unknown_kind(%arg0: vector<16xf32>) -> f32 { 1092 // expected-error@+1 {{custom op 'vector.reduction' Unknown combining kind: joho}} 1093 %0 = vector.reduction <joho>, %arg0 : vector<16xf32> into f32 1094} 1095 1096// ----- 1097 1098func.func @reduce_elt_type_mismatch(%arg0: vector<16xf32>) -> i32 { 1099 // expected-error@+1 {{'vector.reduction' op failed to verify that source operand and result have same element type}} 1100 %0 = vector.reduction <add>, %arg0 : vector<16xf32> into i32 1101} 1102 1103// ----- 1104 1105func.func @reduce_unsupported_attr(%arg0: vector<16xf32>) -> i32 { 1106 // expected-error@+1 {{expected '<'}} 1107 %0 = vector.reduction 1234, %arg0 : vector<16xf32> into i32 1108} 1109 1110// ----- 1111 1112func.func @reduce_unsupported_third_argument(%arg0: vector<16xf32>, %arg1: f32) -> f32 { 1113 // expected-error@+1 {{'vector.reduction' unsupported number of operands}} 1114 %0 = vector.reduction <add>, %arg0, %arg1, %arg1 : vector<16xf32> into f32 1115} 1116 1117// ----- 1118 1119func.func @reduce_unsupported_accumulator_kind(%arg0: vector<16xf32>, %arg1: f32) -> f32 { 1120 // expected-error@+1 {{'vector.reduction' op no accumulator for reduction kind: min}} 1121 %0 = vector.reduction <minf>, %arg0, %arg1 : vector<16xf32> into f32 1122} 1123 1124// ----- 1125 1126func.func @reduce_unsupported_accumulator_type(%arg0: vector<16xi32>, %arg1: i32) -> i32 { 1127 // expected-error@+1 {{'vector.reduction' op no accumulator for type: 'i32'}} 1128 %0 = vector.reduction <add>, %arg0, %arg1 : vector<16xi32> into i32 1129} 1130 1131// ----- 1132 1133func.func @reduce_unsupported_type(%arg0: vector<16xf32>) -> f32 { 1134 // expected-error@+1 {{'vector.reduction' op unsupported reduction type}} 1135 %0 = vector.reduction <xor>, %arg0 : vector<16xf32> into f32 1136} 1137 1138// ----- 1139 1140func.func @reduce_unsupported_rank(%arg0: vector<4x16xf32>) -> f32 { 1141 // expected-error@+1 {{'vector.reduction' op unsupported reduction rank: 2}} 1142 %0 = vector.reduction <add>, %arg0 : vector<4x16xf32> into f32 1143} 1144 1145// ----- 1146 1147func.func @multi_reduce_invalid_type(%arg0: vector<4x16xf32>) -> f32 { 1148 // expected-error@+1 {{'vector.multi_reduction' op inferred type(s) 'vector<4xf32>' are incompatible with return type(s) of operation 'vector<16xf32>'}} 1149 %0 = vector.multi_reduction <mul>, %arg0 [1] : vector<4x16xf32> to vector<16xf32> 1150} 1151 1152// ----- 1153 1154func.func @transpose_rank_mismatch(%arg0: vector<4x16x11xf32>) { 1155 // expected-error@+1 {{'vector.transpose' op vector result rank mismatch: 1}} 1156 %0 = vector.transpose %arg0, [2, 1, 0] : vector<4x16x11xf32> to vector<100xf32> 1157} 1158 1159// ----- 1160 1161func.func @transpose_length_mismatch(%arg0: vector<4x4xf32>) { 1162 // expected-error@+1 {{'vector.transpose' op transposition length mismatch: 3}} 1163 %0 = vector.transpose %arg0, [2, 0, 1] : vector<4x4xf32> to vector<4x4xf32> 1164} 1165 1166// ----- 1167 1168func.func @transpose_index_oob(%arg0: vector<4x4xf32>) { 1169 // expected-error@+1 {{'vector.transpose' op transposition index out of range: 2}} 1170 %0 = vector.transpose %arg0, [2, 0] : vector<4x4xf32> to vector<4x4xf32> 1171} 1172 1173// ----- 1174 1175func.func @transpose_index_dup(%arg0: vector<4x4xf32>) { 1176 // expected-error@+1 {{'vector.transpose' op duplicate position index: 0}} 1177 %0 = vector.transpose %arg0, [0, 0] : vector<4x4xf32> to vector<4x4xf32> 1178} 1179 1180// ----- 1181 1182func.func @transpose_dim_size_mismatch(%arg0: vector<11x7x3x2xi32>) { 1183 // expected-error@+1 {{'vector.transpose' op dimension size mismatch at: 0}} 1184 %0 = vector.transpose %arg0, [3, 0, 1, 2] : vector<11x7x3x2xi32> to vector<2x3x7x11xi32> 1185} 1186 1187// ----- 1188 1189func.func @flat_transpose_type_mismatch(%arg0: vector<16xf32>) { 1190 // expected-error@+1 {{'vector.flat_transpose' op failed to verify that source operand and result have same element type}} 1191 %0 = vector.flat_transpose %arg0 { rows = 4: i32, columns = 4: i32 } : vector<16xf32> -> vector<16xf64> 1192} 1193 1194// ----- 1195 1196func.func @type_cast_layout(%arg0: memref<4x3xf32, affine_map<(d0, d1)[s0, s1, s2] -> (d0 * s0 + d1 * s1 + s2)>>) { 1197 // expected-error@+1 {{expects operand to be a memref with identity layout}} 1198 %0 = vector.type_cast %arg0: memref<4x3xf32, affine_map<(d0, d1)[s0, s1, s2] -> (d0 * s0 + d1 * s1 + s2)>> to memref<vector<4x3xf32>> 1199} 1200 1201// ----- 1202 1203func.func @store_unsupported_layout(%memref : memref<200x100xf32, affine_map<(d0, d1) -> (200*d0 + 2*d1)>>, 1204 %i : index, %j : index, %value : vector<8xf32>) { 1205 // expected-error@+1 {{'vector.store' op most minor memref dim must have unit stride}} 1206 vector.store %value, %memref[%i, %j] : memref<200x100xf32, affine_map<(d0, d1) -> (200*d0 + 2*d1)>>, 1207 vector<8xf32> 1208 return 1209} 1210 1211// ----- 1212 1213func.func @vector_memref_mismatch(%memref : memref<200x100xvector<4xf32>>, %i : index, 1214 %j : index, %value : vector<8xf32>) { 1215 // expected-error@+1 {{'vector.store' op base memref and valueToStore vector types should match}} 1216 vector.store %value, %memref[%i, %j] : memref<200x100xvector<4xf32>>, vector<8xf32> 1217} 1218 1219// ----- 1220 1221func.func @store_base_type_mismatch(%base : memref<?xf64>, %value : vector<16xf32>) { 1222 %c0 = arith.constant 0 : index 1223 // expected-error@+1 {{'vector.store' op base and valueToStore element type should match}} 1224 vector.store %value, %base[%c0] : memref<?xf64>, vector<16xf32> 1225} 1226 1227// ----- 1228 1229func.func @store_memref_index_mismatch(%base : memref<?xf32>, %value : vector<16xf32>) { 1230 // expected-error@+1 {{'vector.store' op requires 1 indices}} 1231 vector.store %value, %base[] : memref<?xf32>, vector<16xf32> 1232} 1233 1234// ----- 1235 1236func.func @maskedload_base_type_mismatch(%base: memref<?xf64>, %mask: vector<16xi1>, %pass: vector<16xf32>) { 1237 %c0 = arith.constant 0 : index 1238 // expected-error@+1 {{'vector.maskedload' op base and result element type should match}} 1239 %0 = vector.maskedload %base[%c0], %mask, %pass : memref<?xf64>, vector<16xi1>, vector<16xf32> into vector<16xf32> 1240} 1241 1242// ----- 1243 1244func.func @maskedload_dim_mask_mismatch(%base: memref<?xf32>, %mask: vector<15xi1>, %pass: vector<16xf32>) { 1245 %c0 = arith.constant 0 : index 1246 // expected-error@+1 {{'vector.maskedload' op expected result dim to match mask dim}} 1247 %0 = vector.maskedload %base[%c0], %mask, %pass : memref<?xf32>, vector<15xi1>, vector<16xf32> into vector<16xf32> 1248} 1249 1250// ----- 1251 1252func.func @maskedload_pass_thru_type_mask_mismatch(%base: memref<?xf32>, %mask: vector<16xi1>, %pass: vector<16xi32>) { 1253 %c0 = arith.constant 0 : index 1254 // expected-error@+1 {{'vector.maskedload' op expected pass_thru of same type as result type}} 1255 %0 = vector.maskedload %base[%c0], %mask, %pass : memref<?xf32>, vector<16xi1>, vector<16xi32> into vector<16xf32> 1256} 1257 1258// ----- 1259 1260func.func @maskedload_memref_mismatch(%base: memref<?xf32>, %mask: vector<16xi1>, %pass: vector<16xf32>) { 1261 // expected-error@+1 {{'vector.maskedload' op requires 1 indices}} 1262 %0 = vector.maskedload %base[], %mask, %pass : memref<?xf32>, vector<16xi1>, vector<16xf32> into vector<16xf32> 1263} 1264 1265// ----- 1266 1267func.func @maskedstore_base_type_mismatch(%base: memref<?xf64>, %mask: vector<16xi1>, %value: vector<16xf32>) { 1268 %c0 = arith.constant 0 : index 1269 // expected-error@+1 {{'vector.maskedstore' op base and valueToStore element type should match}} 1270 vector.maskedstore %base[%c0], %mask, %value : memref<?xf64>, vector<16xi1>, vector<16xf32> 1271} 1272 1273// ----- 1274 1275func.func @maskedstore_dim_mask_mismatch(%base: memref<?xf32>, %mask: vector<15xi1>, %value: vector<16xf32>) { 1276 %c0 = arith.constant 0 : index 1277 // expected-error@+1 {{'vector.maskedstore' op expected valueToStore dim to match mask dim}} 1278 vector.maskedstore %base[%c0], %mask, %value : memref<?xf32>, vector<15xi1>, vector<16xf32> 1279} 1280 1281// ----- 1282 1283func.func @maskedstore_memref_mismatch(%base: memref<?xf32>, %mask: vector<16xi1>, %value: vector<16xf32>) { 1284 %c0 = arith.constant 0 : index 1285 // expected-error@+1 {{'vector.maskedstore' op requires 1 indices}} 1286 vector.maskedstore %base[%c0, %c0], %mask, %value : memref<?xf32>, vector<16xi1>, vector<16xf32> 1287} 1288 1289// ----- 1290 1291func.func @gather_base_type_mismatch(%base: memref<?xf64>, %indices: vector<16xi32>, 1292 %mask: vector<16xi1>, %pass_thru: vector<16xf32>) { 1293 %c0 = arith.constant 0 : index 1294 // expected-error@+1 {{'vector.gather' op base and result element type should match}} 1295 %0 = vector.gather %base[%c0][%indices], %mask, %pass_thru 1296 : memref<?xf64>, vector<16xi32>, vector<16xi1>, vector<16xf32> into vector<16xf32> 1297} 1298 1299// ----- 1300 1301func.func @gather_memref_mismatch(%base: memref<?x?xf64>, %indices: vector<16xi32>, 1302 %mask: vector<16xi1>, %pass_thru: vector<16xf64>) { 1303 %c0 = arith.constant 0 : index 1304 // expected-error@+1 {{'vector.gather' op requires 2 indices}} 1305 %0 = vector.gather %base[%c0][%indices], %mask, %pass_thru 1306 : memref<?x?xf64>, vector<16xi32>, vector<16xi1>, vector<16xf64> into vector<16xf64> 1307} 1308 1309// ----- 1310 1311func.func @gather_rank_mismatch(%base: memref<?xf32>, %indices: vector<16xi32>, 1312 %mask: vector<16xi1>, %pass_thru: vector<16xf32>) { 1313 %c0 = arith.constant 0 : index 1314 // expected-error@+1 {{'vector.gather' op result #0 must be of ranks 1, but got 'vector<2x16xf32>'}} 1315 %0 = vector.gather %base[%c0][%indices], %mask, %pass_thru 1316 : memref<?xf32>, vector<16xi32>, vector<16xi1>, vector<16xf32> into vector<2x16xf32> 1317} 1318 1319// ----- 1320 1321func.func @gather_dim_indices_mismatch(%base: memref<?xf32>, %indices: vector<17xi32>, 1322 %mask: vector<16xi1>, %pass_thru: vector<16xf32>) { 1323 %c0 = arith.constant 0 : index 1324 // expected-error@+1 {{'vector.gather' op expected result dim to match indices dim}} 1325 %0 = vector.gather %base[%c0][%indices], %mask, %pass_thru 1326 : memref<?xf32>, vector<17xi32>, vector<16xi1>, vector<16xf32> into vector<16xf32> 1327} 1328 1329// ----- 1330 1331func.func @gather_dim_mask_mismatch(%base: memref<?xf32>, %indices: vector<16xi32>, 1332 %mask: vector<17xi1>, %pass_thru: vector<16xf32>) { 1333 %c0 = arith.constant 0 : index 1334 // expected-error@+1 {{'vector.gather' op expected result dim to match mask dim}} 1335 %0 = vector.gather %base[%c0][%indices], %mask, %pass_thru 1336 : memref<?xf32>, vector<16xi32>, vector<17xi1>, vector<16xf32> into vector<16xf32> 1337} 1338 1339// ----- 1340 1341func.func @gather_pass_thru_type_mismatch(%base: memref<?xf32>, %indices: vector<16xi32>, 1342 %mask: vector<16xi1>, %pass_thru: vector<16xf64>) { 1343 %c0 = arith.constant 0 : index 1344 // expected-error@+1 {{'vector.gather' op expected pass_thru of same type as result type}} 1345 %0 = vector.gather %base[%c0][%indices], %mask, %pass_thru 1346 : memref<?xf32>, vector<16xi32>, vector<16xi1>, vector<16xf64> into vector<16xf32> 1347} 1348 1349// ----- 1350 1351func.func @scatter_base_type_mismatch(%base: memref<?xf64>, %indices: vector<16xi32>, 1352 %mask: vector<16xi1>, %value: vector<16xf32>) { 1353 %c0 = arith.constant 0 : index 1354 // expected-error@+1 {{'vector.scatter' op base and valueToStore element type should match}} 1355 vector.scatter %base[%c0][%indices], %mask, %value 1356 : memref<?xf64>, vector<16xi32>, vector<16xi1>, vector<16xf32> 1357} 1358 1359// ----- 1360 1361func.func @scatter_memref_mismatch(%base: memref<?x?xf64>, %indices: vector<16xi32>, 1362 %mask: vector<16xi1>, %value: vector<16xf64>) { 1363 %c0 = arith.constant 0 : index 1364 // expected-error@+1 {{'vector.scatter' op requires 2 indices}} 1365 vector.scatter %base[%c0][%indices], %mask, %value 1366 : memref<?x?xf64>, vector<16xi32>, vector<16xi1>, vector<16xf64> 1367} 1368 1369// ----- 1370 1371func.func @scatter_rank_mismatch(%base: memref<?xf32>, %indices: vector<16xi32>, 1372 %mask: vector<16xi1>, %value: vector<2x16xf32>) { 1373 %c0 = arith.constant 0 : index 1374 // expected-error@+1 {{'vector.scatter' op operand #4 must be of ranks 1, but got 'vector<2x16xf32>'}} 1375 vector.scatter %base[%c0][%indices], %mask, %value 1376 : memref<?xf32>, vector<16xi32>, vector<16xi1>, vector<2x16xf32> 1377} 1378 1379// ----- 1380 1381func.func @scatter_dim_indices_mismatch(%base: memref<?xf32>, %indices: vector<17xi32>, 1382 %mask: vector<16xi1>, %value: vector<16xf32>) { 1383 %c0 = arith.constant 0 : index 1384 // expected-error@+1 {{'vector.scatter' op expected valueToStore dim to match indices dim}} 1385 vector.scatter %base[%c0][%indices], %mask, %value 1386 : memref<?xf32>, vector<17xi32>, vector<16xi1>, vector<16xf32> 1387} 1388 1389// ----- 1390 1391func.func @scatter_dim_mask_mismatch(%base: memref<?xf32>, %indices: vector<16xi32>, 1392 %mask: vector<17xi1>, %value: vector<16xf32>) { 1393 %c0 = arith.constant 0 : index 1394 // expected-error@+1 {{'vector.scatter' op expected valueToStore dim to match mask dim}} 1395 vector.scatter %base[%c0][%indices], %mask, %value 1396 : memref<?xf32>, vector<16xi32>, vector<17xi1>, vector<16xf32> 1397} 1398 1399// ----- 1400 1401func.func @expand_base_type_mismatch(%base: memref<?xf64>, %mask: vector<16xi1>, %pass_thru: vector<16xf32>) { 1402 %c0 = arith.constant 0 : index 1403 // expected-error@+1 {{'vector.expandload' op base and result element type should match}} 1404 %0 = vector.expandload %base[%c0], %mask, %pass_thru : memref<?xf64>, vector<16xi1>, vector<16xf32> into vector<16xf32> 1405} 1406 1407// ----- 1408 1409func.func @expand_dim_mask_mismatch(%base: memref<?xf32>, %mask: vector<17xi1>, %pass_thru: vector<16xf32>) { 1410 %c0 = arith.constant 0 : index 1411 // expected-error@+1 {{'vector.expandload' op expected result dim to match mask dim}} 1412 %0 = vector.expandload %base[%c0], %mask, %pass_thru : memref<?xf32>, vector<17xi1>, vector<16xf32> into vector<16xf32> 1413} 1414 1415// ----- 1416 1417func.func @expand_pass_thru_mismatch(%base: memref<?xf32>, %mask: vector<16xi1>, %pass_thru: vector<17xf32>) { 1418 %c0 = arith.constant 0 : index 1419 // expected-error@+1 {{'vector.expandload' op expected pass_thru of same type as result type}} 1420 %0 = vector.expandload %base[%c0], %mask, %pass_thru : memref<?xf32>, vector<16xi1>, vector<17xf32> into vector<16xf32> 1421} 1422 1423// ----- 1424 1425func.func @expand_memref_mismatch(%base: memref<?x?xf32>, %mask: vector<16xi1>, %pass_thru: vector<16xf32>) { 1426 %c0 = arith.constant 0 : index 1427 // expected-error@+1 {{'vector.expandload' op requires 2 indices}} 1428 %0 = vector.expandload %base[%c0], %mask, %pass_thru : memref<?x?xf32>, vector<16xi1>, vector<16xf32> into vector<16xf32> 1429} 1430 1431// ----- 1432 1433func.func @compress_base_type_mismatch(%base: memref<?xf64>, %mask: vector<16xi1>, %value: vector<16xf32>) { 1434 %c0 = arith.constant 0 : index 1435 // expected-error@+1 {{'vector.compressstore' op base and valueToStore element type should match}} 1436 vector.compressstore %base[%c0], %mask, %value : memref<?xf64>, vector<16xi1>, vector<16xf32> 1437} 1438 1439// ----- 1440 1441func.func @compress_dim_mask_mismatch(%base: memref<?xf32>, %mask: vector<17xi1>, %value: vector<16xf32>) { 1442 %c0 = arith.constant 0 : index 1443 // expected-error@+1 {{'vector.compressstore' op expected valueToStore dim to match mask dim}} 1444 vector.compressstore %base[%c0], %mask, %value : memref<?xf32>, vector<17xi1>, vector<16xf32> 1445} 1446 1447// ----- 1448 1449func.func @compress_memref_mismatch(%base: memref<?x?xf32>, %mask: vector<16xi1>, %value: vector<16xf32>) { 1450 %c0 = arith.constant 0 : index 1451 // expected-error@+1 {{'vector.compressstore' op requires 2 indices}} 1452 vector.compressstore %base[%c0, %c0, %c0], %mask, %value : memref<?x?xf32>, vector<16xi1>, vector<16xf32> 1453} 1454 1455// ----- 1456 1457func.func @extract_map_rank(%v: vector<32xf32>, %id : index) { 1458 // expected-error@+1 {{'vector.extract_map' op expected source and destination vectors of same rank}} 1459 %0 = vector.extract_map %v[%id] : vector<32xf32> to vector<2x1xf32> 1460} 1461 1462// ----- 1463 1464func.func @extract_map_size(%v: vector<63xf32>, %id : index) { 1465 // expected-error@+1 {{'vector.extract_map' op source vector dimensions must be a multiple of destination vector dimensions}} 1466 %0 = vector.extract_map %v[%id] : vector<63xf32> to vector<2xf32> 1467} 1468 1469// ----- 1470 1471func.func @extract_map_id(%v: vector<2x32xf32>, %id : index) { 1472 // expected-error@+1 {{'vector.extract_map' op expected number of ids must match the number of dimensions distributed}} 1473 %0 = vector.extract_map %v[%id] : vector<2x32xf32> to vector<1x1xf32> 1474} 1475 1476// ----- 1477 1478func.func @insert_map_rank(%v: vector<2x1xf32>, %v1: vector<32xf32>, %id : index) { 1479 // expected-error@+1 {{'vector.insert_map' op expected source and destination vectors of same rank}} 1480 %0 = vector.insert_map %v, %v1[%id] : vector<2x1xf32> into vector<32xf32> 1481} 1482 1483// ----- 1484 1485func.func @insert_map_size(%v: vector<3xf32>, %v1: vector<64xf32>, %id : index) { 1486 // expected-error@+1 {{'vector.insert_map' op destination vector size must be a multiple of source vector size}} 1487 %0 = vector.insert_map %v, %v1[%id] : vector<3xf32> into vector<64xf32> 1488} 1489 1490// ----- 1491 1492func.func @insert_map_id(%v: vector<2x1xf32>, %v1: vector<4x32xf32>, %id : index) { 1493 // expected-error@+1 {{'vector.insert_map' op expected number of ids must match the number of dimensions distributed}} 1494 %0 = vector.insert_map %v, %v1[%id] : vector<2x1xf32> into vector<4x32xf32> 1495} 1496 1497// ----- 1498 1499func.func @scan_reduction_dim_constraint(%arg0: vector<2x3xi32>, %arg1: vector<3xi32>) -> vector<3xi32> { 1500 // expected-error@+1 {{'vector.scan' op reduction dimension 5 has to be less than 2}} 1501 %0:2 = vector.scan <add>, %arg0, %arg1 {inclusive = true, reduction_dim = 5} : 1502 vector<2x3xi32>, vector<3xi32> 1503 return %0#1 : vector<3xi32> 1504} 1505 1506// ----- 1507 1508func.func @scan_ival_rank_constraint(%arg0: vector<2x3xi32>, %arg1: vector<1x3xi32>) -> vector<1x3xi32> { 1509 // expected-error@+1 {{initial value rank 2 has to be equal to 1}} 1510 %0:2 = vector.scan <add>, %arg0, %arg1 {inclusive = true, reduction_dim = 0} : 1511 vector<2x3xi32>, vector<1x3xi32> 1512 return %0#1 : vector<1x3xi32> 1513} 1514 1515// ----- 1516 1517func.func @scan_incompatible_shapes(%arg0: vector<2x3xi32>, %arg1: vector<5xi32>) -> vector<2x3xi32> { 1518 // expected-error@+1 {{incompatible input/initial value shapes}} 1519 %0:2 = vector.scan <add>, %arg0, %arg1 {inclusive = true, reduction_dim = 0} : 1520 vector<2x3xi32>, vector<5xi32> 1521 return %0#0 : vector<2x3xi32> 1522} 1523 1524// ----- 1525 1526func.func @scan_unsupported_kind(%arg0: vector<2x3xf32>, %arg1: vector<3xf32>) -> vector<2x3xf32> { 1527 // expected-error@+1 {{'vector.scan' op unsupported reduction type 'f32' for kind 'xor'}} 1528 %0:2 = vector.scan <xor>, %arg0, %arg1 {inclusive = true, reduction_dim = 0} : 1529 vector<2x3xf32>, vector<3xf32> 1530 return %0#0 : vector<2x3xf32> 1531} 1532 1533// ----- 1534 1535func.func @invalid_splat(%v : f32) { 1536 // expected-error@+1 {{invalid kind of type specified}} 1537 vector.splat %v : memref<8xf32> 1538 return 1539} 1540 1541// ----- 1542 1543func.func @warp_wrong_num_outputs(%laneid: index) { 1544 // expected-error@+1 {{'vector.warp_execute_on_lane_0' op expected same number of yield operands and return values.}} 1545 %2 = vector.warp_execute_on_lane_0(%laneid)[64] -> (vector<4xi32>) { 1546 } 1547 return 1548} 1549 1550// ----- 1551 1552func.func @warp_wrong_num_inputs(%laneid: index) { 1553 // expected-error@+1 {{'vector.warp_execute_on_lane_0' op expected same number op arguments and block arguments.}} 1554 vector.warp_execute_on_lane_0(%laneid)[64] { 1555 ^bb0(%arg0 : vector<128xi32>) : 1556 } 1557 return 1558} 1559 1560// ----- 1561 1562func.func @warp_wrong_return_distribution(%laneid: index) { 1563 // expected-error@+1 {{'vector.warp_execute_on_lane_0' op incompatible distribution dimensions from 'vector<128xi32>' to 'vector<4xi32>'}} 1564 %2 = vector.warp_execute_on_lane_0(%laneid)[64] -> (vector<4xi32>) { 1565 %0 = arith.constant dense<2>: vector<128xi32> 1566 vector.yield %0 : vector<128xi32> 1567 } 1568 return 1569} 1570 1571 1572// ----- 1573 1574func.func @warp_wrong_arg_distribution(%laneid: index, %v0 : vector<4xi32>) { 1575 // expected-error@+1 {{'vector.warp_execute_on_lane_0' op incompatible distribution dimensions from 'vector<128xi32>' to 'vector<4xi32>'}} 1576 vector.warp_execute_on_lane_0(%laneid)[64] 1577 args(%v0 : vector<4xi32>) { 1578 ^bb0(%arg0 : vector<128xi32>) : 1579 } 1580 return 1581} 1582 1583// ----- 1584 1585func.func @warp_2_distributed_dims(%laneid: index) { 1586 // expected-error@+1 {{'vector.warp_execute_on_lane_0' op expected only one dimension to be distributed from 'vector<128x128xi32>' to 'vector<4x4xi32>'}} 1587 %2 = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<4x4xi32>) { 1588 %0 = arith.constant dense<2>: vector<128x128xi32> 1589 vector.yield %0 : vector<128x128xi32> 1590 } 1591 return 1592} 1593 1594// ----- 1595 1596func.func @warp_mismatch_rank(%laneid: index) { 1597 // expected-error@+1 {{'vector.warp_execute_on_lane_0' op expected distributed vectors to have same rank and element type.}} 1598 %2 = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<4x4xi32>) { 1599 %0 = arith.constant dense<2>: vector<128xi32> 1600 vector.yield %0 : vector<128xi32> 1601 } 1602 return 1603} 1604 1605// ----- 1606 1607func.func @warp_mismatch_rank(%laneid: index) { 1608 // expected-error@+1 {{'vector.warp_execute_on_lane_0' op expected vector type for distributed operands.}} 1609 %2 = vector.warp_execute_on_lane_0(%laneid)[32] -> (i32) { 1610 %0 = arith.constant dense<2>: vector<128xi32> 1611 vector.yield %0 : vector<128xi32> 1612 } 1613 return 1614} 1615