Repository navigation
Conversation
Register Apple M5 Ultra / Apple10 / 64 cores as its own backend: the two 32-core M5 Max dies it joins are a different device for the crew geometry and the bus, and the 80-core part is another. With 96 GB (a 77.76 GB GPU working set) the target and its drafter fit at the full context. The profile is tools/profile_writer.py's on the device (Mac Studio, macOS 27.0.1): block scales, one threadgroup per core, the matrix tile from 2 rows for NVFP4 and INT4 and from 4 for FP8 and BF16, and v3 attention, faster than v1 and v2 at every measured point; sibling_order is alu_first from p12 (88 % of the ALU sibling hidden encoded first, 13 % encoded second). The writer decides the lane order from one T = 1 point, which fell on either side of the 3 % margin run to run on this chip (contiguous +9.5 %, then +2.3 %). Two paired alternating A/B runs across the target's shapes are a tie on the target (the NVFP4 MLP faster contiguous, FP8 and BF16 faster interleaved16), so the writer's tie rule and the Apple10 default stand: profile_writer takes --lane-order to pin it, and the cost tables are measured on that layout. The probe results are committed. Refs lithos-ai#13 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Refs #13. Stacked on #96 (the
m5_ultra_64cbackend): this branch is cut frompr/m5-ultra-64c, so review the last commit, backends: measured kernel choices and 512-row prompt passes for the M5 Ultra.This is the first measured step of #13's item 2: whole-model numbers on the real target,
nvidia/Qwen3.8-27B-NVFP4(482ca0f) withLithosAI/Qwen3.8-27B-DSpark-NVFP4(b169bc4). It adds the measured kernel choices, decides the lane order on the whole model, and sets serve's prompt chunk.What changes
m5_ultra_64c/kernel-choices.json(54 entries), referenced fromconfig.json(kernel_choices):db53f2fdid for the M3 Ultra.m5_ultra_64c/backend.py:serving_prefill_chunkreturns 512 (exact passes, as on the M3 Ultra and the 40-core M5 Max).writer.decisions.lane_ordernote. interleaved16 stays, so the profile and its cost tables are unchanged andprofile_writeris not re-run.apple-m5-ultra-64c, and the M5 Ultra test checks the 512-row hook. The backends README row is updated.Method
Same machine (Mac Studio M5 Ultra, 64-core GPU, 96 GB, macOS 27.0.1), same day (2026-10-21), nothing else on the GPU.
Decode harness:
serving.setup.prepareandBackend.select_session'sload_sessionoptions, so the DSpark arms verify 7 proposals plus the anchor, with the fixed rule.tools/bench/spec_bench.py(code0,math0,chat0,text0).--max-context 32774, so plain and DSpark share one target pack (capacity 32768 + 6). Each lane order gets its own pack.Prompt-tile sweep:
1. Baseline: default geometry (
--no-autotuneequivalent), interleaved16This is the "before" arm of tables 2 and 3. It matches PR #96's serve exactly.
2. Lane order on the whole model: interleaved16 stays
Each A/B is 3 paired alternating runs, with a pack per layout.
Default geometry:
Autotuned: each layout on its own live-tuner cache, which is what serve would ship for it.
Verdict: interleaved16 is faster wherever the ranges separate.
Contiguous is not a clear win anywhere, so the pin from #96 stands and
profile_writeris not re-run. [H] The whole model weighs shapes the kernel-level tie in #96 did not cover at their program geometry (all the FP8 projections, the drafter, the lm_head). Plain tokens are identical across layouts on the default geometry.3. Kernel choices: serve decode, before vs after
KernelChoicesfrom the shipped file, 512-row chunk. The prompts are ≤ 29 tokens, so the chunk does not enter decode.Results:
text0, and DSparkcode0,math0andchat0.4. The prompt pass's 32-row tiles
Measured in the 512-row prompt program at 2048 tokens of context. ms is summed over the pass's ops of each shape.
Whole pass, 5 paired alternating runs, min-of-3 each:
Three shapes choose the same geometry at 128 and 512 rows. Of the other five, two differ only in the scale cache (ties), and three are near ties or under 3 ms of the 512-row pass. The shipped set is the 512-row one, since serve now runs 512-row passes.
5. serve's prompt chunk (
serving_prefill_chunk)Prompt GPU time in ms. Chat prompts of exactly N tokens, exact passes, 3 reps per run.
Context only: the published 40-core M5 Max figures (not a matched A/B)
These come from another machine, other prompts, other recipes and another day.
m5max-27b-dspark-refinement.md): 42.6 ms at 128 tokens with its tuned NVFP4 draft recipes, and 12.47 GPU ms per delivered token on its four prompts (about 80 tok/s).Tests
pytest tests/contract tests/kernels tests/runtime: 2739 passed, 40 skipped, 3 failed. The 3 failures are the existingtest_streaming_moe_oracle.pyones under transformers 5.20 (Qwen3_5MoeTextRotaryEmbedding.__init__() got an unexpected keyword argument 'device'), unrelated to this change.tools/ci/hygiene.py: ok.Not in this PR
gdn_mixer_fusion, megakernels, DSpark draft recipes) for the M5 Ultra: the measured M5 Max recipes don't carry over.tools/benchversion is wanted.🤖 Generated with Claude Code