1// RUN: mlir-opt -split-input-file -verify-diagnostics %s 2 3func @not_enough_sizes(%sz : index) { 4 // expected-error@+1 {{expected 6 or more operands, but found 5}} 5 "gpu.launch"(%sz, %sz, %sz, %sz, %sz) ({ 6 gpu.return 7 }) : (index, index, index, index, index) -> () 8 return 9} 10 11// ----- 12 13func @no_region_attrs(%sz : index) { 14 // expected-error@+1 {{unexpected number of region arguments}} 15 "gpu.launch"(%sz, %sz, %sz, %sz, %sz, %sz) ({ 16 ^bb1(%bx: index, %by: index, %bz: index, 17 %tx: index, %ty: index, %tz: index): 18 gpu.terminator 19 }) : (index, index, index, index, index, index) -> () 20 return 21} 22 23// ----- 24 25func @launch_requires_gpu_return(%sz : index) { 26 // @expected-note@+1 {{in 'gpu.launch' body region}} 27 gpu.launch blocks(%bx, %by, %bz) in (%sbx = %sz, %sby = %sz, %sbz = %sz) 28 threads(%tx, %ty, %tz) in (%stx = %sz, %sty = %sz, %stz = %sz) { 29 // @expected-error@+2 {{expected 'gpu.terminator' or a terminator with successors}} 30 %one = arith.constant 1 : i32 31 "gpu.yield"(%one) : (i32) -> () 32 } 33 return 34} 35 36// ----- 37 38func @launch_func_too_few_operands(%sz : index) { 39 // expected-error@+1 {{expected 6 or more operands}} 40 "gpu.launch_func"(%sz, %sz, %sz, %sz, %sz) 41 {operand_segment_sizes = dense<[0, 1, 1, 1, 1, 1, 0, 0]> : vector<8xi32>} 42 : (index, index, index, index, index) -> () 43 return 44} 45 46// ----- 47 48func @launch_func_missing_parent_module_attribute(%sz : index) { 49 // expected-error@+1 {{expected the closest surrounding module to have the 'gpu.container_module' attribute}} 50 gpu.launch_func @foo::@bar blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) 51 return 52} 53 54// ----- 55 56module attributes {gpu.container_module} { 57 func @launch_func_missing_callee_attribute(%sz : index) { 58 // expected-error@+1 {{'gpu.launch_func' op requires attribute 'kernel'}} 59 "gpu.launch_func"(%sz, %sz, %sz, %sz, %sz, %sz) 60 {operand_segment_sizes = dense<[0, 1, 1, 1, 1, 1, 1, 0, 0]> : vector<9xi32>} 61 : (index, index, index, index, index, index) -> () 62 return 63 } 64} 65 66// ----- 67 68module attributes {gpu.container_module} { 69 func @launch_func_no_function_attribute(%sz : index) { 70 // expected-error@+1 {{custom op 'gpu.launch_func' invalid kind of attribute specified}} 71 gpu.launch_func "foo" blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) 72 return 73 } 74} 75 76// ----- 77 78module attributes {gpu.container_module} { 79 func @launch_func_undefined_module(%sz : index) { 80 // expected-error@+1 {{kernel module 'kernels' is undefined}} 81 gpu.launch_func @kernels::@kernel_1 blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) 82 return 83 } 84} 85 86// ----- 87 88module attributes {gpu.container_module} { 89 module @kernels { 90 // expected-error@+1 {{'gpu.func' op expects parent op 'gpu.module'}} 91 gpu.func @kernel_1(%arg1 : !llvm.ptr<f32>) { 92 gpu.return 93 } 94 } 95} 96 97// ----- 98 99module attributes {gpu.container_module} { 100 module @kernels { 101 } 102 103 func @launch_func_missing_module_attribute(%sz : index) { 104 // expected-error@+1 {{kernel module 'kernels' is undefined}} 105 gpu.launch_func @kernels::@kernel_1 blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) 106 return 107 } 108} 109 110// ----- 111 112module attributes {gpu.container_module} { 113 gpu.module @kernels { } 114 115 func @launch_func_undefined_function(%sz : index) { 116 // expected-error@+1 {{kernel function '@kernels::@kernel_1' is undefined}} 117 gpu.launch_func @kernels::@kernel_1 blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) 118 return 119 } 120} 121 122// ----- 123 124module attributes {gpu.container_module} { 125 gpu.module @kernels { 126 // expected-note@+1 {{see the kernel definition here}} 127 memref.global "private" @kernel_1 : memref<4xi32> 128 } 129 130 func @launch_func_undefined_function(%sz : index) { 131 // expected-error@+1 {{referenced kernel '@kernels::@kernel_1' is not a function}} 132 gpu.launch_func @kernels::@kernel_1 blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) 133 return 134 } 135} 136 137// ----- 138 139module attributes {gpu.container_module} { 140 module @kernels { 141 gpu.func @kernel_1(%arg1 : !llvm.ptr<f32>) kernel { 142 gpu.return 143 } 144 } 145 146 func @launch_func_missing_kernel_attr(%sz : index, %arg : !llvm.ptr<f32>) { 147 // expected-error@+1 {{kernel module 'kernels' is undefined}} 148 gpu.launch_func @kernels::@kernel_1 blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) args(%arg : !llvm.ptr<f32>) 149 return 150 } 151} 152 153// ----- 154 155module attributes {gpu.container_module} { 156 gpu.module @kernels { 157 gpu.func @kernel_1(%arg1 : !llvm.ptr<f32>) { 158 gpu.return 159 } 160 } 161 162 func @launch_func_missing_kernel_attr(%sz : index, %arg : !llvm.ptr<f32>) { 163 // expected-error@+1 {{kernel function is missing the 'gpu.kernel' attribute}} 164 gpu.launch_func @kernels::@kernel_1 blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) args(%arg : !llvm.ptr<f32>) 165 return 166 } 167} 168 169// ----- 170 171module attributes {gpu.container_module} { 172 gpu.module @kernels { 173 gpu.func @kernel_1(%arg1 : !llvm.ptr<f32>) kernel { 174 gpu.return 175 } 176 } 177 178 func @launch_func_kernel_operand_size(%sz : index, %arg : !llvm.ptr<f32>) { 179 // expected-error@+1 {{got 2 kernel operands but expected 1}} 180 gpu.launch_func @kernels::@kernel_1 blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) args(%arg : !llvm.ptr<f32>, %arg : !llvm.ptr<f32>) 181 return 182 } 183} 184 185// ----- 186 187module attributes {gpu.container_module} { 188 gpu.module @kernels { 189 gpu.func @kernel_1(%arg1 : f32) kernel { 190 gpu.return 191 } 192 } 193 194 func @launch_func_kernel_operand_types(%sz : index, %arg : f32) { 195 // expected-err@+1 {{type of function argument 0 does not match}} 196 gpu.launch_func @kernels::@kernel_1 blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) args(%arg : f32) 197 return 198 } 199} 200 201// ----- 202 203module attributes {gpu.container_module} { 204 func @launch_func_kernel_operand_attr(%sz : index) { 205 // expected-error@+1 {{expected arguments without attributes}} 206 gpu.launch_func @foo::@bar blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) args(%sz : index {foo}) 207 return 208 } 209} 210 211// ----- 212 213func @reduce_no_op_no_body(%arg0 : f32) { 214 // expected-error@+1 {{expected either an op attribute or a non-empty body}} 215 %res = "gpu.all_reduce"(%arg0) ({}) : (f32) -> (f32) 216 return 217} 218 219// ----- 220 221func @reduce_op_and_body(%arg0 : f32) { 222 // expected-error@+1 {{expected either an op attribute or a non-empty body}} 223 %res = "gpu.all_reduce"(%arg0) ({ 224 ^bb(%lhs : f32, %rhs : f32): 225 "gpu.yield"(%lhs) : (f32) -> () 226 }) {op = #gpu<"all_reduce_op add">} : (f32) -> (f32) 227 return 228} 229 230// ----- 231 232func @reduce_invalid_op(%arg0 : f32) { 233 // expected-error@+1 {{invalid op kind}} 234 %res = gpu.all_reduce foo %arg0 {} : (f32) -> (f32) 235 return 236} 237 238// ----- 239 240func @reduce_invalid_op_type(%arg0 : f32) { 241 // expected-error@+1 {{`and` accumulator is only compatible with Integer type}} 242 %res = gpu.all_reduce and %arg0 {} : (f32) -> (f32) 243 return 244} 245 246// ----- 247 248func @reduce_incorrect_region_arguments(%arg0 : f32) { 249 // expected-error@+1 {{expected two region arguments}} 250 %res = gpu.all_reduce %arg0 { 251 ^bb(%lhs : f32): 252 "gpu.yield"(%lhs) : (f32) -> () 253 } : (f32) -> (f32) 254 return 255} 256 257// ----- 258 259func @reduce_incorrect_region_arguments(%arg0 : f32) { 260 // expected-error@+1 {{incorrect region argument type}} 261 %res = gpu.all_reduce %arg0 { 262 ^bb(%lhs : f32, %rhs : i32): 263 "gpu.yield"(%lhs) : (f32) -> () 264 } : (f32) -> (f32) 265 return 266} 267 268// ----- 269 270func @reduce_incorrect_yield(%arg0 : f32) { 271 // expected-error@+1 {{expected one gpu.yield operand}} 272 %res = gpu.all_reduce %arg0 { 273 ^bb(%lhs : f32, %rhs : f32): 274 "gpu.yield"(%lhs, %rhs) : (f32, f32) -> () 275 } : (f32) -> (f32) 276 return 277} 278 279// ----- 280 281func @reduce_incorrect_yield(%arg0 : f32) { 282 // expected-error@+1 {{incorrect gpu.yield type}} 283 %res = gpu.all_reduce %arg0 { 284 ^bb(%lhs : f32, %rhs : f32): 285 %one = arith.constant 1 : i32 286 "gpu.yield"(%one) : (i32) -> () 287 } : (f32) -> (f32) 288 return 289} 290 291// ----- 292 293func @reduce_incorrect_yield(%arg0 : f32) { 294 // expected-error@+1 {{expected gpu.yield op in region}} 295 %res = gpu.all_reduce %arg0 { 296 ^bb(%lhs : f32, %rhs : f32): 297 "test.finish" () : () -> () 298 } : (f32) -> (f32) 299 return 300} 301 302// ----- 303 304func @shuffle_mismatching_type(%arg0 : f32, %arg1 : i32, %arg2 : i32) { 305 // expected-error@+1 {{op failed to verify that all of {value, result} have same type}} 306 %shfl, %pred = "gpu.shuffle"(%arg0, %arg1, %arg2) { mode = #gpu<"shuffle_mode xor"> } : (f32, i32, i32) -> (i32, i1) 307 return 308} 309 310// ----- 311 312func @shuffle_unsupported_type(%arg0 : index, %arg1 : i32, %arg2 : i32) { 313 // expected-error@+1 {{operand #0 must be i32 or f32}} 314 %shfl, %pred = gpu.shuffle xor %arg0, %arg1, %arg2 : index 315 return 316} 317 318// ----- 319 320module { 321 gpu.module @gpu_funcs { 322 // expected-error @+1 {{custom op 'gpu.func' gpu.func requires named arguments}} 323 gpu.func @kernel_1(f32, f32) { 324 ^bb0(%arg0: f32): 325 gpu.return 326 } 327 } 328} 329 330// ----- 331 332module { 333 gpu.module @gpu_funcs { 334 // expected-error @+1 {{attribute 'function_type' failed to satisfy constraint: type attribute of function type}} 335 "gpu.func"() ({ 336 gpu.return 337 }) {sym_name="kernel_1", function_type=f32} : () -> () 338 } 339} 340 341// ----- 342 343module { 344 gpu.module @gpu_funcs { 345 // expected-error @+1 {{expected memref type in attribution}} 346 gpu.func @kernel() workgroup(%0: i32) { 347 gpu.return 348 } 349 } 350} 351 352// ----- 353 354module { 355 gpu.module @gpu_funcs { 356 // expected-error @+1 {{expected memory space 3 in attribution}} 357 gpu.func @kernel() workgroup(%0: memref<4xf32>) { 358 gpu.return 359 } 360 } 361} 362 363// ----- 364 365module { 366 gpu.module @gpu_funcs { 367 // expected-error @+1 {{expected memory space 5 in attribution}} 368 gpu.func @kernel() private(%0: memref<4xf32>) { 369 gpu.return 370 } 371 } 372} 373 374// ----- 375 376module { 377 gpu.module @gpu_funcs { 378 // expected-error @+1 {{expected memory space 5 in attribution}} 379 gpu.func @kernel() private(%0: memref<4xf32>) { 380 gpu.return 381 } 382 } 383} 384 385// ----- 386 387module { 388 gpu.module @gpu_funcs { 389 // expected-note @+1 {{return type declared here}} 390 gpu.func @kernel() { 391 %0 = arith.constant 0 : index 392 // expected-error @+1 {{'gpu.return' op expected 0 result operands}} 393 gpu.return %0 : index 394 } 395 } 396} 397 398// ----- 399 400module { 401 gpu.module @gpu_funcs { 402 // expected-error @+1 {{'gpu.func' op expected void return type for kernel function}} 403 gpu.func @kernel() -> index kernel { 404 %0 = arith.constant 0 : index 405 gpu.return 406 } 407 } 408} 409 410// ----- 411 412module { 413 gpu.module @gpu_funcs { 414 // expected-error @+1 {{'gpu.func' op expected at least 5 arguments to body region}} 415 "gpu.func"() ({ 416 ^bb0(%arg0: f32, %arg1: memref<?xf32>, %arg2: memref<5xf32, 3>, %arg3: memref<5xf32, 5>): 417 "gpu.return"() : () -> () 418 } ) {function_type = (f32, memref<?xf32>) -> (), gpu.kernel, sym_name = "kernel_1", workgroup_attributions = 3: i64} : () -> () 419 } 420} 421 422// ----- 423 424func @sync_wait_with_result() { 425 // expected-error @+1 {{cannot name an operation with no results}} 426 %t = gpu.wait 427} 428 429// ----- 430 431func @async_wait_without_result() { 432 // expected-error @+1 {{custom op 'gpu.wait' needs to be named when marked 'async'}} 433 gpu.wait async 434} 435 436// ----- 437 438func @memcpy_incompatible_type(%dst : memref<?xf32>, %src : memref<?xi32>) { 439 // expected-error @+1 {{'gpu.memcpy' op arguments have incompatible element type}} 440 gpu.memcpy %dst, %src : memref<?xf32>, memref<?xi32> 441} 442 443// ----- 444 445func @memcpy_incompatible_shape(%dst : memref<7xf32>, %src : memref<9xf32>) { 446 // expected-error @+1 {{'gpu.memcpy' op arguments have incompatible shape}} 447 gpu.memcpy %dst, %src : memref<7xf32>, memref<9xf32> 448} 449 450// ----- 451 452func @memset_incompatible_shape(%dst : memref<?xf32>, %value : i32) { 453 // expected-error @+1 {{'gpu.memset' op failed to verify that all of {dst, value} have same element type}} 454 gpu.memset %dst, %value : memref<?xf32>, i32 455} 456 457// ----- 458 459func @mmamatrix_invalid_shape(){ 460 %wg = memref.alloca() {alignment = 32} : memref<32x32xf16, 3> 461 %i = arith.constant 16 : index 462 // expected-error @+1 {{MMAMatrixType must have exactly two dimensions}} 463 %0 = gpu.subgroup_mma_load_matrix %wg[%i, %i] {leadDimension = 32 : index} : memref<32x32xf16, 3> -> !gpu.mma_matrix<16x16x16xf16, "AOp"> 464 return 465} 466 467// ----- 468 469func @mmamatrix_operand_type(){ 470 %wg = memref.alloca() {alignment = 32} : memref<32x32xf16, 3> 471 %i = arith.constant 16 : index 472 // expected-error @+1 {{operand expected to be one of AOp, BOp or COp}} 473 %0 = gpu.subgroup_mma_load_matrix %wg[%i, %i] {leadDimension = 32 : index} : memref<32x32xf16, 3> -> !gpu.mma_matrix<16x16xf16, "EOp"> 474 return 475} 476 477// ----- 478 479func @mmamatrix_invalid_element_type(){ 480 %wg = memref.alloca() {alignment = 32} : memref<32x32xf16, 3> 481 %i = arith.constant 16 : index 482 // expected-error @+1 {{MMAMatrixType elements must be F16 or F32}} 483 %0 = gpu.subgroup_mma_load_matrix %wg[%i, %i] {leadDimension = 32 : index} : memref<32x32xf16, 3> -> !gpu.mma_matrix<16x16xi32, "AOp"> 484 return 485} 486 487// ----- 488 489#layout_map_col_major = affine_map<(i, j) -> (j, i)> 490 491func @mmaLoadOp_identity_layout(){ 492 %wg = memref.alloca() {alignment = 32} : memref<32x32xf16, #layout_map_col_major, 3> 493 %i = arith.constant 16 : index 494 // expected-error @+1 {{expected identity layout map for source memref}} 495 %0 = gpu.subgroup_mma_load_matrix %wg[%i, %i] {leadDimension = 32 : index} : memref<32x32xf16, #layout_map_col_major, 3> -> !gpu.mma_matrix<16x16xf16, "AOp"> 496 return 497} 498 499// ----- 500 501func @mmaLoadOp_invalid_mem_space(){ 502 %wg = memref.alloca() {alignment = 32} : memref<32x32xf16, 5> 503 %i = arith.constant 16 : index 504 // expected-error @+1 {{source memorySpace kGenericMemorySpace, kSharedMemorySpace or kGlobalMemorySpace only allowed}} 505 %0 = gpu.subgroup_mma_load_matrix %wg[%i, %i] {leadDimension = 32 : index} : memref<32x32xf16, 5> -> !gpu.mma_matrix<16x16xf16, "AOp"> 506 return 507} 508 509// ----- 510 511#layout_map_col_major = affine_map<(i, j) -> (j, i)> 512 513func @wmmaStoreOp_invalid_map(%arg0 : !gpu.mma_matrix<16x16xf16, "COp">) -> () { 514 %sg = memref.alloca(){alignment = 32} : memref<32x32xf16, #layout_map_col_major, 3> 515 %i = arith.constant 16 : index 516 %j = arith.constant 16 : index 517 // expected-error @+1 {{expected identity layout map for destination memref}} 518 gpu.subgroup_mma_store_matrix %arg0, %sg[%i,%j] {leadDimension= 32 : index} : !gpu.mma_matrix<16x16xf16, "COp">, memref<32x32xf16,#layout_map_col_major, 3> 519 return 520} 521 522// ----- 523 524func @wmmaStoreOp_invalid_mem_space(%arg0 : !gpu.mma_matrix<16x16xf16, "COp">) -> () { 525 %sg = memref.alloca(){alignment = 32} : memref<32x32xf16, 5> 526 %i = arith.constant 16 : index 527 %j = arith.constant 16 : index 528 // expected-error @+1 {{destination memorySpace of kGenericMemorySpace, kGlobalMemorySpace or kSharedMemorySpace only allowed}} 529 gpu.subgroup_mma_store_matrix %arg0, %sg[%i,%j] {leadDimension= 32 : index} : !gpu.mma_matrix<16x16xf16, "COp">, memref<32x32xf16, 5> 530 return 531} 532 533// ----- 534 535func @wmmaStoreOp_invalid_store_operand(%arg0 : !gpu.mma_matrix<16x16xf16, "AOp">) -> () { 536 %sg = memref.alloca(){alignment = 32} : memref<32x32xf16, 3> 537 %i = arith.constant 16 : index 538 %j = arith.constant 16 : index 539 // expected-error @+1 {{expected the operand matrix being stored to have 'COp' operand type}} 540 gpu.subgroup_mma_store_matrix %arg0, %sg[%i,%j] {leadDimension= 32 : index} : !gpu.mma_matrix<16x16xf16, "AOp">, memref<32x32xf16, 3> 541 return 542} 543 544// ----- 545 546func @wmmaMmaOp_invalid_operand_order(%A : !gpu.mma_matrix<16x16xf16, "AOp">, %B : !gpu.mma_matrix<16x16xf16, "BOp">, %C : !gpu.mma_matrix<16x16xf16, "COp">) -> () { 547 // expected-error @+1 {{operands must be in the order AOp, BOp, COp}} 548 %D = gpu.subgroup_mma_compute %B, %A, %C : !gpu.mma_matrix<16x16xf16, "BOp">, !gpu.mma_matrix<16x16xf16, "AOp"> -> !gpu.mma_matrix<16x16xf16, "COp"> 549 return 550} 551 552// ----- 553 554func @wmmaMmaOp_invalid_operand_shapes(%A : !gpu.mma_matrix<16x32xf16, "AOp">, %B : !gpu.mma_matrix<16x16xf16, "BOp">, %C : !gpu.mma_matrix<16x16xf16, "COp">) -> () { 555 // expected-error @+1 {{operand shapes do not satisfy matmul constraints}} 556 %D = gpu.subgroup_mma_compute %A, %B, %C : !gpu.mma_matrix<16x32xf16, "AOp">, !gpu.mma_matrix<16x16xf16, "BOp"> -> !gpu.mma_matrix<16x16xf16, "COp"> 557 return 558} 559 560// ----- 561 562func @async_cp_memory_space(%dst : memref<16xf32>, %src : memref<16xf32>, %i : index) -> () { 563 // expected-error @+1 {{destination memref must have memory space 3}} 564 gpu.device_async_copy %src[%i], %dst[%i], 16 : memref<16xf32> to memref<16xf32> 565 return 566} 567 568// ----- 569 570func @async_cp_memref_type(%dst : memref<16xi32, 3>, %src : memref<16xf32>, %i : index) -> () { 571 // expected-error @+1 {{source and destination must have the same element type}} 572 gpu.device_async_copy %src[%i], %dst[%i], 16 : memref<16xf32> to memref<16xi32, 3> 573 return 574} 575 576// ----- 577 578func @async_cp_num_src_indices(%dst : memref<16xf32, 3>, %src : memref<16x16xf32>, %i : index) -> () { 579 // expected-error @+1 {{expected 2 source indices, got 1}} 580 gpu.device_async_copy %src[%i], %dst[%i], 16 : memref<16x16xf32> to memref<16xf32, 3> 581 return 582} 583 584// ----- 585 586func @async_cp_num_dst_indices(%dst : memref<16x16xf32, 3>, %src : memref<16xf32>, %i : index) -> () { 587 // expected-error @+1 {{expected 2 destination indices, got 1}} 588 gpu.device_async_copy %src[%i], %dst[%i], 16 : memref<16xf32> to memref<16x16xf32, 3> 589 return 590} 591 592// ----- 593 594func @async_cp_num_src_stride( 595 %dst : memref<200x100xf32, 3>, 596 %src : memref<200x100xf32, affine_map<(d0, d1) -> (200*d0 + 2*d1)>>, 597 %i : index) -> () { 598 // expected-error @+1 {{source memref most minor dim must have unit stride}} 599 gpu.device_async_copy %src[%i, %i], %dst[%i, %i], 16 : 600 memref<200x100xf32, affine_map<(d0, d1) -> (200*d0 + 2*d1)>> to memref<200x100xf32, 3> 601 return 602} 603 604// ----- 605 606func @async_cp_num_dst_stride( 607 %dst : memref<200x100xf32, affine_map<(d0, d1) -> (200*d0 + 2*d1)>, 3>, 608 %src : memref<200x100xf32>, 609 %i : index) -> () { 610 // expected-error @+1 {{destination memref most minor dim must have unit stride}} 611 gpu.device_async_copy %src[%i, %i], %dst[%i, %i], 16 : 612 memref<200x100xf32> to memref<200x100xf32, affine_map<(d0, d1) -> (200*d0 + 2*d1)>, 3> 613 return 614} 615 616// ----- 617 618// Number of symbol operand count less than memref symbol count. 619func @alloc() { 620 // expected-error@+1 {{symbol operand count does not equal memref symbol count}} 621 %1 = gpu.alloc() : memref<2x4xf32, affine_map<(d0, d1)[s0] -> ((d0 + s0), d1)>, 1> 622 return 623} 624 625// ----- 626 627// Number of symbol operand count greater than memref symbol count. 628func @alloc() { 629 %0 = arith.constant 7 : index 630 // expected-error@+1 {{symbol operand count does not equal memref symbol count}} 631 %1 = gpu.alloc()[%0] : memref<2x4xf32, 1> 632 return 633} 634 635// ----- 636 637// Number of dynamic dimension operand count greater than memref dynamic dimension count. 638func @alloc() { 639 %0 = arith.constant 7 : index 640 // expected-error@+1 {{dimension operand count does not equal memref dynamic dimension count}} 641 %1 = gpu.alloc(%0, %0) : memref<2x?xf32, 1> 642 return 643} 644 645// ----- 646 647// Number of dynamic dimension operand count less than memref dynamic dimension count. 648func @alloc() { 649 %0 = arith.constant 7 : index 650 // expected-error@+1 {{dimension operand count does not equal memref dynamic dimension count}} 651 %1 = gpu.alloc(%0) : memref<2x?x?xf32, 1> 652 return 653} 654