Repository navigation
Conversation
…over Metal target.zig is the lanes' verify target: a slot's prompt, its windows of rows for several slots in one launch, keeps and rewinds, and kept prompt states (the prompt cache) whose resumed rows the reply reports as cached_tokens. boot.zig loads a release checkpoint folder and entry.zig serves it as tensorfold-dsv41 (dsv41-metal-serve). Tests serve the tiny model through LaneHost: concurrent equals solo equals serial, drafted equals draft:false, cache hits equal fresh runs, seeds and cancels.
…for the next A shared round with the plain switch at it asked no drafts and ran no head pass (core Rule.plain_streams, threaded from the family's resolved setting: 0 on CUDA, so its rounds are unchanged), and the family's speculation no longer launches a pass for a round that wide (armSpec/speculate plainRound).
…teps and the forward try's
…stays within 600 lines
…nything else by name
…treams streams decode
…er holds a rejected draft's taps
…nd the next ask catches the drafter up
…in / piece / finish) The Metal target implements the lane core's chunked hooks over its whole-prompt path: `begin` clears the slot or restores a kept state, each `piece` runs encoder chunks from the slot's tail position, and `finish` runs the rows the pieces left, the decoder's cone once over the prompt's end, and the choice and keep exactly as `prefill` does. An `encode` that stops short of the prompt's end prepares the next call's first chunk (keyed by the slot's tail and rows), so a lone prompt in pieces of the chunk size runs the same chunks, inputs and host overlap as one call. A mid-prompt state is never kept: a released, cancelled or failed prompt is abandoned (nothing saved, the prepared chunk dropped) and the slot's next prompt starts cleared. The lanes backend fills prompts a step at a time (Backend.prefill_step over the pieces, draft/lane_steps.zig) only when Options.steps is set; serve_lanes turns it on for Metal with TF_DSV41_PREFILL_PIECES=1, TENSORFOLD_PREFILL_ORDER=srpt or a LaneHost prompt policy, share or budget. With none of them set prompts run whole at admission, as before; the CUDA backend never sets it. Tests: pieces of 1, 7, 64, 100 and 300 rows equal the whole prompt (every state byte, the first choice and 8 greedy tokens) with a decode stream running between pieces; two prompts' pieces taking turns at the same positions; refused and released mid-prompt prefills; kept prompts resumed in pieces; served replies in steps equal serial; a short request during a long prompt gets its first token first in steps (after it as whole prompts); a cancel mid-prompt keeps nothing; host tests over a stepped CPU twin for the step adapter, its failure and cancel paths and the switch.
…pt's steps With prompts in steps the lane host ran one decode round after each 4,096-row piece, so a reply beside a long prompt drew one token a piece. The DeepSeek served lanes now use LaneHost's own share: `--decode-share` reaches LaneHost (its share and, while replies decode, its row cap on a step), else TENSORFOLD_PREFILL_SHARE, else replies get 0.25 of wall time beside a prompt in steps. A step taken while a reply decodes owes it a third of the step's time in rounds before the next step; with no reply decoding nothing is owed, so a lone prompt runs as before. `--decode-share` on Metal turns steps on. With steps off the share stays the host's default (whole prompts). The target counts the most launches between two of a prompt's pieces (Stats). Tests: on the device, a share of 0.75 gives a decoding reply at least 3 rounds between two pieces (37 here) where a share of 0 gives at most 1, replies equal serial; host tests of the same over the stepped twin and of which share applies (flag, env, default, whole prompts).
…refused by name, docs `serve_lanes.stepsFor` takes --decode-share: above 0 it turns prompt steps on (its share then reaches LaneHost), outside [0, 1) it is refused, and otherwise the environment decides as before. The Metal entry reports either refusal by name at open: the flag's range, or TF_DSV41_PREFILL_PIECES's expected forms when its text is malformed (blank keeps the default). Docs: TF_DSV41_PREFILL_PIECES's row in environment.md names what it does on each backend; api.md lists DeepSeek-V4.1 on Metal among the servers that apply --decode-share; profiles.md notes the Metal reader; the optimization ledger's DeepSeek cell for prompt chunk interleaving is open on Metal. Test: --decode-share 0.5 with no environment turns steps on at that share (and the row cap); 0 and unset keep whole prompts; 1, 1.5, -0.1 and NaN are refused; a blank switch keeps its default and malformed text fails.
…nk at its own size When a step stopped short of the prompt's end, `encode` prepared the next full chunk. Under a capped step (TENSORFOLD_PREFILL_POLICY=fcfs with _TOKENS, or the row cap beside replies with --decode-share) the next call asks for fewer rows, so that stage never matched and the call read its inputs again. The stage now takes the rows the next call will ask for when it repeats this one's size, which is the next full chunk for an uncapped step (the same as before) and for the rows a finish has left. `Prompt.stage_hits` counts calls that start on a staged chunk. Tests: on the device, pieces of 1, 7, 64, 100 and 300 rows each start every later call on a staged chunk (1 and 7 rows found one before this change) with state equal to the whole prompt; a served fcfs prompt in 128- and 100-row steps beside a decoding reply starts its steps on staged chunks (8 of 8 and 10 of 10; 1 before) and replies equal serial.
…hare in steps, as unset does applyShare skipped the steps default whenever TENSORFOLD_PREFILL_SHARE was present, blank included, while the lane host reads a blank value as unset and so as its own default share of 1: with steps on and the variable blank, a prompt kept all the time and replies were back to one round a step. A blank value now counts as unset here too. The share test gains the blank case (it read 1 before).
4 of 8 tasks
Owner
|
Thanks @gilby. The opt-in switch with Where it stands:
We will run the device check on our side on M3 Ultra and M5 Ultra with DeepSeek V4.1 Metal: a long solo prompt at 4096 and 8192 against the default, token hashes and state bytes equal, and a second slot arriving mid-prompt to confirm the return to base chunking.
|
4 tasks done
This was referenced Dec 5, 2026
This branch has not been 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.
What this changes
Adds opt-in
TF_DSV41_CHUNK_SOLO(0,4096,8192; default0= disabled) on top of#2950's chunked prompt scheduler so a single active prefill slot without waiters can widen its prompt chunk to4096or8192tokens, shrinking per-layer overhead at very long prompts (131K) while immediately returning to base chunking when another slot arrives.#2950).#2950(49a92da019c77163c5608b3ada65b57a16493667); adds 1 commit6243fbcfeb05a782a726056ebee8e310f1e70ae2. GitHub base ismainwhile#2950is open (Draft).atc overlap --json: Run at2026-11-17T08:07:39Zagainst#2950(49a92da01). Targeted--pulls 2950,2951,2952,2954,3278,3374,3404,3405,3459returnsconflict: "clean"against#2950and#2954, and file overlaps on the remaining unmergeddsv41stack PRs (2951,2952,3278,3374,3404,3405,3459).Checks on this head
6243fbcfeb05a782a726056ebee8e310f1e70ae2python3 tools/zig/lean_check.py, on the base (49a92da01) and on this head:345and345,0new (python3 tools/pr_check.py --base 49a92da019c77163c5608b3ada65b57a16493667:0 error(s), 1 warning(s), max touched source filelanes.zig578lines).zig fmt --check build.zig zigandgit diff --check 49a92da01..HEADpass.zig build test-dsv41-metal-all --summary all->9/9 steps succeeded; 48/48 tests passed(30+18, including(e) solo_chunk 128 -> busy 64 -> solo 128: 0 state bytes differ, tokens equal);zig build test-environment-host --summary all->3/3 steps succeeded. Planted negative controls: removingTF_DSV41_CHUNK_SOLOfromenvironment.zigfailstest-environment-host, and disablingsoloSlotwidening intarget.zigfailstest-dsv41-metal-serve.zig build test test-golden --summary allreported833/835 steps succeeded (1 failed); 406/420 tests passed (13 skipped, 1 failed)on'dashboard_test.test.dashboard page polls the public stats snapshot without private details', which is identical to the base#2950commit49a92da01(833/835 steps succeeded (1 failed); 13011/13120 tests passed (108 skipped, 1 failed)on both trees without--summary all).zig build test-dsv41-metal-all --summary all->9/9 steps succeeded; 48/48 tests passed;zig build test-environment-host --summary all->3/3 steps succeeded.zig build test-dsv41-metal-allandzig build test-environment-host-> exited0.#2950)..metalfiles modified); M1–M4, CUDA, HIP, Windows, and mobile targets were not run.Receipt
#2950(49a92da01) vs6243fbcfe(both default unset0and opt-inTF_DSV41_CHUNK_SOLO=8192) are in the public Gist.Nominalon all cells): decodeSLOWER: 0/20; MISMATCHES: 0(0.999–1.002xacross all 20 cells).Heavy FLAGGEDH!,H!,H!,H!after 6.5 h continuous load):s4-solo1matched#2950across all 20 cells, whiles4-solo2dipped near the tail producingSLOWER: 1/20onconc N=3 T=0.0 chat(68.9,68.8vs68.6,66.2, ratio0.979);MISMATCHES: 0(EQUAL bad=0everywhere; decode prompts are 14–25 tokens so chunk widening is inactive in decode anyway).bench_cache2k/8k/32k; single cold request131072):#2950mean (s)0) mean (s) / ratioSOLO=8192mean (s) / ratiotoken_sha256330cd07dd3cf)b2da1b2b327d)0e3f2ebade35)1e2921aaf094)330cd07dd3cf)b2da1b2b327d)0e3f2ebade35)1e2921aaf094)deepseek_v41draft/serve lane chunk scheduler and Metaltarget/promptstep loop (serve_lanes.zig,draft/lanes.zig,metal/target.zig,metal/prompt.zig).TF_DSV41_CHUNK_SOLO; default0(off), accepted values0,4096,8192; documented indocs/environment.mdand validated viaplatform/environment.zig(not a.profileswitch).deepseek-ai/DeepSeek-V4.1-Flash-1017Hugging Face revision1bae0e1088993b9b82de08f59de5be5a34e42170(config.jsonsha2568be45ce0476004a3f529fd896115a4a2e800a129ad2d3ec05b16050f52e21879); Zig0.17.0; Apple M3 Ultra, 512 GB (macOS 26.6.2, Xcode27.2/27B52, Metal32023.922); Apple M5 Ultra, 512 GB (macOS 27.2.1, Xcode27.2/27B52, Metal32023.922); Apple M5 Max, 48 GB (macOS 27.0.1, Xcode27.1/27A9275, Metal32023.921); drafter: checkpoint built-in DSpark + copies (--context 1048576 --parallel 4 --prompt-cache-gib 0 --vision).M3 Ultra,M5 Ultra, andM5 Max(ran); MetalM1/M2/M4and non-Metal backends (not run).tools/bench_concurrent.py --alone --serialortoken_shaagainst"draft": false:0failed,0--aloneunequal,0--serialunequal across all cells on both M3 Ultra and M5 Ultra;token_sha256identical across all decode and cold prefill cells (330cd07dd3cf,b2da1b2b327d,0e3f2ebade35,1e2921aaf094) and multi-turnsteps_test(solo_chunk 128 -> busy 64 -> solo 128).#2950(49a92da01) and in Gist.tools/bench_openai.py: M5 Ultra0.999–1.002x(0/20 SLOWER); M3 Ultras4-solo1matched base (54.6,43.8,50.5,44.1), whiles4-solo2dipped underHeavy FLAGGED(0.972–0.977x).ttft_sfromtools/bench_cache.py --require-coldon a long prompt, or "n/a" with the reason when the change cannot reach prompt processing: Default (0) matches#2950(0.988–1.012x); opt-inTF_DSV41_CHUNK_SOLO=8192speeds up131072cold prefill on both chips (1.0130xM3 Ultra,1.0300xM5 Ultra) while slowing8192(0.9162xM3,0.9618xM5) due to single-chunk scratch sizing below#2950's multi-chunk regime.n/a— uses existing release weights and built-in drafter.Checklist
The title and description match the head commit, including the receipt and the stack.
New tests fail before the change, pass after it, and skip cleanly without their dependency.
Comments and docstrings are one line. No measurements or history in the source.
No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.
Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off.
Drafted output equals
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.No precision traded for speed. If the bits change, the description says which sums change and why.
Decode and prompt processing are no slower than main at one stream and the widest admitted; with
--drafter, no slower than without it, greedy and sampled