Repository navigation
server: write a continued KV checkpoint at the first chunk past each step - #1342
Open
emilianbold wants to merge 1 commit into
Open
emilianbold wants to merge 1 commit into
emilianbold wants to merge 1 commit into
Conversation
…step The continued-checkpoint listener runs only on prefill_chunk events and stored a frontier only when the live length was an exact multiple of the step. The positions it is offered are the backend's chunk boundaries, which need not include those multiples: the default graph prefill chunk is 4096 (8192 for PRO), so the 10240 step landed on every second or fourth rung, and DeepSeek V4.1 SSD streaming sweeps most of a prompt in one chunk followed by a token-major tail, so no rung was ever reachable. Store at the first chunk that enters a step bucket past the last frontier instead. This stores everywhere the exact-multiple rule did (a multiple of the step above the last frontier is always in a later bucket) and additionally at the first chunk past each boundary. Every bucket gets one frontier whatever the chunk schedule, a token-major tail does not add a frontier per token, and a cold cut inside a bucket claims it through the existing continued suppression, so no near-duplicate rung follows it. A disk hit seeds the slot's frontier, as the kvstore already does for its own counter, so resuming inside the loaded bucket does not immediately re-store it. Measured on V4 Flash with the default interval and a 32.9k-token history resent by a stateless client: frontiers at 12288, 20480 and 32768 instead of 20480 alone, and later requests prefill 135 tokens in 0.6 s instead of 12.4k.
nazerim
added a commit
to nazerim/ds4
that referenced
this pull request
Nov 17, 2026
…dence Was a 3.4 KB file in the session temp dir -- the exact failure mode DOC-ROT catalogues, since temp has already eaten two boot-recipe artifacts. Records what CONTRIBUTING.md actually demands and what is satisfied: clean build 0 warnings, ./ds4_test --server passing (the subset that covers KV disk-cache bookkeeping), make cpu building, machine/backend/quant disclosed per their reporting rule. Names the two gates still open and why they need the engine stopped: full `make test`, and the before/after ds4-bench CSVs on prefill_tps and gen_tps -- which their doc requires even for a store-path-only change, so run them rather than argue for exemption. Also states the scoping conclusion plainly: this is the only piece of today's KV work that is upstreamable. FIX 1's bug cannot exist upstream (their continued_store_target is exact-equality), FIX 2's divergence anchors are fork-only, and the retention ladder (+3,163/-206 over 45 commits, none of anchor_step/small_dense/parent_sha/children present upstream) would collide with seven open PRs including antirez#1340/antirez#1342 in the same scheduling area. Branch fix/kvstore-write-barrier (a5e9e77, +31) moved to ~/Projects/ds4-pr-kvstore-barrier to match the ds4-pr* worktree convention; nothing opened against antirez/ds4.
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.
The continued-checkpoint listener runs only on
prefill_chunkevents and stored a frontier only when the live length was an exact multiple of the step. The positions it is offered are the backend's chunk boundaries, which need not include those multiples: the default graph prefill chunk is 4096 (8192 for PRO), so the 10240 step landed on every second or fourth rung, and DeepSeek V4.1 SSD streaming sweeps most of a prompt in one chunk followed by a token-major tail, so no rung was ever reachable.Store at the first chunk that enters a step bucket past the last frontier instead. This stores everywhere the exact-multiple rule did (a multiple of the step above the last frontier is always in a later bucket) and additionally at the first chunk past each boundary. Every bucket gets one frontier whatever the chunk schedule, a token-major tail does not add a frontier per token, and a cold cut inside a bucket claims it through the existing continued suppression, so no near-duplicate rung follows it. A disk hit seeds the slot's frontier, as the kvstore already does for its own counter, so resuming inside the loaded bucket does not immediately re-store it.
Measured on V4 Flash with the default interval and a 32.9k-token history resent by a stateless client: frontiers at 12288, 20480 and 32768 instead of 20480 alone, and later requests prefill 135 tokens in 0.6 s instead of 12.4k.
This fix was inspired by the investigation into #1323 root cause.