Repository navigation
qwen3_5 cuda: warm turns prefill the next turn's prompt and keep only a 4096-row-multiple end - #2824
Conversation
|
Thanks @devopsfortunato, this is a careful find. The
We'll write the CHANGELOG line when it lands.
|
|
CI on head Local runs in this branch's tree, for the record:
|
|
@devopsfortunato thanks for the green CI. Tonight #2838 landed the Your enablement is the copy we'll land, and #2873's foreground yield goes first: without it, a request arriving during a warm pass waits for the whole prefill. Warm turns follow the prompt cache, as on Nemotron, so no new switch is needed. Our other asks still stand (the body notes, #2686 first, receipts), and please check that
|
|
@devopsfortunato a correction to my 11 Nov comment, sorry: #2838 has not landed yet. It's in the landing queue (its checks are green), and the The other asks from that comment are unchanged.
|
5a4867d to
e6af058
Compare
|
@devopsfortunato your new head (
|
|
Rebased and reshaped per your comment. Head is The Line budget. Where the wrappers sit is not arbitrary and I measured it: Body notes are in: what a warm pass actually keeps here (only at an exact multiple of the 4096-row grid, a pass that would keep nothing is cancelled before it runs, so a turn under 4096 rows keeps nothing and a 5000-row turn keeps its 4096 mark but not its end), that #2686 first is stated in the stack section, and #2804 is Receipts are the one thing I cannot post yet. The GB10 here is still serving another model, so Host side, all with |
|
Thanks @devopsfortunato, the reshaped branch reads well. We have no more code asks. Here's what we checked on
To answer your two questions:
Please post the numbers for both sides here. Once they match, we'll write the changelog line crediting you.
|
GB10 receipt — warm turns on the 4096 boundary (dense)The device run the 11 Nov review asked for, with one substitution: the checkpoint staged on this machine is Qwen3.5-2B MLX 4-bit (
Not covered here: the Qwen3.8-27B NVFP4 cell (no |
|
@ashhart @devopsfortunato the receipt above covers the dense path on Qwen3.5-2B. If the larger cells help before landing, I can run the same |
|
Yes please, @jschmied — those are exactly the two cells I flagged as not covered. main |
|
@devopsfortunato @ashhart here are the two larger cells on a GB10, run as main
Qwen3.6-35B-A3B (
Qwen3.8-27B dense,
|
|
Thanks @jschmied for the two larger cells, and @devopsfortunato for asking for them. They settle the order. On @devopsfortunato, one question: your 2B run kept 4096 on what should be the same head, where the 27B and 35B kept nothing. Was #2838 merged into that build, or was it a different binary? The served binary's md5 would settle it. What's left is unchanged:
The cell for a request that arrives during a warm pass belongs to #2873.
|
@ashhart answering your question: #2838 was not in that build. The branch worktree served So jschmied's larger cells are right and my 2B "qualified: true" line is wrong. I could not reproduce it, and with the logs in hand I can see why it should not happen at all:
One small lesson for the tool if it helps: a |
e6af058 to
f5d9ad1
Compare
|
Rebased onto What I re-verified on the rebased head (fresh builds,
|
|
CI is now green on rebased head I also corrected the receipt record in place: my original positive 2B result is withdrawn, and the earlier proposed race explanation was not demonstrated. The retained-binary checksums and later #2838 is in the new base. #2686 and #2873 are still open; after they land, your requested fresh dense/MoE comparisons and the Clef request remain outstanding. This rebase/green CI is not a claim that those device requirements are complete. |
|
Thanks @devopsfortunato, that is a model correction. Answering the binary question with the md5s, rerunning the cell three times on each build, and withdrawing the 2B line is exactly how we want receipts handled, and the false keep you describe is a good find for the tool. We rechecked the rebased head here. It applies to today's main with one adjacent-lines hunk in cuda_snaps.zig, which we resolved by hand, and the two new warm steps plus the prefill, request-starts and cost-open steps pass. Lean adds nothing and cuda_native.zig stays under the cap. Nothing more from you right now. This waits on the order we set: when #2686 and #2873 are in we will post here, then the fresh 27B and 35B comparisons and the one Clef readout on that head, and it queues.
|
|
I’m preparing the dense MTP work for #2485 as an unpublished local branch. ATC reports a merge conflict in |
|
@tacosta no preference from my side; the landing order is Ash's call, so please don't hold #2485 for this PR. It's parked: #2686 was closed on 14 Nov, so as far as I can see only #2873 is ahead of it, and then the fresh 27B/35B comparisons and a Clef readout still have to run on its head before it queues. So the conflict is cheap to resolve in either order, here is everything this PR does to
Nothing else in the file, and |
f5d9ad1 to
ecf9e5e
Compare
|
Thanks for laying out the three hunks. The local #2485 candidate currently has 592 lines in |
|
Thanks @devopsfortunato for keeping this branch tidy through the rebases, and for laying out your three We reread the head named in the description ( There's one change in what's open: #2686 was closed on 14 Nov, as you noted, and it was what covered our third ask from 11 Nov. That ask was about exactness, so it now falls to this PR:
The device asks are the same as before, with one cell added. Once #2873 is on main and this is rebased, we need main against the head on Qwen3.8-27B dense and Qwen3.6-35B-A3B (MoE, MTP on), using
|
|
Rebased onto Checked locally on this head with fresh caches, all exit 0: the two new steps (warm-turns 16/16, warm-rules 12/12), prefill 19/19, qwen35-request-starts 17/17, request-starts 14/14 (also 14/14 on One heads-up, since #2841 is yours: Still waiting on #2873, then the 27B/35B comparisons and the Clef readout on that head, as you set out. |
|
@ashhart thanks, both points taken.
The device asks, including the new |
|
@ashhart item 1 is in head Both callers now use The new host regression checks the 600-token-system-prefix shape ( Lean: parent Item 2: the description now names The final dense/MoE comparisons, request-starts-on system-prefix cell, and Clef device request remain unrun on this head and still follow #2873 as requested. |
|
CI result on The description now names this head and those checks. This resolves the two host-code/description requests in your 15 Nov comment. It is not final device qualification: after #2873 lands, the fresh 27B dense/35B MoE comparisons, the request-starts-on cell with a >512-token system prefix against a fresh no-cache server, and one Clef readout remain as requested. The Spark was not interrupted for this host-only revision. |
7480074 to
2e8690e
Compare
|
@ashhart #2873 has landed, so I followed the order you set out: rebased and re-verified. Rebase. Branch is now two commits on main |
|
@ashhart #2873 has landed, so I followed the order you set out: rebased and re-verified. Rebase. The branch is now two commits on main Item 1 (warm-pass starts) is carried unchanged in the second commit: one Checks on
Still to do on this head, per your list: fresh main-versus-head runs for Qwen3.8-27B dense and Qwen3.6-35B-A3B MoE with MTP on, the one Clef readout that must not fail with |
|
Both sides of each cell, all on the GB10 Spark, main Qwen3.8-27B dense (
Qwen3.6-35B-A3B MoE, MTP on (
The new cell, Clef readout: one Between runs the Spark's serving engine on port 8888 was stopped only for the 20 GiB MoE pair and restored afterwards (verified answering). One environment note: the dense pair ran beside that engine with |
|
Thanks @devopsfortunato. Every ask from 15 Nov is answered at The GB10 results cover what we asked for. On Qwen3.8-27B dense and on Qwen3.6-35B-A3B with MTP, the replies match main's token for token while the head resumes 4,096 cached tokens. With Nothing more is needed from you. It's in our landing queue.
|
… a 4096-row-multiple end The Qwen3.5 CUDA family declared no warm pass, so the server never ran one for it. Both entry points now declare `warm_quiet` (150 ms) and `warm_usable`, `cuda_snaps.cacheRules` reads a family's `warm_usable`, and a CUDA host takes the family's own wait instead of Nemotron's. What the pass keeps is the narrow part: a request's chunk starts never reach its own end, and this family's grid is 4096 rows, so the end survives only when the prompt is an exact multiple of it. A turn under 4096 rows keeps nothing and is cancelled before it runs; a 5000-row turn keeps its 4096 mark but not its end. `prefillFn`'s whole text pass is fixed on main (ashhart#2838); this branch carries the enablement only, and ashhart#2873's foreground yield goes first. Host tests: the declarations on both entry points, and a family's warm rules and its own wait. Refs ashhart#2812
Share the existing chat chunk-start expression through Plan.request. A warm pass computes its own system prefix and uses that same plan, so request-starts caching does not skip the system cut on the background path. The host regression compares warm-prefix and later-request cuts with a 600-token system prefix. Skipping the cut fails the test; preserving it gives the same starts below the warm end. Refs ashhart#2812
2e8690e to
cd719ae
Compare
|
Thank you @devopsfortunato. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
What this changes
cache had the warm-turn path (a prompt-only pass over the next turn's prompt,
lane_host_warm.zig:6)and Nemotron was the only family using it.
qwen3_5andqwen3_5_moedeclarewarm_quiet(150 ms) andwarm_usable,cuda_snaps.cacheRulesreads a family'swarm_usable, and the CUDA host takes the family's own waitinstead of Nemotron's constant. Existing families retain their existing rules; in particular Nemotron's already-enabled warm path is not switched off by this change.
74800743e, now replayed as2e8690e2con current main): chat requests and warm passes now use the samechunk_plan.Plan.requesthelper. It preserves chat's existing system-cut expression; the warm path computes its own system prefix and passes it to that helper. This addresses the missing cut withTF_QWEN_REQUEST_STARTS=1, without changing chat's existing cuts or families withstep == 0.Store.usableaccepts that position (prompt_cache.zig:216-218) — for a planned family, only at achunk start. A request's starts never reach its own end (
chunk_plan.zig:50returns beforeids.len),and this family's grid is
snap_grid = E.max_rows= 4096 rows (cuda_native.zig:55), so in practicethe end is kept only when the prompt is an exact multiple of 4096 rows. A pass that would keep nothing
is cancelled before it runs (
lane_host_warm.zig:9), so a turn under 4096 rows keeps nothing at all,and a turn of, say, 5000 rows keeps its 4096 mark but not its end. The gain is a follow-up that
resumes from the last full 4096-row row rather than recomputing it, not a resume from the prompt end.
prefillFndispatch fix and its host test are Qwen 3.5 CUDA: a stream's whole prompt fill runs once (fixes #2804) #2838's, andthe foreground yield that stops a request arriving during a warm pass waiting for a whole prefill is
fix(qwen3.5/cuda): yield background prefill between chunks #2873's. This branch no longer touches
prefillFn.--prompt-cache-diskwithTF_QWEN_KV_PAGES_ALLrefusing at startup) was the same
prefillFnshort-circuit and Qwen 3.5 CUDA: a stream's whole prompt fill runs once (fixes #2804) #2838 fixed it, not here.077998f7d(a clean rebase of the two commits from5c82ef28a). fix(qwen3.5/cuda): yield background prefill between chunks #2873 merged 2026-11-15T20:02Z, so the only open landing prerequisite is now met, and server: a warm pass keeps the state the next turn resumes (chunk cut, tool-result opener, reasoning) #2686 remains closed. The system-cut exactness requirement server: a warm pass keeps the state the next turn resumes (chunk cut, tool-result opener, reasoning) #2686 left behind is addressed by the three-server-file review fix. Device qualification of this head remains outstanding.atc overlap --jsonchecked 2026-11-16T14:16Z, comparison base5c82ef28a(before the rebase; the same two files are the only conflict,git merge-treeagainst077998f7dis clean): coverage is incomplete (otherPullRequestsLimit,pullFilesUnavailable,pullRequestsLimit,timeLimit). It reports the known Qwen 3.5 CUDA: kept prompt states reuse a freed pinned buffer of their size #2841 append conflicts inqwen3_5/cuda.zigandnative/cuda_snaps_test.zig.git merge-treeconfirms the same two files conflict on parentecf9e5e3aand this head; the new server-only change shares no files with Qwen 3.5 CUDA: kept prompt states reuse a freed pinned buffer of their size #2841. The existing conflict has already been reported to Ash; unknown pairs are not cleared. An issue check with the previously reviewed bounded ATC repair returnscomplete: true,advice: yours,myPullRequests: [2824](no new issue claim).Checks on this head
2e8690e2c, two commits on main077998f7d(rebase ofe1fd0ec53/2e8690e2cfromecf9e5e3a/74800743e;git merge-treereports no conflict with main):chunk_plan.Plan.requesthelper used by chat and warm, plus the helper-level regression (3 files, +26/-3).zig build -j2 -Dfixed-cpu test-server-cpu --test-timeout 10m --summary allon this head: 5/5 steps succeeded; 1491 passed, 8 skipped, 0 failed, exit 0. On the previous head the same step gave 1462/8/0; main added tests since. Skips are optional fixture/asset cases. Expected-negative diagnostic output is not counted as a failed test; the build summary and exit status are the results.test-qwen35-warm-turns-host18/18 andtest-cuda-warm-rules-host12/12, 8/8 build steps succeeded, exit 0 (16/16 before the rebase; main added one warm-turns test). The permanent chunk-plan regression: the filtered server step ran 21/21, exit 0. Suppressing the system cut in the helper gives 20 pass / 1 fail, exit 1 (missing cut 599); restoring it returns 21/21. The temporary build step was removed before committing; the permanent test is reached bytest-server-cpu.Plan.startsomits that cut. It is not an end-to-end capture of submitted warm/chat requests, and reverting only the warm caller would not fail this helper test.077998f7d, same checker: 341 inherited findings on both sides; 0 new,lean_new.pyexit 0 (also 0 new against the previous head). The standalone checker exits 1 for those inherited findings on both sides. Changed-filezig fmt --checkandgit diff --checkpass.chunk_plan.zig192 lines,chat.zig307,warm.zig83;cuda_native.zigremains 597 (cap 600). The pre-existing admission-test wrapper relocation is unchanged.ecf9e5e3a, not claimed as re-run individually on this head (warm-turns and warm-rules were re-run here, see above): prefill 19/19, Qwen request-starts 17/17, native request-starts 14/14, cost-open 4/4, share-faults 20/20, pages-default 19/19, dspine 80/80, GLM snapshots 21/21, ModelOpt admission 147/147 (same on5c82ef28a). CI on that parent was green.2e8690e2c(this head): 9 checks passed, 2 nightly jobs skipped.zig27m26s;zig-b26m16s;zig-windows14m33s;pytest9m51s;fmt18s; macOS developer tools 1m20s; release paths 3m34s; benchmark-clients 2m22s (Ubuntu) and 2m47s (Windows). No GPU run, format run. On the pre-rebase head74800743ethe same nine checks also passed (runs 43886165989, 43886166289). No device results are claimed for either head.Receipt
eab305db0, old heade6af05814, and that head with Qwen 3.5 CUDA: a stream's whole prompt fill runs once (fixes #2804) #2838 applied. Those are not measurements of current headecf9e5e3a. After fix(qwen3.5/cuda): yield background prefill between chunks #2873 lands, the maintainer still requests a rebase and fresh main-versus-head dense/MoE comparisons, plus one Clef readout request that must not fail withInvalidQwenPrompt. My original positive 2B receipt remains withdrawn.this family. No other family changes.
--prompt-cache-gib 0, as on Nemotron;TF_QWEN_REQUEST_STARTSstill governs message starts and isunchanged.
warm_turnsre-routes everymax_tokens: 0request through the warm pass(
lane_host.zig:403), and that pass ends the request.cancelledwhen it would keep nothing(
lane_host.zig:493). So a client's explicit prefill-only call on Qwen3.5 CUDA with a prompt under4096 rows now returns cancelled instead of prefilled. That is what the capability already means on
Nemotron, and embeddings and readouts are exempt (
engine_api.zig:100), but it is user-visible.warm_quietalso sets the cache rulewarm = .waits, solookupUserAtnow prices andkeeps an endpoint that is the prompt end for prompt-only requests too (the same rule Nemotron
already has), not only for a reply's warm pass. With
snap_lookahead = 0the only reachabledifference is that endpoint charge, and only when the history is exactly the prompt and 4096-aligned;
cold-pass cache behavior for Qwen is otherwise unchanged.
warm_usable = truethe end is kept only whereStore.usableaccepts it, as the third bulletabove spells out: an exact multiple of the 4096-row grid, or a request chunk start below the end.
Interior grid marks go through
lane_cache_queue.keep, which never consultswarm_usable— that isdeliberate, since an off-grid end is not resumable and keeping it would only hold budget.
warm_quietalso keeps the family off the KV ledger (cuda_ledger.wantedrefuses anyfamily that declares it). A no-op today: no CUDA family declares
per_request, sowantedalreadyreturned false. Noted in the comment where it is enforced.
what a turn keeps.
--prompt-cache-gibis set.Kernel contract, only when a GPU kernel is new or changed
n/a — no kernel is new or changed.
Checklist
two new steps check declarations and rules that do not exist on main, so they do not compile there.
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. — full matrix not verified on this head; historical main-versus-branch hash equality alone does not prove these contracts.