Repository navigation
persisted states bind to the resolved profile values - #2207
Merged
Merged
Conversation
ashhart
force-pushed
the
lead/profile-disk-identity
branch
from
November 5, 2026 03:59
035a9da to
5d80fce
Compare
Hash every applicable non-identical profile entry at the native disk identity boundary, with environment-first defaults and framed canonical values. Ignore identical and out-of-scope rows. Bind generic CUDA to its registered family and distinguish dense and routed Qwen on Metal. Use the same helper from CUDA and all four Metal persistence owners. Changing a relevant setting creates a fresh namespace while unset and explicit-zero booleans retain the same key. Preserve state bytes and matching rules, with no new runtime option or inference arithmetic change. A recording-driver regression reaches actual CUDA identityOf, then proves a same-key reopen hit and changed-key persisted-index miss. It uses an explicit fake arithmetic row because main registers none yet. Add scope, class, all-entry and resolved-default controls plus actual host consumer compilation, and document the remaining persistence audit gaps separately. Refs #2131.
ashhart
force-pushed
the
lead/profile-disk-identity
branch
from
November 5, 2026 06:45
5d80fce to
a928650
Compare
kelchm
pushed a commit
to kelchm/TensorFold
that referenced
this pull request
Nov 7, 2026
…te on disk (ashhart#1411) A backport of ashhart#1411 (head d903d85, on main a757420) to this stack (f350cd3 + 0001-0108). With --learn-conversations, GLM-5.3-Flash's kept prompt states go to the rows store on disk, every rank's part, so a conversation resumes from disk after its RAM copy is evicted or the server restarts. Off by default and unchanged when the flag is unset. - cuda_disk_image: a kept state's disk image on one rank: the words (format, position, head rows, ring bases, KDA copy bits), the KDA prefix, each DSA layer's latent rows, scales and pooled keys by position, the rings and pools in progress, the head's caches at a whole verify window, then the tail. Copies run a page of the lease at a time: 0015's device pages, then its pinned host pages. - cuda_disk_ranks + cuda_follow's disk step: rank 0's engine thread leases, fills, reads and seals each rank's copy through the follow link. The store's image is rank 0's image followed by each other rank's prefix; the rest is the same bytes on every rank, checked at start by the identity probe. - cuda_snapshots: blankAs/seal. A disk read's blank state is refused by restore until its seal checks the words (head rows within the verify window, ring bases that hold the state's rows, copy bits). - native: the disk store attaches for GLM; --spill-gib and --checkpoint-slots are refused for GLM, as --learn-conversations alone keeps its states. - rows: a pool that reuses spare storage reads a disk state into it; a trimming pool stays within its budget. On this stack: - The lease is 0015's two tiers. A host page copies with a memcpy, a device page with cuMemcpyDtoH/HtoD. - Beside DFlash2 a kept state's head holds no rows, and the image carries no drafter ring. A state read from disk restores with DFlash2 restarted at the mark, as TF_GLM_SNAP_DRAFTER=0 does for a RAM state. - Not carried over from upstream: TF_GLM_KV_SHARE's refusal (no such switch here) and ashhart#2207's identity profile. - Tests take window_rows 16 (0039) and index_ring 8,192 (0094), and the round trip runs on a device-only pool and on one whose lease runs onto host pages. Original commits by Robert Wojciechowski (GitHub @wojo, X @rwojo) in ashhart#1411. Origin: MiaAI-Lab/GLM-5.3-Flash-DGX-Sparks-1104@13f2464 patches/engine 0109-glm-cuda-learn-conversations-keeps-every-rank-s-part.patch sha256:35a316d41dcec7590f89c6128e51286a5653d60865ce54ea3b256aa5379371d2
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.
fix(cache): bind persisted states to resolved profile values
Refs #2131. Native CUDA and the four Metal persistence owners share a helper that hashes every applicable arithmetic, experimental or debug profile entry. Environment values override entry defaults; booleans/counts are canonicalized, so an unset boolean and explicit 0 keep the same identity. Identical and out-of-scope entries contribute nothing. Generic CUDA uses its registered family name, and Qwen Metal distinguishes dense and routed configurations.
The failing-before recording-driver test reaches the actual CUDA identity: unset and 1 incorrectly share a key. After the fix they differ, unset=0, the same-key persisted-index reopen hits and the changed-key reopen misses. Main has no arithmetic row, so the test deliberately supplies a fake Entry; this does not qualify TF_QWEN_REQUEST_STARTS or another real arithmetic switch. Scope/default/all-entry controls and actual CUDA/Metal consumer compilation are included.
The audit table is docs/recipes/persisted-profile-keys.md. Remaining complete executable/cubin/checkpoint/variant bindings belong to the separate #2163 follow-up; this commit closes the registered-profile omission. The first long prompt under a changed relevant setting prefills again. No kernel, state bytes, admission or serving default changes.
Host checks pass, with no new lean findings. Resume-versus-fresh on a real device and speed are unchecked: no GPU or model ran.