1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688
|
// RUN: mlir-opt %s -split-input-file -verify-diagnostics | FileCheck %s
// expected-error @below {{expects the entry block to have at least one argument}}
transform.sequence failures(propagate) {
}
// -----
// expected-error @below {{expects the first entry block argument to be of type implementing TransformHandleTypeInterface}}
transform.sequence failures(propagate) {
^bb0(%rag0: i64):
}
// -----
// expected-note @below {{nested in another possible top-level op}}
transform.sequence failures(propagate) {
^bb0(%arg0: !transform.any_op):
// expected-error @below {{expects operands to be provided for a nested op}}
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
}
}
// -----
// expected-error @below {{'transform.sequence' op expects trailing entry block arguments to be of type implementing TransformHandleTypeInterface, TransformValueHandleTypeInterface or TransformParamTypeInterface}}
// expected-note @below {{argument #1 does not}}
transform.sequence failures(propagate) {
^bb0(%arg0: !transform.any_op, %arg1: i64):
}
// -----
// expected-error @below {{expected children ops to implement TransformOpInterface}}
transform.sequence failures(propagate) {
^bb0(%arg0: !transform.any_op):
// expected-note @below {{op without interface}}
arith.constant 42.0 : f32
}
// -----
// expected-error @below {{expects the types of the terminator operands to match the types of the result}}
%0 = transform.sequence -> !transform.any_op failures(propagate) {
^bb0(%arg0: !transform.any_op):
// expected-note @below {{terminator}}
transform.yield
}
// -----
transform.sequence failures(propagate) {
^bb0(%arg0: !transform.any_op):
// expected-error @below {{expects the type of the block argument to match the type of the operand}}
transform.sequence %arg0: !transform.any_op failures(propagate) {
^bb1(%arg1: !transform.op<"builtin.module">):
transform.yield
}
}
// -----
transform.sequence failures(propagate) {
^bb0(%arg0: !transform.any_op, %arg1: !transform.any_op, %arg2: !transform.any_op):
// expected-error @below {{expected types to be provided for all operands}}
transform.sequence %arg0, %arg1, %arg2 : (!transform.any_op, !transform.any_op) failures(propagate) {
^bb0(%arg3: !transform.any_op, %arg4: !transform.any_op, %arg5: !transform.any_op):
}
}
// -----
%0 = "test.generate_something"() : () -> !transform.any_op
// expected-error @below {{does not expect extra operands when used as top-level}}
"transform.sequence"(%0) ({
^bb0(%arg0: !transform.any_op):
"transform.yield"() : () -> ()
}) {failure_propagation_mode = 1 : i32, operandSegmentSizes = array<i32: 0, 1>} : (!transform.any_op) -> ()
// -----
// expected-note @below {{nested in another possible top-level op}}
transform.with_pdl_patterns {
^bb0(%arg0: !transform.any_op):
// expected-error @below {{expects operands to be provided for a nested op}}
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
}
}
// -----
// expected-error @below {{expects only one non-pattern op in its body}}
transform.with_pdl_patterns {
^bb0(%arg0: !transform.any_op):
// expected-note @below {{first non-pattern op}}
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
}
// expected-note @below {{second non-pattern op}}
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
}
}
// -----
// expected-error @below {{expects only pattern and top-level transform ops in its body}}
transform.with_pdl_patterns {
^bb0(%arg0: !transform.any_op):
// expected-note @below {{offending op}}
"test.something"() : () -> ()
}
// -----
// expected-note @below {{parent operation}}
transform.with_pdl_patterns {
^bb0(%arg0: !transform.any_op):
// expected-error @below {{op cannot be nested}}
transform.with_pdl_patterns %arg0 : !transform.any_op {
^bb1(%arg1: !transform.any_op):
}
}
// -----
// expected-error @below {{op expects at least one non-pattern op}}
transform.with_pdl_patterns {
^bb0(%arg0: !transform.any_op):
pdl.pattern @some : benefit(1) {
%0 = pdl.operation "test.foo"
pdl.rewrite %0 with "transform.dialect"
}
}
// -----
transform.sequence failures(propagate) {
^bb0(%arg0: !transform.any_op):
// expected-error @below {{op expects at least one non-pattern op}}
with_pdl_patterns %arg0 : !transform.any_op {
^bb1(%arg1: !transform.any_op):
}
}
// -----
// expected-error @below {{expects at least one region}}
"transform.test_transform_unrestricted_op_no_interface"() : () -> ()
// -----
// expected-error @below {{expects a single-block region}}
"transform.test_transform_unrestricted_op_no_interface"() ({
^bb0(%arg0: !transform.any_op):
"test.potential_terminator"() : () -> ()
^bb1:
"test.potential_terminator"() : () -> ()
}) : () -> ()
// -----
transform.sequence failures(propagate) {
^bb0(%arg0: !transform.any_op):
// expected-error @below {{result #0 has more than one potential consumer}}
%0 = test_produce_self_handle_or_forward_operand : () -> !transform.any_op
// expected-note @below {{used here as operand #0}}
test_consume_operand_of_op_kind_or_fail %0, "transform.test_produce_self_handle_or_forward_operand" : !transform.any_op
// expected-note @below {{used here as operand #0}}
test_consume_operand_of_op_kind_or_fail %0, "transform.test_produce_self_handle_or_forward_operand" : !transform.any_op
}
// -----
transform.sequence failures(propagate) {
^bb0(%arg0: !transform.any_op):
// expected-error @below {{result #0 has more than one potential consumer}}
%0 = test_produce_self_handle_or_forward_operand : () -> !transform.any_op
// expected-note @below {{used here as operand #0}}
test_consume_operand_of_op_kind_or_fail %0, "transform.test_produce_self_handle_or_forward_operand" : !transform.any_op
// expected-note @below {{used here as operand #0}}
transform.sequence %0 : !transform.any_op failures(propagate) {
^bb1(%arg1: !transform.any_op):
test_consume_operand_of_op_kind_or_fail %arg1, "transform.test_produce_self_handle_or_forward_operand" : !transform.any_op
}
}
// -----
transform.sequence failures(propagate) {
^bb0(%arg0: !transform.any_op):
// expected-error @below {{result #0 has more than one potential consumer}}
%0 = test_produce_self_handle_or_forward_operand : () -> !transform.any_op
// expected-note @below {{used here as operand #0}}
test_consume_operand_of_op_kind_or_fail %0, "transform.test_produce_self_handle_or_forward_operand" : !transform.any_op
transform.sequence %0 : !transform.any_op failures(propagate) {
^bb1(%arg1: !transform.any_op):
// expected-note @below {{used here as operand #0}}
test_consume_operand_of_op_kind_or_fail %0, "transform.test_produce_self_handle_or_forward_operand" : !transform.any_op
}
}
// -----
transform.sequence failures(propagate) {
^bb0(%arg0: !transform.any_op):
// expected-error @below {{result #0 has more than one potential consumer}}
%0 = test_produce_self_handle_or_forward_operand : () -> !transform.any_op
// expected-note @below {{used here as operand #0}}
test_consume_operand_of_op_kind_or_fail %0, "transform.test_produce_self_handle_or_forward_operand" : !transform.any_op
// expected-note @below {{used here as operand #0}}
transform.sequence %0 : !transform.any_op failures(propagate) {
^bb1(%arg1: !transform.any_op):
transform.sequence %arg1 : !transform.any_op failures(propagate) {
^bb2(%arg2: !transform.any_op):
test_consume_operand_of_op_kind_or_fail %arg2, "transform.test_produce_self_handle_or_forward_operand" : !transform.any_op
}
}
}
// -----
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
// expected-error @below {{expects at least one region}}
transform.alternatives
}
// -----
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
// expected-error @below {{expects terminator operands to have the same type as results of the operation}}
%2 = transform.alternatives %arg1 : !transform.any_op -> !transform.any_op {
^bb2(%arg2: !transform.any_op):
transform.yield %arg2 : !transform.any_op
}, {
^bb2(%arg2: !transform.any_op):
// expected-note @below {{terminator}}
transform.yield
}
}
// -----
// expected-error @below {{expects the entry block to have at least one argument}}
transform.alternatives {
^bb0:
transform.yield
}
// -----
transform.sequence failures(propagate) {
^bb0(%arg0: !transform.any_op):
// expected-error @below {{result #0 has more than one potential consumer}}
%0 = test_produce_self_handle_or_forward_operand : () -> !transform.any_op
// expected-note @below {{used here as operand #0}}
transform.foreach %0 : !transform.any_op {
^bb1(%arg1: !transform.any_op):
transform.test_consume_operand %arg1 : !transform.any_op
}
// expected-note @below {{used here as operand #0}}
transform.test_consume_operand %0 : !transform.any_op
}
// -----
transform.sequence failures(suppress) {
^bb0(%arg0: !transform.any_op):
// expected-error @below {{TransformOpInterface requires memory effects on operands to be specified}}
// expected-note @below {{no effects specified for operand #0}}
transform.test_required_memory_effects %arg0 {modifies_payload} : (!transform.any_op) -> !transform.any_op
}
// -----
transform.sequence failures(suppress) {
^bb0(%arg0: !transform.any_op):
// expected-error @below {{TransformOpInterface requires 'allocate' memory effect to be specified for results}}
// expected-note @below {{no 'allocate' effect specified for result #0}}
transform.test_required_memory_effects %arg0 {has_operand_effect, modifies_payload} : (!transform.any_op) -> !transform.any_op
}
// -----
// expected-error @below {{attribute can only be attached to operations with symbol tables}}
"test.unknown_container"() { transform.with_named_sequence } : () -> ()
// -----
module attributes { transform.with_named_sequence } {
// expected-error @below {{expected a non-empty body block}}
"transform.named_sequence"() ({
^bb0:
}) { sym_name = "external_named_sequence", function_type = () -> () } : () -> ()
transform.sequence failures(propagate) {
^bb0(%arg0: !transform.any_op):
transform.include @external_named_sequence failures(propagate) () : () -> ()
}
}
// -----
module attributes { transform.with_named_sequence } {
// expected-error @below {{recursion not allowed in named sequences}}
transform.named_sequence @self_recursion() -> () {
transform.include @self_recursion failures(suppress) () : () -> ()
}
}
// -----
module @mutual_recursion attributes { transform.with_named_sequence } {
// expected-note @below {{operation on recursion stack}}
transform.named_sequence @foo(%arg0: !transform.any_op) -> () {
transform.include @bar failures(suppress) (%arg0) : (!transform.any_op) -> ()
transform.yield
}
// expected-error @below {{recursion not allowed in named sequences}}
transform.named_sequence @bar(%arg0: !transform.any_op) -> () {
transform.include @foo failures(propagate) (%arg0) : (!transform.any_op) -> ()
transform.yield
}
}
// -----
// expected-error @below {{unknown attribute: "transform.unknown_container"}}
module @unknown_attribute attributes { transform.unknown_container } {}
// -----
module {
transform.sequence failures(suppress) {
^bb0(%arg0: !transform.any_op):
// expected-error @below {{op does not reference a named transform sequence}}
transform.include @non_existent failures(propagate) () : () -> ()
}
}
// -----
module attributes { transform.with_named_sequence } {
transform.sequence failures(suppress) {
^bb0(%arg0: !transform.any_op):
// expected-error @below {{requires attribute 'target'}}
"transform.include"() {failure_propagation_mode = 1 : i32} : () -> ()
}
}
// -----
module attributes { transform.with_named_sequence } {
transform.named_sequence @foo(%arg0: !transform.any_op) -> () {
transform.yield
}
transform.sequence failures(suppress) {
^bb0(%arg1: !transform.any_op):
// expected-error @below {{incorrect number of operands for callee}}
transform.include @foo failures(suppress) () : () -> ()
}
}
// -----
module attributes { transform.with_named_sequence } {
transform.named_sequence @foo(%arg0: !transform.any_op) -> () {
transform.yield
}
transform.sequence failures(suppress) {
^bb0(%arg1: !transform.op<"builtin.module">):
// expected-error @below {{operand type mismatch: expected operand type '!transform.any_op', but provided '!transform.op<"builtin.module">' for operand number 0}}
transform.include @foo failures(suppress) (%arg1) : (!transform.op<"builtin.module">) -> ()
}
}
// -----
module attributes { transform.with_named_sequence } {
transform.named_sequence @foo(%arg0: !transform.any_op) -> (!transform.any_op) {
transform.yield %arg0 : !transform.any_op
}
transform.sequence failures(suppress) {
^bb0(%arg1: !transform.any_op):
// expected-error @below {{incorrect number of results for callee}}
transform.include @foo failures(suppress) (%arg1) : (!transform.any_op) -> ()
}
}
// -----
module attributes { transform.with_named_sequence } {
transform.named_sequence @foo(%arg0: !transform.any_op) -> (!transform.any_op) {
transform.yield %arg0 : !transform.any_op
}
transform.sequence failures(suppress) {
^bb0(%arg1: !transform.any_op):
// expected-error @below {{type of result #0 must implement the same transform dialect interface as the corresponding callee result}}
transform.include @foo failures(suppress) (%arg1) : (!transform.any_op) -> (!transform.any_value)
}
}
// -----
// expected-note @below {{symbol table operation}}
module {
// expected-error @below {{expects the parent symbol table to have the 'transform.with_named_sequence' attribute}}
transform.named_sequence @parent_has_no_attributes() {
transform.yield
}
}
// -----
module attributes { transform.with_named_sequence} {
// expected-note @below {{ancestor transform op}}
transform.sequence failures(suppress) {
^bb0(%arg0: !transform.any_op):
// expected-error @below {{cannot be defined inside another transform op}}
transform.named_sequence @nested() {
transform.yield
}
}
}
// -----
module attributes { transform.with_named_sequence} {
func.func private @foo()
// expected-error @below {{expected 'transform.yield' as terminator}}
transform.named_sequence @nested() {
// expected-note @below {{terminator}}
func.call @foo() : () -> ()
}
}
// -----
module attributes { transform.with_named_sequence} {
func.func private @foo()
transform.named_sequence @nested(%arg0: !transform.any_op) {
// expected-error @below {{expected terminator to have as many operands as the parent op has results}}
transform.yield %arg0 : !transform.any_op
}
}
// -----
module attributes { transform.with_named_sequence} {
func.func private @foo()
transform.named_sequence @nested(%arg0: !transform.any_op) -> !transform.op<"builtin.module"> {
// expected-error @below {{the type of the terminator operand #0 must match the type of the corresponding parent op result}}
transform.yield %arg0 : !transform.any_op
}
}
// -----
module attributes { transform.with_named_sequence } {
// expected-error @below {{must provide consumed/readonly status for arguments of external or called ops}}
transform.named_sequence @foo(%op: !transform.any_op )
}
// -----
module attributes { transform.with_named_sequence } {
// expected-error @below {{argument #0 cannot be both readonly and consumed}}
transform.named_sequence @foo(%op: !transform.any_op { transform.readonly, transform.consumed } )
}
// -----
module attributes { transform.with_named_sequence } {
// expected-error @below {{must provide consumed/readonly status for arguments of external or called ops}}
transform.named_sequence @foo(%op: !transform.any_op) {
transform.test_print_remark_at_operand %op, "message" : !transform.any_op
transform.yield
}
transform.sequence failures(propagate) {
^bb0(%arg0: !transform.any_op):
transform.include @foo failures(propagate) (%arg0) : (!transform.any_op) -> ()
transform.yield
}
}
// -----
module attributes { transform.with_named_sequence } {
// expected-error @below {{argument #0 cannot be both readonly and consumed}}
transform.named_sequence @foo(%op: !transform.any_op {transform.readonly, transform.consumed}) {
transform.test_print_remark_at_operand %op, "message" : !transform.any_op
transform.yield
}
transform.sequence failures(propagate) {
^bb0(%arg0: !transform.any_op):
transform.include @foo failures(propagate) (%arg0) : (!transform.any_op) -> ()
transform.yield
}
}
// -----
module attributes { transform.with_named_sequence } {
// Note that printing a warning doesn't result in verification failures, so this
// also checks for the IR being printed back.
// CHECK-LABEL: transform.named_sequence @emit_warning_only
// expected-warning @below {{argument #0 is not consumed in the body but is marked as consume}}
transform.named_sequence @emit_warning_only(%op: !transform.any_op {transform.consumed}) {
transform.test_print_remark_at_operand %op, "message" : !transform.any_op
transform.yield
}
transform.sequence failures(propagate) {
^bb0(%arg0: !transform.any_op):
transform.include @emit_warning_only failures(propagate) (%arg0) : (!transform.any_op) -> ()
transform.yield
}
}
// -----
module attributes { transform.with_named_sequence } {
// expected-error @below {{argument #0 is consumed in the body but is not marked as such}}
transform.named_sequence @foo(%op: !transform.any_op {transform.readonly}) {
transform.test_consume_operand %op : !transform.any_op
transform.yield
}
transform.sequence failures(propagate) {
^bb0(%arg0: !transform.any_op):
transform.include @foo failures(propagate) (%arg0) : (!transform.any_op) -> ()
transform.yield
}
}
// -----
// Checking that consumptions annotations are used correctly in invocation checks.
module attributes { transform.with_named_sequence } {
transform.named_sequence @foo(%op: !transform.any_op { transform.consumed } )
// expected-error @below {{'transform.sequence' op block argument #0 has more than one potential consumer}}
transform.sequence failures(propagate) {
^bb0(%arg0: !transform.any_op):
// expected-note @below {{used here as operand #0}}
transform.include @foo failures(propagate) (%arg0) : (!transform.any_op) -> ()
// expected-note @below {{used here as operand #0}}
transform.include @foo failures(propagate) (%arg0) : (!transform.any_op) -> ()
transform.yield
}
}
// -----
module attributes { transform.with_named_sequence } {
transform.sequence failures(propagate) {
^bb0(%root: !transform.any_op):
// expected-error @below {{unresolved matcher symbol @foo}}
transform.foreach_match in %root
@foo -> @bar : (!transform.any_op) -> !transform.any_op
}
}
// -----
module attributes { transform.with_named_sequence } {
func.func private @foo()
transform.sequence failures(propagate) {
^bb0(%root: !transform.any_op):
// expected-error @below {{unresolved matcher symbol @foo}}
transform.foreach_match in %root
@foo -> @bar : (!transform.any_op) -> !transform.any_op
}
}
// -----
module attributes { transform.with_named_sequence } {
transform.named_sequence @match()
transform.sequence failures(propagate) {
^bb0(%root: !transform.any_op):
// expected-error @below {{unresolved action symbol @bar}}
transform.foreach_match in %root
@match -> @bar : (!transform.any_op) -> !transform.any_op
}
}
// -----
module attributes { transform.with_named_sequence } {
func.func private @bar()
transform.named_sequence @match()
transform.sequence failures(propagate) {
^bb0(%root: !transform.any_op):
// expected-error @below {{unresolved action symbol @bar}}
transform.foreach_match in %root
@match -> @bar : (!transform.any_op) -> !transform.any_op
}
}
// -----
module attributes { transform.with_named_sequence } {
transform.named_sequence @match() -> !transform.any_op
transform.named_sequence @action()
transform.sequence failures(propagate) {
^bb0(%root: !transform.any_op):
// expected-error @below {{mismatching number of matcher results and action arguments between @match (1) and @action (0)}}
transform.foreach_match in %root
@match -> @action : (!transform.any_op) -> !transform.any_op
}
}
// -----
module attributes { transform.with_named_sequence } {
transform.named_sequence @match(!transform.any_op {transform.readonly})
// expected-note @below {{symbol declaration}}
transform.named_sequence @action() -> !transform.any_op
transform.sequence failures(propagate) {
^bb0(%root: !transform.any_op):
// expected-error @below {{action symbol is not expected to have results}}
transform.foreach_match in %root
@match -> @action : (!transform.any_op) -> !transform.any_op
}
}
// -----
module attributes { transform.with_named_sequence } {
// expected-note @below {{symbol declaration}}
transform.named_sequence @match()
transform.named_sequence @action()
transform.sequence failures(propagate) {
^bb0(%root: !transform.any_op):
// expected-error @below {{expects matcher symbol to have one argument with the same transform interface as the first operand}}
transform.foreach_match in %root
@match -> @action : (!transform.any_op) -> !transform.any_op
}
}
// -----
module attributes { transform.with_named_sequence } {
// expected-note @below {{symbol declaration}}
transform.named_sequence @match(!transform.any_op {transform.consumed})
transform.named_sequence @action()
transform.sequence failures(propagate) {
^bb0(%root: !transform.any_op):
// expected-error @below {{'transform.foreach_match' op does not expect matcher symbol to consume its operand}}
transform.foreach_match in %root
@match -> @action : (!transform.any_op) -> !transform.any_op
}
}
// -----
transform.sequence failures(propagate) {
^bb0(%arg0: !transform.any_op):
// expected-error @below {{expected children ops to implement PatternDescriptorOpInterface}}
transform.apply_patterns to %arg0 {
// expected-note @below {{op without interface}}
transform.named_sequence @foo()
} : !transform.any_op
}
|