Repository navigation
Conversation
|
Thanks @jschmied. I read this as a kept-state change on top of #2215. By reading, Flash Next, Gemma 4 and Nemotron copy the same bytes, in the same order, at the same kept offsets as main. A few things before it can follow #2215:
A small one: main's Nemotron staging copy in |
45836c7 to
eda4fd4
Compare
|
Thanks @ashhart. All four are done, on
The staging copy in Four things you should know:
|
|
Thanks @jschmied, that's a thorough round. Both of Qwen 3.5's keep arms are on the hook, the paged rows are now really Your two questions:
What's left:
It stays a draft behind #2215 until then. |
eda4fd4 to
ceacab1
Compare
|
@ashhart thanks. New head
I dropped the old CHANGELOG commit, since the line is yours to place. Proposed line: "Internal: Qwen 3.5, Gemma 4, Nemotron and Flash Next on CUDA copy kept prompt states through that walk too. Nothing a user sees changes (#2392, part of #1293)." 1. Rebase.
2. Flash Next
Oracle on
Planted faults, each one compiles and goes red in the named test:
3. Evidence on the new head.
Carried over: Nemotron. Its commit rebases Your solo-ring host test ( Blocked: Qwen 3.5 paged, host arm. On GB10 the host keep is only reached with the disk tier. On main Checks on
The body's checks and receipt are still from |
|
@ashhart on the blocked host arm: I bisected the
So the paged host arm can't be served on main today, on this branch or without it. #2392's row for it stays covered by the oracle's host arms and last round's served row on |
, ashhart#2464, ashhart#2375, ashhart#2634) and adds row 29, DSpine (ashhart#2633) Rebased onto main after ashhart#2760's row 28 (Scale index), which stays as on main. DSpine is row 29 with ashhart#2633's final GB10 ranges: agent 2-20 % faster, chat and code 10-19 % slower.
|
Thanks @jschmied, this round answers everything we asked. Qwen's paged BF16 stays on A few small things:
This stays behind #2215 until that lands.
|
|
@ashhart thanks.
Head |
|
Thanks @jschmied, all three are in. The body now says This is ready. It's queued to land right after #2215, and we'll write the CHANGELOG line at landing. The only conflict with main is CHANGELOG.md, which our landing resolves, so there's nothing to rebase.
|
bf16 pages keep main's pageCopies, one 2D copy a page, outside the walk and called where main calls it.
.rows (a state a pass kept on the way) walks the attention parts only, each at its kept offset; the DeltaNet pieces and the n-gram tail it passes over keep theirs.
.rows must make exactly save's attention copies at their kept offsets, paged and contiguous, and none of the conv windows, DeltaNet states or the n-gram tail.
A paged fp8 cache saves and restores each key, value and scale piece a run a page from qwen35_kv8.cu's layout, the last page's partly, with no 2D copies. The existing tests ran with paged = null.
4dca5b5 to
1d1d028
Compare
|
@ashhart rebased onto main What conflicted, each fit in the commit that brought the line:
Rerun on
The body names the new head and has the full tables. |
What this changes
This is a cleanup with no speed gain. Qwen 3.5, Gemma 4, Nemotron and Flash Next on CUDA move their kept-state copies and spills onto #2215's
core/state_walk.zig, which is on main. Each family's own loop that split live pieces at page ends is gone. No kernel, flag or allocation changes, and the copies are the same copies.1d1d02875on main328a566e2. core: one walk for kept prompt states, GLM on it (CUDA and Metal) #2215 landed, so its three commits are gone from this branch; the six below are this PR's, one per family and then two host tests:bee867925qwen35 cuda38afb5613gemma4 cuda9c43d3559nemotron cudab54b249adflashnext cudab7e311c9aflashnext cuda: a host test for the.rowswalk1d1d02875qwen35 cuda: a host test for paged fp8 kept-state copies4dca5b55don33ada77c3), each fit in the commit that brought the line:qwen3_5/cuda_reuse.zig: main's CUDA Qwen 3.5: every kept prompt state pins a new host buffer #2833 pinned spares (spares.pin,.spares,release) kept as main has them; the walk only replaces the copy loops.saveCache's newkeptargument isnullin the paged fp8 test, which also setsg.first/g.wholeto 0 as main's test geometries now do (24f980db0).gemma4/cuda_snap.zig: Python engine features to carry into the native engine #840 madeeachpublic forcuda_disk.zig's test. It stays public, now through the walk, and that test's callback takes the walk'soff: u64.zig/tests/fixtures/gradient-serving.tsv:flashnext/cuda_snap.zigis now a pinned serving source, so the Flash Next commit re-pins it (new hash,#2392added to its note), as main's PRs do.test-gradient-servingfailed without it and passes with it.git range-diff:=).core/state_walk.zigis byte-equal to core: one walk for kept prompt states, GLM on it (CUDA and Metal) #2215's.gh pr list --json files):flashnext/cuda_snap.zig: EXL3 Flash Next on CUDA: one rank, offloaded experts, sm_120 gate (1/8) #1441-EXL3 Flash Next: KV pages from the core pool (4/8) #1444, core: a bounded ladder of intermediate prompt-cache checkpoints #1953.qwen3_5/cuda_reuse.zig: qwen3_5 cuda: the 27B as a pipeline stage, logits byte-equal to the whole model #2115 and fabric stage: pipelined rounds, rank 0 sends round r + 1 while the later stages run round r (RFC #2005) #2579 (both ours).nemotron/cuda_reuse.zig: Living Weights: slide-forget counting only with --slide-forget, Metal's mask shift for wide pockets (#678) #2026.gemma4/cuda_snap.zig: none.What each family moves
cuda_reuse.zig):Runsis gone. EachLayoutpiece is a walk part. On pages,spanis the piece's length in a page andpageis the page's bytes.KeptCopy, has both of main's arms at the same offsets. It copies device-to-device for a state in device memory (Copy.dev) and device-to-host or host-to-device otherwise.pageCopies, one 2D copy a page, outside the walk. It's called insaveCacheandrestoreCachewhere main calls it (:245,:285).walkKept(:123) takes a piece count: 1 (the state) whenwholePages, else all of them.cuda_snap.zig):eachbuilds parts from the ring runs, atm.cacheLen(so the wider ring underTF_GEMMA4_CHUNK_SOLOtoo), and from the paged global rows. Kept bytes are a buffer, or offsets the hook hands tokv_prompts.Blob.cuda_reuse.zig):rowSpananddeviceRowsare gone.error.PastPagesstays as a check before the part's first copy.hostMoveis download-only (.into = true), as on main.cuda_snap.zig):movebuilds parts from the whole pieces and the paged attention rows, with one hook.parts(:98) records each part's piece inof.saveandrestorewalk every part at once (:141)..rowswalks one part at a time atbase + off(:144), andoffgrows over every part. So the partsnotRowspasses over (:129: the conv windows, the DeltaNet states and the n-gram tail) keep their kept offsets, unwritten, as main's skip did.SnapShapeis now raised before any copy.partsraises it while it builds the parts (:105,:114), beforemovequeues anything. Main'smoveraised it at the refused piece, after it had queued the earlier pieces' copies. This is the better behaviour, and it matchesrestore's doc (:188), as Nemotron'sPastPagesdoes. In the oracle, 3,336 of the 5,057 refused plans (every refused save and restore) had main queue copies first, 240,192 in all. The 1,721 refused.rowsplans had none, because.rowspasses over the pieces before the refused one. The branch queued none in any of them.finishcalls.rowsas before (:185). The hook copies live to kept forsaveandrows, as main'sway != .restoredoes.Checks on this head (
1d1d02875)zig build -Dfixed-cpu test-host(22437/22595, 156 skipped) andtest test-golden test-kernel-contract test-server-security test-pull-security fuzz-cortheon check-release-paths(2363/2392, 28 skipped) each fail onlycli_config_test's "serve --config: expand reads the file..." test, and main328a566e2fails that same test on the same machine (2 intest-host, 1 in the CI set), so it isn't this PR's. rc=0:check-native-cuda-host compile-cuda-tests,tools/pr_check.py,zig fmt --check build.zig zig,git diff --check.test-gradient-serving(1/1),test-cuda-host(7771/7814, 43 skipped, ond77435c72, the same Zig tree; rc=0 again here),test-gemma4-cuda-host,test-gemma4-shared-host,test-glm-snapshots-host(21/21).gemma4/cuda_snap.zig:212here) callseachthrough the walk and passes, and so doesgemma4/cuda_disk.zig's test ofeach's offsets.33ada77c3and328a566e2) against this head, 20,000 random plans per family, appended in a scratch worktree only. Same copies, in the same order, and the same counts and hashes as on4dca5b55d:.rows: 5,049 / 4,944 / 4,932 accepted plans; 5,057 refused alike (SnapShape): main had queued copies first in 3,336 (240,192 copies), the branch in nonea139e7b1a5e2c2f5pageCopies, eachcuMemcpy2DAsyncrecorded by every field8ef211e5c5411fb3prompt_most1024-4096)a0f7fbc73bbba100.rowscopying the tail (notRowsreturnspi < 2):ORACLE flashnextand the committed.rowshost test; without the oracle, only that host test..span = p.lenin Qwen'spartOf: only the committed paged fp8 test (without the oracle).ORACLE qwen3_5and the paged fp8 test.fwd.ringin place ofm.cacheLen(i):ORACLE gemma4, the solo-ring test and the ring test.qwen3_5/cuda_reuse.zig:453and:538:flashnext/cuda_paging_snap_test.zig:.rows(throughfinish) makes exactlysave's copies minus the conv windows, DeltaNet states and n-gram tail, at the same kept offsets, paged and contiguous.qwen3_5/cuda_reuse_paged_test.zig: a paged fp8 cache (shuffled pages, the last one partial) saves and restores each key, value and scale piece a run a page. The expected copies come fromqwen35_kv8.cu's layout, and no 2D copy is made.Receipt
328a566e2md547e2f0a0, this head's Zig tree (d77435c72, which differs from1d1d02875only in the pin line) md5778fade4. Zig builds aren't reproducible here, so an md5 names a build, not the sources.ignore_eos, 48 tokens,return_token_ids,--context 16384. A fresh run replays the same prompts with--prompt-cache-gib 0.Exactness. In every row, main and this branch match on tokens and
cached_tokenson all four turns, both match a fresh run, and every resumed turn hascached_tokens> 0.cached_tokensTF_QWEN_KV_PAGES=256,_ALL=1,--parallel 2cuMemcpy2DAsynccalls--prompt-cache-diskcuMemcpy2DAsynccallsTF_FLASHNEXT_KEEP_INPASS=0TF_FLASHNEXT_KV_PAGES=256,_ALL=1,--parallel 2TF_GEMMA4_CHUNK_SOLO=2048ProbeUnmarkedrefusal (qwen3_5 cuda: --prompt-cache-disk with TF_QWEN_KV_PAGES_ALL refuses at startup with ProbeUnmarked since e9d77ebca #2804), which Qwen 3.5 CUDA: a stream's whole prompt fill runs once (fixes #2804) #2838 fixed. Both binaries start with the disk tier on and keep on the host.nemotron/cuda_reuse.zigis byte-equal to4dca5b55d's, main didn't touch it, and its oracle gives the same 336,324 copies. Its served rows fromeda4fd4b7stand: window, paged (TF_KV_PAGES=all,--parallel 2) and the disk tier, all matching main and a fresh run.hostMoveisn't reached here. Its download arm is in the oracle and the host tests; its upload is in neither.SafeAllocatorleak of 132 bytes at shutdown, main and branch the same.eda4fd4b7was within 1 % in every cell. It isn't rerun, because the copies are the same. Concurrency: the paged rows run at--parallel 2; no other concurrency or seeded sampling row, since no sampling or scheduling code changes.Checklist