Repository navigation
ci: build with Metal and run the tests on pull requests - #22
Conversation
Add the Fork Tests workflow. It builds the fork with Metal on a GitHub-hosted macos-26 runner. It runs the C++ and Python tests with the existing setup, build-macos and test-macos actions. Pin the actions inside the setup action to full commit SHAs. The organization blocks unpinned actions, also inside composite actions. Describe both files in the Fork tooling section of fork.yaml. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The organization blocks hendrikmuhs/ccache-action. Install ccache with Homebrew and keep its files with actions/cache. The cache directory and the ccache settings do not change. The cache key adds a hash of the mlx sources. Pull requests only restore the cache. Pushes to main also save it. Print the Xcode and Swift versions in the setup log. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Run the ccache install and cache steps only on macOS, where Homebrew installs ccache. End the cache key with the commit SHA and keep the prefix restore key, so every push to main refreshes the cache. Say that actions/cache saves only at the end of a job that succeeds, and only on pushes to main. Lower the job timeout from 150 to 60 minutes. The measured job takes 22 minutes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Review follow-up for head 0a4b609: before approval, please update this branch after #23/#24 land, resolve the documented fork.yaml overlap, and run Fork Tests on the resulting head. The current run (https://github.com/Layr-Labs/mlx/actions/runs/36187704068) fails in gptoss_mxfp4_tests.cpp because mxfp4_gather_qmm_rhs_nt_float_gs_32_b_4_bm_32_bn_32_bk_32_wm_2_wn_2 is missing. #24 supplies the missing AOT instantiations. The earlier combined run is useful evidence, but please link a green run for the updated candidate, including the later Python/distributed/extension steps that the current failure prevents from running. This is a dependency/integration validation request, not a request to weaken or skip the failing test. |
|
Reply written by Claude (agent) on David Tai's behalf. Agreed. The merge order in the body is #23, then #24 into main, then this branch updated from main with the three-line fork.yaml overlap resolved, then a green Fork Tests run on its own head before merge, including the Python, distributed and extension steps. The current red is the one C++ case that #24 fixes; the test is not weakened or skipped. |
Proposed changes
This PR adds the
Fork Testsworkflow (.github/workflows/fork-tests.yml). It builds the fork with Metal and runs the C++ and Python tests on a GitHub-hostedmacos-26runner. It runs on pull requests, on pushes tomainand on manual dispatch.The job
metal-build-and-testuses the existing actions in.github/actions:setupwithtoolkit: metal. It installs openmpi, uv, Python 3.12, cmake and ccache. It gives the CMake arguments-G Ninja -DMLX_BUILD_METAL=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DMLX_BUILD_CUDA=OFF.build-macoswith these arguments andmacos-target: 26.2. It builds the Python wheel and the C++ tests in Debug mode. The runner has macOS 26. 26.2 is the lowest target for which CMake builds all Metal kernels.test-macoswithtoolkit: metal. It installs tensorflow and runs./build/tests/tests. It runs the ring distributed test with 8 processes. It runs the Python tests from the built wheel. It builds and tests the example extension.test-macosdoes not run the MPI distributed test for metal. The action runs that test for the cpu toolkit only, because of an openmpi bug (openpmix/prrte#2416).Changes to
.github/actions/setup/action.yml:astral-sh/setup-uvandactions/cacheto full commit SHAs. The organization blocks unpinned actions, also inside composite actions (see fix(ci): Pages deploy failed on org action policy — bump upload-pages-artifact to v5 (SHA-pinned nested uploader) #20). The versions do not change.hendrikmuhs/ccache-actionwithbrew install ccacheandactions/cache(v5.1.0). The organization blockshendrikmuhs/ccache-action, because its creator is not verified and it is not on the allow-list. The ccache directory ($GITHUB_WORKSPACE/.ccache) and the ccache settings (maximum size, compression, compiler check) do not change. The three ccache steps run on macOS only.ccache-<ccache-key>-<OS>-<arch>-<toolkit>-<commit SHA>, and the prefix without the SHA is the restore key.fork-tests.ymlsetsccache-key: fork-tests, which upstream does not use. Pull requests only restore the cache. Pushes tomainrestore the cache, andactions/cachesaves it at the end of the job, only when the job passes. Every push tomainsaves a new entry, so a push that changes onlypython/ortests/also refreshes the cache.The job has
timeout-minutes: 60. The measured job takes 22 minutes.fork.yamlmoves.github/actions/setup/action.ymlfrom the upstream v0.32.2 section to "Fork tooling", and addsfork-tests.ymlto "Fork tooling".This PR does not change
build_and_test.yml.Runner probe result
The first run (https://github.com/Layr-Labs/mlx/actions/runs/36170228575) stopped at the
setupstep, because the organization policy blockedhendrikmuhs/ccache-action. This PR now replaces that action.The run with the build and the tests: https://github.com/Layr-Labs/mlx/actions/runs/36172106158 (failure: one C++ test).
macos-26. Imagemacos-26-arm64, version 20260907.0351.1. CPU: Apple M1 (Virtual), 3 cores.test-macosstops at the first group that fails, and the C++ group failed. The ring distributed test and the example extension did not run.The failed test:
This is a defect in the fork, not a limit of the runner. The Metal device works: the other 289 test cases passed on it. The test sets
MLX_GPTOSS_MXFP4_PREFILL_TILE=m32n32k32.quantized.cppthen asks for agather_qmm_rhskernel with the tile bm 32, bn 32, bk 32, wm 2, wn 2.fp_quantized.metalinstantiatesgather_qmm_rhsonly with the tile bm 16, bn 32, bk 32, wm 1, wn 2. A build withoutMLX_METAL_JITloads kernels only frommlx.metallib, so it cannot find the kernel. PR #14 added the tile option and the test. This PR keeps the test in. #24 adds the missing kernels tofp_quantized.metaland merges intomainfirst.The same job with the fix of #24 on this branch: https://github.com/Layr-Labs/mlx/actions/runs/36174742752 (success, 22.0 minutes).
test-macos.The job on the head commit
0a4b609b(ccache steps on macOS only, cache key by commit, timeout 60 minutes): https://github.com/Layr-Labs/mlx/actions/runs/36187704068 (failure: the same C++ test, because #24 is not in this branch yet).mainhas saved one yet.Test plan
actionlint .github/workflows/fork-tests.yml: no findings.actionlinton a test workflow that copies the three ccache steps of.github/actions/setup/action.yml: no findings./usr/bin/python3 scripts/check_forkdiff.py --upstream-ref refs/remotes/upstream/main: 173 of 173 changed files described.c9dc11a2: https://github.com/Layr-Labs/mlx/actions/runs/36170228575. The organization policy blockedhendrikmuhs/ccache-action. Commit6afdfd19replaces it.6afdfd19: https://github.com/Layr-Labs/mlx/actions/runs/36172106158. The build passes. 289 of 290 C++ test cases pass. fix(metal): build the GPT-OSS MXFP4 prefill tile into the metallib #24 fixes the one failure.6afdfd19: https://github.com/Layr-Labs/mlx/actions/runs/36174742752. All test groups pass.0a4b609b: https://github.com/Layr-Labs/mlx/actions/runs/36187704068. The ccache steps run on macOS. The build passes. 289 of 290 C++ test cases pass, as expected without fix(metal): build the GPT-OSS MXFP4 prefill tile into the metallib #24.git merge-tree --write-treeof the head commit withci/coverage(ci: report C++ line coverage from the Metal test run #25) and with fix(metal): build the GPT-OSS MXFP4 prefill tile into the metallib #24: no conflicts. With ci: remove the upstream workflows that cannot run in this fork #23: the threefork.yamllines that the Dependencies section names.gh api repos/Layr-Labs/mlx/commits/<sha> --jq .commit.verification.verifiedgivestruefor all three commits.CONTRIBUTING checklist
pre-commitran on the head commit. TheCheck Lintjob passed in run https://github.com/Layr-Labs/mlx/actions/runs/36187703961.Dependencies
Merge order:
main.main. If ci: remove the upstream workflows that cannot run in this fork #23 is already inmain, delete the threefork.yamllines that the conflict names:.github/actions/build-wheel/action.yml,.github/actions/setup/action.ymland.github/actions/test-linux/action.ymlin the upstream v0.32.2 section.#25 (coverage) has this branch as its base. It runs again after the update in step 3.
🤖 Generated with Claude Code