Commit 83ac75c
authored
feat(mlx): add handler for aten.roll (pytorch#19038)
## Summary
Adds an MLX delegate handler for `aten.roll`, mapping `torch.roll` onto
`mlx::core::roll` via a new `RollNode` in the schema. Replaces the
default decomposition (`index_select + arange + cat`) with a single
native kernel — needed by Swin Transformer's shift-window attention.
Flat roll (`dims=[]`) raises `NotImplementedError` for now; no known
consumer needs it yet.
Generated files (`MLXLoader.*`, `schema_generated.h`,
`mlx_graph_schema.py`, `_generated_serializers.py`,
`_generated_inspector.py`, `_generated/`) are regenerated from
`schema.fbs` by `backends/mlx/CMakeLists.txt` at build time and are
deliberately not committed.
Fixes pytorch#18919.
## Test plan
- `python backends/mlx/serialization/generate.py` — regenerates cleanly
with `RollNode` in all expected outputs.
- `lintrunner --skip MYPY --paths-cmd 'git diff --name-only
upstream/main'` — no issues.
- End-to-end `run_all_tests -k roll` not run locally (no executorch
build on this machine); relying on CI. Happy to push fixes if it finds
anything.
cc @metascroy
Co-authored-by: Ishan Godawatta <ishan.godawatta@arm.com>1 parent acffcb0 commit 83ac75c
4 files changed
Lines changed: 115 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
120 | 121 | | |
121 | 122 | | |
122 | 123 | | |
| |||
1678 | 1679 | | |
1679 | 1680 | | |
1680 | 1681 | | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
| 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 | + | |
1681 | 1721 | | |
1682 | 1722 | | |
1683 | 1723 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1733 | 1733 | | |
1734 | 1734 | | |
1735 | 1735 | | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
1736 | 1743 | | |
1737 | 1744 | | |
1738 | 1745 | | |
| |||
2210 | 2217 | | |
2211 | 2218 | | |
2212 | 2219 | | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
2213 | 2223 | | |
2214 | 2224 | | |
2215 | 2225 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
673 | 673 | | |
674 | 674 | | |
675 | 675 | | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
676 | 686 | | |
677 | 687 | | |
678 | 688 | | |
| |||
1119 | 1129 | | |
1120 | 1130 | | |
1121 | 1131 | | |
1122 | | - | |
| 1132 | + | |
| 1133 | + | |
1123 | 1134 | | |
1124 | 1135 | | |
1125 | 1136 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
855 | 855 | | |
856 | 856 | | |
857 | 857 | | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
858 | 911 | | |
859 | 912 | | |
860 | 913 | | |
| |||
0 commit comments