Repository navigation
feat(dsv41): --learn-conversations - TP2 conversation states spill to disk - #64
Open
0xWhiteMage wants to merge 2 commits into
Open
0xWhiteMage wants to merge 2 commits into
0xWhiteMage wants to merge 2 commits into
Conversation
Owner
|
Thank you @0xWhiteMage for this, and for the measurements and the clear write-up. In one line: We are checking how it should land: it builds on #56, which is still open, and its order against the other open pull requests on |
Owner
|
Thank you @0xWhiteMage. We are keeping the PR open; the merge waits on three things.
|
devin-ai-integration
Bot
force-pushed
the
feat/dsv41-learn-spill
branch
2 times, most recently
from
November 24, 2026 08:02
04efd34 to
eaf8b0a
Compare
Author
|
Done, waiting on #56! Thanks for the notes and double checks, @bertholomus! |
… disk A dsv41 snapshot is one contiguous packed prefix per rank since fix/dsv41-independent-prefix-snapshots (PR ashhart#56); this makes every kept conversation state eligible for the shared rows store's disk persistence instead of being lost on prompt-cache eviction. - families/dsv41/disk.zig: a rows.Image over the packed prefix (parts/ gather/blank/scatter/whole) plus each rank's half under ds41-<rows-key>.snap, written atomically through a .part file and verified by a header magic + payload checksum on load. - lanes.zig: Snap carries the stamped disk key (tag_disk), the follower mirrors disk persist/load/forget over the existing wire protocol, and rank 0 coordinates so both halves commit or neither does. - native.zig / native/cuda.zig: the snapshot vtable gains the rows image and tag_disk; the native host attaches rows.Rows when --learn-conversations is set. - native/cuda_refusal.zig: dsv41 leaves the Nemotron-only gate for --learn-conversations; the flag stays opt-in. - core: the snapshots vtable's tag_disk hook lets the rows writer stamp a state's disk key before the peer half is named. Design follows the GLM family's existing multi-rank learned-state persistence (per-rank halves, atomic files, peer lockstep), built on the packed-prefix snapshot substrate of PR ashhart#56. Measured on two DGX Spark GB10s over dual-rail RoCE: a ~979K-token conversation restored from disk in ~2.4 s (841 MiB read in 373 ms) where the same prompt previously paid a ~458 s full re-prefill after two intervening ~900K-token sessions evicted it.
devin-ai-integration
Bot
force-pushed
the
feat/dsv41-learn-spill
branch
from
November 24, 2026 08:12
eaf8b0a to
4e42948
Compare
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.
Summary
Gives
dsv41(DeepSeek-V4.1 TP2 lanes) support for--learn-conversations: kept conversation/prompt states spill to disk through the sharedrows.Rowsstore, on both ranks, instead of being silently lost when the GPU prompt cache evicts them.Before this change,
--learn-conversationswas refused for the dsv41 family ("Nemotron only"), and every long-context conversation state lived GPU-resident only — on a 1M-token context service, a handful of sessions evicts an earlier session's entire state, so its next turn pays a complete re-prefill.Measured on two DGX Spark GB10 nodes over the dual-rail RoCE fabric, ~1M context, 8 streams:
How it works
Since #56 a dsv41
Snapowns one contiguous packed prefix (buf) per rank — the substrate this change serializes:families/dsv41/disk.zig(new): arows.Imageover the packed prefix —parts,gather(DeviceBuffer → host),blank,scatter(host → new snapshot),whole(refuses to serialize an incomplete state). Each rank's half additionally lands underds41-<rows-key>.snap, written atomically via.part+ rename, verified by header magic/version + payload checksum on load — partial/corrupt files are rejected.lanes.zig:Snapcarries the disk key stamped by the rows writer (tag_disk); the TP2 follower mirrors disk persist/load/forget over the existing framed wire protocol, so rank 0's store and rank 1's halves commit or fail as a unit.native.zig/native/cuda.zig: the snapshot vtable gainsrows+tag_disk; the host attachesrows.Rowsto the prompt-cache store when--learn-conversationsis set.native/cuda_refusal.zig: dsv41 leaves the Nemotron-only gate. The flag remains strictly opt-in — with it unset, the resident-cache path is byte-for-byte unchanged.prompt_cache.zig,rows_write.zig,rows_read.zig): atag_diskvtable hook so the rows writer can stamp a state's disk key before the peer half's file is named.Design follows the GLM family's existing multi-rank learned-state persistence (per-rank halves, atomic writes, peer lockstep) — the same contract, applied to dsv41's lanes wire protocol.
Dependencies
Stacks on #56 (
fix/dsv41-independent-prefix-snapshots, @rhattala): the packed-prefixSnap.bufthis serializes does not exist before it. Rebased ontodeepseek-v41-zig-tp2@ea64a87with #56's commit included for CI/review; it drops out cleanly once #56 merges.Testing
--learn-conversations --learn-dir /spill --learn-gib 64read 978944 tokens from disk,cached_tokens=978944)ds41-*.snapfiles verified).snaprejection (checksum path — exercised by construction, synthetic test welcome)Credit
glm/kept.zig,glm/snapshot*.zig,lanes/learned_disk.zig)