Commit ad960fd
[Mosaic] Allow padding in small tiling row shuffle reshape.
We just need to make sure shape aligns to vreg-slice lane dim and only last vreg contains padding on tiled dims.
Examples:
1: Reshape vector<10x128xi32> to vector<5x256xi32> can use the row shuffle reshape routine by inferring in tiling = (8, 128) and out tiling = (4, 128) because 1) vregs are still one-to-one mapping, ensured by vreg-slice lane aligned, and 2) only last vreg in tiled dims are padded, ensured by #elements are the same in tiled dims.
2: Reshape vector<16x512x56x128xbf16> to vector<16x512x7168xbf16> can use in tiling = (16, 128) and out tiling = (1, 256) and make it no-op.
PiperOrigin-RevId: 8333703071 parent 18a05ef commit ad960fd
File tree
3 files changed
+116
-48
lines changed- jaxlib/mosaic/dialect/tpu
- transforms
3 files changed
+116
-48
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1846 | 1846 | | |
1847 | 1847 | | |
1848 | 1848 | | |
1849 | | - | |
1850 | | - | |
1851 | | - | |
1852 | | - | |
1853 | | - | |
1854 | | - | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
1855 | 1857 | | |
1856 | 1858 | | |
1857 | 1859 | | |
| |||
Lines changed: 57 additions & 33 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5650 | 5650 | | |
5651 | 5651 | | |
5652 | 5652 | | |
5653 | | - | |
5654 | | - | |
5655 | | - | |
5656 | | - | |
| 5653 | + | |
| 5654 | + | |
5657 | 5655 | | |
5658 | 5656 | | |
5659 | | - | |
5660 | | - | |
5661 | | - | |
| 5657 | + | |
| 5658 | + | |
5662 | 5659 | | |
5663 | 5660 | | |
5664 | | - | |
5665 | | - | |
5666 | | - | |
5667 | | - | |
5668 | | - | |
5669 | | - | |
5670 | | - | |
5671 | | - | |
| 5661 | + | |
| 5662 | + | |
| 5663 | + | |
| 5664 | + | |
| 5665 | + | |
| 5666 | + | |
| 5667 | + | |
| 5668 | + | |
| 5669 | + | |
| 5670 | + | |
| 5671 | + | |
| 5672 | + | |
| 5673 | + | |
| 5674 | + | |
| 5675 | + | |
| 5676 | + | |
| 5677 | + | |
| 5678 | + | |
| 5679 | + | |
| 5680 | + | |
| 5681 | + | |
| 5682 | + | |
| 5683 | + | |
| 5684 | + | |
| 5685 | + | |
| 5686 | + | |
| 5687 | + | |
| 5688 | + | |
| 5689 | + | |
| 5690 | + | |
5672 | 5691 | | |
5673 | | - | |
5674 | | - | |
5675 | | - | |
5676 | | - | |
| 5692 | + | |
| 5693 | + | |
5677 | 5694 | | |
5678 | 5695 | | |
5679 | | - | |
5680 | | - | |
5681 | | - | |
5682 | | - | |
| 5696 | + | |
| 5697 | + | |
5683 | 5698 | | |
5684 | 5699 | | |
5685 | 5700 | | |
5686 | | - | |
| 5701 | + | |
5687 | 5702 | | |
5688 | 5703 | | |
5689 | 5704 | | |
| |||
5715 | 5730 | | |
5716 | 5731 | | |
5717 | 5732 | | |
5718 | | - | |
5719 | | - | |
5720 | | - | |
5721 | | - | |
| 5733 | + | |
| 5734 | + | |
| 5735 | + | |
| 5736 | + | |
5722 | 5737 | | |
5723 | | - | |
5724 | | - | |
5725 | | - | |
5726 | | - | |
| 5738 | + | |
| 5739 | + | |
5727 | 5740 | | |
5728 | 5741 | | |
5729 | 5742 | | |
| |||
5845 | 5858 | | |
5846 | 5859 | | |
5847 | 5860 | | |
| 5861 | + | |
| 5862 | + | |
5848 | 5863 | | |
5849 | 5864 | | |
| 5865 | + | |
| 5866 | + | |
| 5867 | + | |
| 5868 | + | |
| 5869 | + | |
| 5870 | + | |
| 5871 | + | |
| 5872 | + | |
| 5873 | + | |
| 5874 | + | |
5850 | 5875 | | |
5851 | 5876 | | |
5852 | 5877 | | |
| |||
5887 | 5912 | | |
5888 | 5913 | | |
5889 | 5914 | | |
5890 | | - | |
5891 | 5915 | | |
5892 | 5916 | | |
5893 | 5917 | | |
| |||
Lines changed: 51 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1633 | 1633 | | |
1634 | 1634 | | |
1635 | 1635 | | |
1636 | | - | |
1637 | | - | |
| 1636 | + | |
| 1637 | + | |
1638 | 1638 | | |
1639 | 1639 | | |
1640 | 1640 | | |
| |||
1659 | 1659 | | |
1660 | 1660 | | |
1661 | 1661 | | |
1662 | | - | |
1663 | | - | |
| 1662 | + | |
1664 | 1663 | | |
1665 | 1664 | | |
1666 | 1665 | | |
1667 | 1666 | | |
1668 | 1667 | | |
1669 | | - | |
1670 | | - | |
1671 | | - | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
1672 | 1671 | | |
1673 | 1672 | | |
1674 | 1673 | | |
| |||
1684 | 1683 | | |
1685 | 1684 | | |
1686 | 1685 | | |
1687 | | - | |
1688 | | - | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
1689 | 1731 | | |
1690 | 1732 | | |
1691 | 1733 | | |
| |||
0 commit comments