Repository navigation
Conversation
Add fused DFlash2 Q4 Metal decode kernels (glm_dflash_kv_append, glm_dflash_qkv_prep, and glm_dflash_conv_norm) with stacked KV/QKV/ gate+up projections in metal_dflash_opt.zig, pack active batch mask rows before final norm and head projection in metal_dflash_same.zig, route draft_head ahead of target head in metal_dflash_backend.zig, and exclude prefill-only rounds from Shared.step decode timing in metal_dflash_source.zig. Refs #3152
…e next request Engine.release frees every unpaged slot's sequence, so a server's slots 1 to 3 rebuild per request: the next request allocates a window, zeroes it and fills it from the prompt. Slot 0 already keeps its sequence across requests; with TF_GLM_KEEP_SEQS=1 every slot does, as the default-off switch its name implies. The setting is read through platform/environment.zig on every rank, since release runs on each of them. A released sequence keeps its arena and its State reset by the next request's begin; nothing else is held, so an idle slot is the same bytes it held after its last release. glm-keep-seqs-check compares kept sequences against fresh ones byte for byte and step for step: greedy tokens, bf16 logits rows and the MTP head's drafts at each step. It covers a prompt shorter than the one the slot last held (6,000 tokens, then 600 and 3,000), a kept state with every byte poisoned to 0xFF, slot 0 with the switch off, and it plants a control that must differ from the fresh run, failing as planted when the comparison cannot see it.
The check joins zig/tests/cuda/main.zig's commands as glm-keep-seqs-check CKPT ID_PATH RANK WORLD, beside glm-solo-check and glm-pair-check, so compile-cuda-tests builds it and the GPU runner can dispatch it.
keepsSequence takes the engine now, so the comment says the slot keeps its sequence rather than naming a call shape the code no longer has.
Engine.init takes usize for both; the runner hands the check c_int, as the other GLM checks cast theirs. compile-cuda-tests failed on the uncast form.
The switch was read where the server builds its engine, which left any other caller of Engine.init without it: the GPU check set the variable and still saw the setting off. It is a field of ranks.Settings now, read once from the environment and passed in the engine's options, so the server and the checks agree and the ranks' agreement covers it too.
The fingerprint is compared across ranks to stop a run whose settings differ, and it lists its fields one by one, so the new setting joins it and its version is 24. The divergence test gains the field, so a rank that keeps or frees a released sequence unlike its peers stops the run.
…ep_seqs Fingerprint.Field and mismatch() list the fingerprint's fields by hand, so the new setting joins both. Without them the divergence test named a member the enum did not have.
…y field The mismatch report's switch covers every Fingerprint.Field value, so a new member needs its line or the runner does not compile.
zig/src/families/glm/cuda_env_test.zig asserts that every glm row is named in one of its lists and that the count matches, so a new flag row has to be listed or the test fails on the count.
The check compared a kept sequence against a fresh one; it never resumed. This adds the resume: a prompt state kept at 2048, a second request that resumes from it on the same kept slot, compared against a fresh run on tokens, bf16 logits rows and MTP drafts, with a control that poisons every prompt-cache byte and must make the comparison fail.
This was referenced Nov 25, 2026
Owner
Author
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.
CI for a landing train: #4258 #4809 stacked on main in that order. Nothing merges from this PR: each PR above lands on its own once this tip is green, and this PR is then closed.