Repository navigation
update(rocm): add mlxcelverse sync, drift checks and fork PR packages - #2078
Merged
Merged
Conversation
The ROCm overlay had no tooling for its two upstreams, and its pin-bump check (+/- line counts) could not see a core overlay that was already wrong before a bump. scripts/mlxcelverse/rocm_overlay.py rebuilds each core file as "pin + the fork's own change" and diffs the overlay against it; the residual must match the reviewed patches-rocm/CORE_RESIDUAL.diff (4 of 15 files, LOCAL_FIXES items 1 and 24). It also syncs to a new fork commit (sync_from_fork.sh, 3-way merges carrying every local fix), retargets core files to a new pin, and check_api_drift.sh builds a candidate tree and lists compile errors and undefined mlx::core symbols. The offline records check and a synthetic-history test run as make verify-rocm-overlay, in verify and verify-rocm, so a pin bump that skips the ROCm retarget fails on any host. docs/mlxcelverse/ adds the pin-bump and fork-sync procedure and ten PR packages for NripeshN/mlx rocm-support (patch, PR text, reproduction), prepared for manual submission, with a slot for item 27. README backend count is 108; LOCAL_FIXES names the files of items 2, 7, 11 and 20; rope.hip's comment-only drift from the fork is reverted. Refs #1813
rocm_overlay.py drift requires every backend file that differs from the fork to be named in LOCAL_FIXES.md, but it accepted the bare file name anywhere, including as the tail of another path. mlx/device.cpp therefore named mlx/backend/rocm/device.cpp, and the top-level CMakeLists.txt named mlx/backend/rocm/CMakeLists.txt, so an unrecorded change to the most often edited backend files passed. A short name now counts only on its own, and a bare file name only when no other overlay file shares it; the current LOCAL_FIXES.md still passes because it names every modified file by path. records and the overlay file walk ignore .DS_Store, which Finder drops into any directory it shows and which would otherwise fail make verify on a Mac as a stray record or an extra core file. The test's negative grep uses -E instead of the GNU-only \| alternation. The procedure doc no longer claims sync --check at the recorded commit can detect an overlay changed outside the procedure: it is an identity by construction, and drift is the check that does. rocm_overlay_test.sh gains the tail-name and .DS_Store cases (27 checks; the tail-name case fails on the previous tool). make verify-rocm-overlay and an offline drift against the recorded commits pass. Refs #1813
The overlay CMake comment lists CORE_RESIDUAL.diff among the records, check_api_drift.sh no longer trips set -u on an empty git option array under bash before 4.4, and single-entry package tables say item rather than items. Refs #1813
sync and export-tree wrote every path listed by `git ls-tree` on a fetched fork commit as `root / path`. Git stores and lists a `..` tree entry verbatim and a fetch does not fsck by default, so a hostile fork tree (or a --fork-url) could make `sync_from_fork.sh` write or delete an arbitrary file, for example mlx/backend/rocm/../../../../.bashrc. Export-tree also wrote overlay files through whatever symlinks the extracted MLX archive contained. Every write and unlink of a tree-derived path now goes through safe_dest, which rejects absolute paths, empty, `.`, `..` and `.git` components, and any destination that resolves outside the output root. ls_tree and changed_paths use -z so names are read raw instead of C-quoted. rocm_overlay_test.sh builds a fork commit with a `..` entry via mktree and asserts sync and export-tree both refuse it and nothing lands outside the output directory; against the previous tool the file escaped. make verify-rocm-overlay passes (29 checks, about 2 s).
A commit or ref starting with a dash reached git fetch unchecked and would be parsed as an option such as --upload-pack; it is now rejected. sync --check also removes its scratch copy when the comparison raises. Refs #1813
Item 27 (#2079, CPU-stream OpenBLAS single-threaded over fine-grained memory) replaces the pending slot as package 11: a patch against fork head 75915908 that applies cleanly on its own and after packages 01 to 10, PR notes, and the standalone cblas_sgemm reproducer. The records check now accepts LOCAL_FIXES numbers grouped by section (27 sits in the kernel section above build item 26) as long as each of 1..N appears once. Refs #1813
inureyes
force-pushed
the
update/issue-1813-mlxcelverse-sync
branch
from
September 30, 2026 07:51
82dcd78 to
53c8f12
Compare
1 of 4 tasks
This was referenced Sep 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1813. The issue stays open after this merge: its acceptance item for proposing the fixes to the fork with a recorded link is done by the maintainer submitting the prepared packages by hand.
Summary
Tooling and procedure for the ROCm overlay's two upstreams (the MLX pin and NripeshN/mlx
rocm-support), a drift check that catches a core overlay that was already wrong before a bump, and the overlay's fork-side fixes prepared as PRs for the fork. Nothing was submitted to NripeshN/mlx or ml-explore/mlx; the packages are for manual submission.scripts/mlxcelverse/rocm_overlay.py:records(offline),drift(rebuilds each core file as pin + the fork's own change and requires the residual to match the reviewedpatches-rocm/CORE_RESIDUAL.diff, each entry noted with its LOCAL_FIXES item; every backend file differing from the fork must be named in LOCAL_FIXES),sync(3-way merges to a new fork commit, carrying local fixes and local-only files),retarget(3-way merges core files to a new pin), plus helpers forcheck_api_drift.sh(build a candidate tree withmake -k, list compile errors and undefinedmlx::coresymbols).make verify-rocm-overlay(records check plus a synthetic-history test, about 2 s, offline) is in bothverifyandverify-rocm, so a pin bump that skips the ROCm retarget fails on a Mac too.drift,sync_from_fork.shandcheck_api_drift.shfetch or build and stay manual.docs/mlxcelverse/rocm-overlay.md: pin-bump and fork-sync procedure, includingmake verify-rocmand a "ROCm overlay" section for bump PR bodies and reports;CONTRIBUTING.md,patches-rocm/README.md,docs/architecture.mdpoint to it.docs/mlxcelverse/upstream/: eleven packages (patch against fork head75915908, PR title and body, reproduction) covering LOCAL_FIXES items 8, 10 to 14 and 16 to 27 (item 27 from fix(rocm): run CPU-stream BLAS single-threaded over fine-grained memory #2079, with its standalonecblas_sgemmreproducer); index with apply status, the unpackaged items and why (1 to 6 retarget-only, 7 needs Propagate CPU errors to events ml-explore/mlx#3742, 9 no root cause, 15 needs #4035), and a summary of the fork's contribution rules and ml-explore/mlx's AI usage policy (#4331, which forbids AI-written PR descriptions) for the maintainer to decide on.rope.hip's only difference from the fork, a rewrapped comment, is reverted.Verification
On gfx1151 (this host):
sync_from_fork.sh --checkagainst the fork head (unchanged since the recorded commit) reproducespatches-rocm/byte for byte, with a freshly fetched cache. That is the acceptance item, but it is trivially true when the commit has not moved; the meaningful run is a forward sync of a copy claiming an older fork commit (53cbdf8c, 34 files changed since), which merged 30 files cleanly and flagged 4 real interactions with local fixes.driftpasses: 11 of 15 core files rebuild byte for byte; the residual is items 1 and 24.rocm_overlay_test.sh: 29 checks, including an overlay that silently drops an upstream line, an unrecorded backend change (also one named only by a same-named file elsewhere), a fork conflict, a fork ahead of the pin, a retarget, and a fork tree with a..entry.git apply --check(07 after 05 and 06) and in sequence withgit am. Rebased onto main after fix(rocm): run CPU-stream BLAS single-threaded over fine-grained memory #2079;driftand the records check pass with item 27, which the records check now accepts in its section order (27 in the kernel section above build item 26).make verify-versions verify-kernel-dtype-keys verify-kernel-port-dispatch verify-llama-compat verify-rocm-overlay verify-fmtandcargo test --features rocm --test dead_doc_pointerspass.Not verified:
check_api_drift.shwas not run end to end, so the acceptance item "lists the six known breaks against the fork's merge base plus current upstream" is unchecked (check_api_drift.sh --rocm-from fork:75915908dfe5028335d318b10340313744fd3a8d); building the fork's code was not permitted in this session. For the same reason the packages were not compiled against the fork and their reproductions were not run on a fork build; the index lists these as steps before submission. Metal and CUDA: not available here; this change touches no Metal or CUDA code andverify-rocm-overlayis pure Python and git.Changes during review
driftno longer counts a backend file as named in LOCAL_FIXES when only a same-named file elsewhere is (for examplemlx/device.cppformlx/backend/rocm/device.cpp);.DS_Storeis ignored; a GNU-only grep in the test was made portable...entry cannot makesyncorexport-treewrite outside the overlay (reproduced with a crafted tree before the fix); tree listings use-z; option-like fetch arguments are refused.