Repository navigation
qwen3_5 CUDA: page-aligned prefix saves and opt-in device snapshots - #4473
Merged
Merged
Conversation
ashhart
force-pushed
the
lead/q35-prefix-snapshot-gpu
branch
3 times, most recently
from
November 24, 2026 02:47
198eec9 to
44237d9
Compare
This was referenced Nov 24, 2026
Round shared-prefix save marks to the page grid and make those marks real cold-pass cuts, including solo passes. Fresh and resumed prompts now stop at the same page edges without requiring the page size to divide the compute grid.
TF_QWEN_KV_SNAPSHOT_GPU=1 keeps the radix store's bounded recurrent snapshots in device memory and restores them D2D. Device allocation failure selects the existing pinned-host path before copying; failed copies drain or quarantine before release. The fake device now transfers real bytes so host tests compare fresh, resumed and rebuilt state and inject allocation, copy and wait failures.
ashhart
force-pushed
the
lead/q35-prefix-snapshot-gpu
branch
from
November 24, 2026 12:49
44237d9 to
da4a05a
Compare
ashhart
added a commit
that referenced
this pull request
Nov 24, 2026
ashhart
added a commit
that referenced
this pull request
Nov 24, 2026
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
Two commits on the Qwen3.5 CUDA prefix cache:
Pages.layout.page_tokens) and intersected with the cold-prompt cuts, so a resumed prompt restores whole pages andTF_QWEN_KV_PAGESno longer has to divide the compute grid.TF_QWEN_KV_SNAPSHOT_GPU=1, prefix snapshots stay in device memory and restore by device-to-device copy instead of round-tripping through pinned host memory. Unset keeps today's host snapshots. A failed device allocation falls back to the host path. The switch is documented indocs/environment.md.Checks
zig fmt --check,zig ast-check, the 600-line cap and the lean count (unchanged) pass, as docheck-native-cuda-hostandcompile-cuda-testsfor Linux.Still to run
The GPU gate: fresh servers per arm, cache-agent traces (
agent_loops,agent_cohorts) at 512, 4K and 129K prefix tokens with the switch off and on, plus a one-stream decode control. Kill on any token or state difference, any decode regression, or under 3% repeated-turn TTFT gain.