Repository navigation
GLM CUDA: keep completed shared-cache prefixes on prefill cancellation - #4694
Merged
ashhart merged 2 commits intoNov 24, 2026
Merged
Conversation
ashhart
force-pushed
the
codex/glm-cuda-keep-cancelled-prefix
branch
from
November 24, 2026 00:01
9d10158 to
de23d07
Compare
ashhart
force-pushed
the
codex/glm-cuda-keep-cancelled-prefix
branch
from
November 24, 2026 03:22
de23d07 to
4c4a78b
Compare
Owner
|
Thank you @MaverickKB. 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. |
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
When a client cancels a GLM CUDA request between prefill chunks, the lane can return before saving the last completed chunk. In shared-cache mode the family owns the checkpoint callback, so the stream's generic reuse hook can legitimately be empty. A retry then reads the same prefix again.
Resolve the callback through the lane's existing cache selection and keep the interruption callback available even when there are no scheduled checkpoints left. The existing completed-row guard still applies. The regression sends cancellation through the public backend callback, retries with a fresh stream, and checks both the restored position and the saved model state.
95ae4081770ff36fc83d16a5be7d166bdee005fa. Independent commit9d101580e78a1f8536fe75128aeead6b3cad57fc.atc overlap --jsonon Nov 23 at 01:13 UTC reported zero overlaps and reached its search limits. I checked the changed files of all 399 open PRs separately. Eight touched one or more of these files (Vulkan: a dispatch records a barrier only when it conflicts with an earlier one, 2% to 20% less run time on an M1 and an M1 Max with the same logits (stacked on #2017) #2038, GLM-5.3-Flash CUDA: shared rounds draft MTP for every stream at once #2856, GLM on CUDA: kept states, carries and prompt twins under the latent split (TF_GLM_KV_SPLIT, #1431 part 4; stacked on #2937) #2938, tp ranks: every byte after the key proof crosses the bootstrap, fate and plan links in sealed records #3101, glm cuda: warm turns under TF_GLM_REQUEST_STARTS=1, every message start a cut, DFlash2's ring kept alike on every rank (#3109) #3147, glm cuda: TF_GLM_COPY_SHARE=1 lets shared rounds' copies take the lone ramp, to a stream's share of the rows #3333, reports: draft model KV cache size and dtype #4538, glm cuda dflash2: opt-in measured window prices and cost-derived width #4573). Their diffs leave the cancellation dispatch and empty-mark handling addressed here in place.Checks on this head
zig build -j1 test-glm-image-cache-host --summary allpassed three existing tests and failed both new tests. Changing only the dispatch condition on v1.3.4 fixed the first case but still failed the second.zig build -j2 test-glm-image-cache-host test-glm-prompts-host --summary allpassed all 13 tests. The fixture uses the real shared radix store, lane and interruption callback, with host doubles for CUDA copies and rank communication.zig fmt --checkon the three changed files andgit diff --checkpassed.python3 tools/zig/lean_check.pyreported 165 findings on both base and head, with byte-identical reports.Serving evidence and limits
On two GB10 GPUs running a GLM-5.3-Flash EXL3 release-based deployment, retrying a 21,273-token request after cancellation restored zero tokens before the fix and 10,240 completed tokens with the fix. Both retries returned the expected answer. This is corroborating deployment evidence. The controlled base-versus-head comparison is the host test above.
The change reaches the GLM CUDA lane. It adds no switch, allocation policy, decode branch or kernel. The full GPU qualification suite, other chips and token-level drafted/plain and concurrent/solo equivalence were not run on this exact main-based head. The PR makes no claim about uninterrupted decode speed.