Commit 1945753
authored
[mlir][linalg] Fix incorrect linalg short form printing (llvm#153219)
Both `linalg.map` and `linalg.reduce` are sometimes printed in short
form incorrectly, resulting in a round-trip output with different
semantics. This patch adds additional `yield` operand checks to ensure
that all criteria for short-form printing are satisfied. Updated/added
comments and renamed the `findPayloadOp` function to `canUseShortForm`,
which more accurately reflects its purpose. A couple of new lit tests
check for the proper use of long form when short-form conditions are not
met.
Fixes llvm#1175281 parent ec237da commit 1945753
File tree
3 files changed
+92
-29
lines changed- mlir
- include/mlir/Dialect/Linalg/IR
- lib/Dialect/Linalg/IR
- test/Dialect/Linalg
3 files changed
+92
-29
lines changedLines changed: 12 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
256 | | - | |
257 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
258 | 260 | | |
259 | | - | |
| 261 | + | |
260 | 262 | | |
261 | 263 | | |
262 | 264 | | |
| |||
340 | 342 | | |
341 | 343 | | |
342 | 344 | | |
343 | | - | |
344 | | - | |
345 | | - | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
346 | 350 | | |
347 | | - | |
| 351 | + | |
348 | 352 | | |
349 | | - | |
| 353 | + | |
350 | 354 | | |
351 | 355 | | |
352 | 356 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1570 | 1570 | | |
1571 | 1571 | | |
1572 | 1572 | | |
1573 | | - | |
1574 | | - | |
1575 | | - | |
1576 | | - | |
1577 | | - | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
1578 | 1578 | | |
1579 | | - | |
| 1579 | + | |
1580 | 1580 | | |
1581 | | - | |
1582 | 1581 | | |
| 1582 | + | |
| 1583 | + | |
1583 | 1584 | | |
1584 | 1585 | | |
1585 | | - | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
1586 | 1591 | | |
1587 | 1592 | | |
1588 | 1593 | | |
1589 | | - | |
| 1594 | + | |
1590 | 1595 | | |
1591 | 1596 | | |
1592 | 1597 | | |
1593 | 1598 | | |
1594 | | - | |
| 1599 | + | |
1595 | 1600 | | |
1596 | 1601 | | |
1597 | 1602 | | |
1598 | 1603 | | |
1599 | 1604 | | |
1600 | | - | |
| 1605 | + | |
1601 | 1606 | | |
1602 | 1607 | | |
1603 | | - | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
1604 | 1614 | | |
1605 | 1615 | | |
1606 | | - | |
| 1616 | + | |
1607 | 1617 | | |
1608 | 1618 | | |
1609 | 1619 | | |
| |||
1622 | 1632 | | |
1623 | 1633 | | |
1624 | 1634 | | |
1625 | | - | |
1626 | | - | |
1627 | | - | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
1628 | 1638 | | |
1629 | 1639 | | |
1630 | 1640 | | |
1631 | 1641 | | |
1632 | 1642 | | |
1633 | | - | |
| 1643 | + | |
1634 | 1644 | | |
1635 | 1645 | | |
1636 | 1646 | | |
| |||
1829 | 1839 | | |
1830 | 1840 | | |
1831 | 1841 | | |
1832 | | - | |
1833 | | - | |
1834 | | - | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
1835 | 1845 | | |
1836 | 1846 | | |
1837 | 1847 | | |
1838 | 1848 | | |
1839 | 1849 | | |
1840 | | - | |
| 1850 | + | |
1841 | 1851 | | |
1842 | 1852 | | |
1843 | 1853 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
436 | 436 | | |
437 | 437 | | |
438 | 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 | + | |
439 | 467 | | |
440 | 468 | | |
441 | 469 | | |
| |||
592 | 620 | | |
593 | 621 | | |
594 | 622 | | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
595 | 644 | | |
596 | 645 | | |
597 | 646 | | |
| |||
0 commit comments