Repository navigation
Native: MLX core on upstream MLX main 1ba7f969 (2026-10-30), NDEBUG in release - #1681
Draft
jonathan308 wants to merge 4 commits into
Draft
jonathan308 wants to merge 4 commits into
jonathan308 wants to merge 4 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
jonathan308
marked this pull request as draft
October 30, 2026 16:06
This was referenced Oct 30, 2026
libs/mlx and libs/mlx-swift's nested core move to Layr-Labs/mlx 70245518 (Layr-Labs/mlx#49), the merge of upstream MLX main 1ba7f969 (2026-10-30) into the fork's main, which contains the previous pin 72dffa2d. libs/mlx-swift moves to 19b72070 (Layr-Labs/mlx-swift#66): the new core and C layer (Layr-Labs/mlx-c#20), regenerated sources, and NDEBUG in release builds of Cmlx, without which upstream's new per-dispatch debug checks ran in release builds and cost about 10% of decode. Measured on two M5 Ultra 256 GB, tensor parallel, one session, with only MLX differing (worker built from #1680): Qwen3.8 27B decode 81.5 / 66.5 tok/s (256 / 1,024 tokens) against 79.1 / 66.1, GLM-5.3-Flash 94.9 / 102.6 against 102.2 / 100.8 (run-to-run noise: GLM c1 decode p50 117.6 against 117.7), prefill unchanged. The 12 fixed greedy answers of each model are byte-identical, and concurrent rows equal solo at every level (Qwen c1-c8, GLM c1-c16). docs/architecture/inference.md records that the cluster's MLX attention calls must keep one sequence per call: upstream's sdpa_split picks its key blocks from the batch size. A changelog fragment follows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
libs/mlx and the nested core move to 15dd4571 (Layr-Labs/mlx#49) and libs/mlx-swift to 00505522 (Layr-Labs/mlx-swift#66, nested mlx-c 2db89819 of Layr-Labs/mlx-c#20). The core's three commits since 70245518 are fixes. In the expert-tile gathered matmul, the tile descriptors now stay alive for the tile kernel when MLX_GATHER_QMM_EXPERT_SLICES is not trust; serving sets trust. Two sealed all-sum names no longer read as MLX ops to the stream-argument lint. Two upstream tests run on the GPU only. Kernel sources and the metallib are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
libs/mlx and the nested core move to 47c5eb0e (Layr-Labs/mlx#49) and libs/mlx-swift to 86718def (Layr-Labs/mlx-swift#66, nested mlx-c ba493a03 of Layr-Labs/mlx-c#20). The core's one new commit is a fix: with MLX_GATHER_QMM_EXPERT_SLICES set but not to trust, the expert-tile gathered matmul's readback no longer frees the contiguous copies of its operands before the kernels that read them run. Serving sets trust, and on M5 the neural-accelerator route takes these calls first. Kernel sources and the metallib are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fragment named the mlx-swift-lm pin of the dev this branch was first based on. After the rebase onto dev d9d36fe, the branch leaves dev's pin 67110e7b unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308
force-pushed
the
perf/mlx-upstream-2026-10-30
branch
from
November 8, 2026 08:00
cf5f707 to
f6d8625
Compare
This was referenced Nov 12, 2026
This branch had an error being deployed
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.
Status (2026-11-09, PR sweep)
devandmasterstill pinlibs/mlx72dffa2dandlibs/mlx-swiftc633d221.devmoved292 commits since this branch's base, with no conflict. No base merge now: merge
devin when 0.10.12 takes the update,then rerun CI on that tree.
devPR. Signed and Verified.merge needed. Merge them with merge commits so these pins stay on the forks'
main.detection for pairs.
Measurement to clear it for 0.10.12 (needs an M5 Ultra window and the Studio; no GPU work on Mac A)
Two provider builds from the same
devtree, differing only inlibs/mlxandlibs/mlx-swift: P (72dffa2d/c633d221) and N (this PR). Each gets its own source-matched metallib (scripts/fetch-metallib.sh), and bothmetallib hashes are recorded.
requests; GLM-5.3-Flash TP2 at 1, 4, 8 and 16. Run order P N N P P N N P, so 4 runs per arm and not 1 against 2. Each
run uses the same
bench.py(unique prompts, temperature 0, 3 repeats, medians) with 256 and 1,024 output tokens,cn_equalat every level and the 12 fixed answers. Check the thermal state before each run.N with #4760 reverted (float32
gandbetaingated_delta_update); N with thesdpa_splitroute turned off (alocal-only switch, after checking whether Qwen's verify windows reach it at all, as the refactor pass below argues
they do not); and one Metal System Trace per arm at 4 concurrent (GPU busy share, command buffers per token, top
kernels).
Qwen3.5-9B, Qwen3.5-35B-A3B, Qwen3.6-35B-A3B, Nemotron 3.5 Lightning and Bonsai 2 9B, plus Nemotron 3.5 Super and
MiMo V2.6 if the Studio holds them.
Use the production settings (MTP
auto, prefix cache on, sampled at the model defaults). Measure decode at 1, 4 and 8concurrent with 2K and 16K prompts, cold TTFT at 2K and 16K, and prefill at 3K and 11K. Order P N N P, with 3 repeats
per cell. The Studio is an M3 Ultra and has no NAX, so if the window allows, repeat Gemma and Qwen3.6 for one hour on
one M5 Ultra: the NAX kernels that #4741 renamed run only on M5.
The default setup is not reproducible run to run on either core, as "Single Mac" below shows. Compare the 12 fixed
answers and
cn_equalat 4 and 8 concurrent. Explain any difference by one of the upstream changes that alter bitsby design (#4760, #4723, #4769, #4775); for a model with an unexplained difference, run a GPQA spot check (OpenRouter
flags low GPQA).
and its P-against-P spread,
cn_equalholds everywhere, and every changed answer is explained. Otherwise keep itout of 0.10.12.
Release work if it clears:
metallib_hash. Take the expected hash from the final DevNet build's row and update the release kit's expectedhash,
docs/operations/provider-release.md, and the facts dry run's staged metallib (facts-dryrunstops on amismatch). This PR reports that
scripts/fetch-metallib.shpasses its completeness contract with #4741's new kernelnames; check that again on DevNet.
metallib_sha256andnative_runtime_sha256change, and approvals are derived again(0.10.11's 24 plus 0.10.12's 24 is 48, within 64).
darkbloom-cluster-pair-check record, for everydeclared model and mode: Qwen3.8 27B, Qwen3.5-9B MTP modes, GLM-5.3-Flash, MiMo, and Gemma tensor parallel and pipeline.
A record that becomes
divergedwithholds its family.GLM5NextManagedLoadTestson a Metal Mac, as for 0.10.11.Summary
The provider and cluster worker now build on upstream MLX main
1ba7f969(2026-10-30), merged into the Layr-Labs forks. Speed is unchanged for Qwen3.8 27B and GLM-5.3-Flash, and outputs are byte-identical. Release builds no longer run MLX's debug-only work.libs/mlx72dffa2d47c5eb0e: Layr-Labs/mlx#49, upstream1ba7f969merged into the fork'smainlibs/mlx-swiftc633d22186718def: Layr-Labs/mlx-swift#66, with the core above and Layr-Labs/mlx-c#20libs/mlx-swift-lm67110e7b(dev's pin)Upstream since the last merge (34 commits):
sdpa_splitkernels for speculative-decoding mid rows (#4723);gandbetaingated_delta_update(#4760);config::get;The NAX quantized kernels (#4712, #4709, #4682, #4654, #4640) were already in the previous pin.
Release builds and
NDEBUG:NDEBUG, so release builds ran the core's debug-only work.NDEBUGforCmlxin release.Fork fixes in the merge (details in mlx#49):
MLX_GATHER_QMM_EXPERT_SLICES=trust, the route's readback released the tile descriptors and the contiguous copies of the operands before the kernels that read them ran. Serving setstrust, which does not read back, and on M5 the neural-accelerator route takes these calls first.Measured on two M5 Ultra 256 GB (TP2 over Thunderbolt 5 RDMA, encrypted and peer-verified)
Setup:
bench.py(unique prompts, temperature 0, 3 runs, medians), the 12 fixed greedy answers per model, andcn_equal(every concurrent row byte-equal to its solo run).NDEBUGNDEBUGPrefill (3K / 11K / 16K tokens):
Noise: the GLM 256-token median ranges overlap (94.5–104.4 against 99.0–104.6). GLM's single-request decode p50 in
cn_equalis 117.6 against 117.7.Exactness, every run:
Single Mac (GLM-5.3-Flash on Ultra A alone):
darkbloom start --foreground --localwith the 64K GLM selection, as in the 2026-10-20 single-Mac baseline. The providers were built the same way from Cluster: M5 Ultra verify-window layout for exact Qwen TP projections (+6% Qwen 27B TP decode) #1680 against each core.GLM-5.3-Flash images and video (TP2 on the pair, worker built from
e881d5c2):0.10.4-dev.branch.9build, run first in the same session: image kit 51 cases and video kit 15 cases, none newly failing or newly passing.976193e8) only changes a path that serving does not take, so these were not re-run on it.Before
flowchart LR subgraph Code P1["provider / cluster worker"] --> S1["libs/mlx-swift c633d221"] S1 --> C1["core 72dffa2d (upstream main of 2026-10-23)"] S1 --> R1["SwiftPM release: NDEBUG not defined"] end subgraph Behavior B1["Qwen 27B TP2 decode 79.1 tok/s, GLM TP2 102.2 tok/s (256 tokens)"] endAfter
flowchart LR subgraph Code P2["provider / cluster worker"] --> S2["libs/mlx-swift 86718def"] S2 --> C2["core 47c5eb0e = upstream main 1ba7f969 merged into the fork"] S2 --> R2["SwiftPM release: NDEBUG defined for Cmlx (no per-dispatch debug checks)"] end subgraph Behavior B2["Qwen 27B TP2 81.5 tok/s, GLM TP2 94.9-102.6 tok/s; outputs byte-identical"] endValidation
Fork repos:
MLX_ENABLE_TF32=0. With TF32 on, 336/342: the same 6 linalg cases fail on unmodified upstream on NAX.qmv_batch_invariantpasses.tests/jaccl14/14 under ASan+UBSan and under TSan.testGemmaGateUpSortedAffineGatherQuantizedMMExpertSlicesstopped on the debug check there, as it did in CI.check_forkdiffpasses in all three repos.This repo:
scripts/docs-impact-check.py --base origin/dev: coverage OK.scripts/changelog.py check: passes.scripts/docs-check.sh: 204 files OK.scripts/fetch-metallib.sh) builds and passes its completeness check.Refactor pass
An independent review pass found no problem with the pins.
It checked every
MLXFast.scaledDotProductAttentioncall site reachable from cluster and batched serving: contiguous and paged caches, Qwen TP, MiMo, GPT-OSS and the vision towers. Each call carries one sequence.attendUniformQueryBlocks) uses an array mask and 128-query blocks, so it cannot reachsdpa_split.It tightened the docs paragraph:
sdpa_splitcondition: at least 128 keys, no array mask or sinks, head dim, more than one KV head off NAX;It corrected the changelog:
NDEBUGline so it implies no shipped regression.I dropped one of its additions, a claim that the first start recompiles kernels, because nothing measured supports it.
It noted, outside this PR's scope:
docs/architecture/components/mlx-swift.mdhas a stale pin table;libs/mlx-swift-lm/Package.swiftstill names mlx-swiftc633d221. The provider's local path dependency overrides it, as before.Limitations
main.