Repository navigation
glm: a kept state that goes stale drops its cache entry at once - #835
Conversation
A resident prompt state died (its slot's rows overwritten, or its pool blocks given up) left the Store serving the dead entry: every later lookup found it, its restore failed, and the pass prefilled the whole prompt from the start — the repeated full-refill cascade seen on live servers with long conversations. The backend now tells the prompt cache the moment a state goes stale (Slots.expire), so the Store drops that entry immediately and the next turn keeps a fresh state instead of paying for the same failure again.
|
Hello @heitke, Thank you for this. Dropping a stale GLM snap from the prompt cache is the right end state: the next lookup misses once, prefills from the start, and never serves a state whose rows are gone. Two of us read it closely, and the order of the drop needs one more pass, in three places:
One way through all three: mark snaps stale during the walk and report them to the cache after it, and never free a snap that a prefill or a pending report still holds ( Thank you again, and please push an update when you have one. |
The prefill path read a snap after pool admission could free it, and overwrite walked snaps while expiry dropped them. A resident state that dies now expires its cache entry at the host boundary; each lookup borrows its entry and snap until resumed or release ends that ownership; reclamation runs at host boundaries and skips active borrowers.
# Conflicts: # zig/src/core/prompt_cache.zig
|
Thanks, @heitke. We landed the cache guard from 8be4d32 and its 027ddea merge for 1.0.12. It fixes a use-after-free present in 1.0.11 when another admission can evict a saved prefix before its prefill reads it. Our added regression covers that deferred-admission case. The newer fb3cc20 and 8e8dc68 commits add sampled decoding, which needs a separate review. At 8e8dc68, the prompt samples its first reply token, but the one-token target head in Could you move those two sampling commits into a new PR and reset #835 to 027ddea? That lets us close this PR as merged while keeping the sampling follow-up focused on drawing every target row with its absolute position and keyed rule. |
8e8dc68 to
027ddea
Compare
|
Commits have been moved to #892. I gave up on local AI on this one. These latest actions were done by GPT 6.1 Sol. |
…ed-up state stays until its request restores it (#835)
Port the sampling follow-up from #835 (fb3cc20 and 8e8dc68), incorporating the queued-row and shared-sampler repairs from #524 (79e1004, 1e28ee6 and 0174809). Keep the cache lifetime repair separate. Arm queued and pipelined standalone target rows at their absolute output positions. Pack canonical gpu_rule values without lossy conversions, bound dispatch-run copies, and preserve local greedy vocabulary widths on peers. Include host regressions and a Mac qualification recipe.
|
Thank you, @heitke, for the cache lifetime fix and its regression coverage. Your guard ships in TensorFold 1.0.12 under your name as Ours follow: The expiry suite passes, and on an M3 Ultra a GLM-5.3-Flash state that goes stale now misses once and then resumes: a 3,794-token conversation sharing a slot resumed 3,781 tokens on its second turn after the interruption, where it prefilled in full twice, with the same reply tokens. Nemotron's CUDA replies, cached conversations and concurrent replies are unchanged. Posted by Ash's AI Assistant Synthena |
…ed-up state stays until its request restores it (ashhart#835)
…ry (ashhart#835) and GLM-5.3-Flash on CUDA (ashhart#804) onto the candidate The saved conversations' disk recall evicts through the cache's victimBut, which ashhart#835 moved into prompt_cache_policy.zig; prompt_cache.zig re-exports it, so that eviction also skips borrowed entries.
…ash images, image URLs and video (ashhart#598, ashhart#614, ashhart#618) The lane host keeps ashhart#835's report (a looked-up entry is resumed or released on every path) with the image-aware cache key; GLM's host keeps the stale-state expiry beside the image and video prepares; CHANGELOG in landing order.
ashhart#835 (@heitke) reset to 7d879fb: his two commits and public main merged in. The candidate carries the guard as re-landed (99c8944, af0fecc) with the landing work after it, so this merge changes no file: fourteen of its twenty files merge to the tip's content as they are, and the six that conflict keep the tip's text, which holds his change in the landed form (glm_expiry.zig and prompt_cache_policy.zig wrapped under 120 columns; reported()'s three cases as one condition on the cache key; the requeue teardown after the list removal, as ashhart#738's landing ordered it; victimBut public for the disk rows; engine_api's test imports in lane_host_test.zig; glm_host.zig's image offer, which his base lacks).
Port the sampling follow-up from ashhart#835 (fb3cc20 and 8e8dc68), incorporating the queued-row and shared-sampler repairs from ashhart#524 (79e1004, 1e28ee6 and 0174809). Keep the cache lifetime repair separate. Arm queued and pipelined standalone target rows at their absolute output positions. Pack canonical gpu_rule values without lossy conversions, bound dispatch-run copies, and preserve local greedy vocabulary widths on peers. Include host regressions and a Mac qualification recipe.
What this changes
Cache lifetime repair only. The branch is reset to 027ddea, exactly as requested in the maintainer review.
The maintainer reports that 8be4d32 and its 027ddea merge landed for 1.0.12, with the added deferred-admission regression. Dead saved states stop serving lookups immediately, active borrowers retain saved state through restore completion, and destruction/peer commands wait for a safe host boundary.
Sampling moved out
The later sampling commits fb3cc20 and 8e8dc68 are removed from this branch. Their feature work and the target-row/shared-sampler repairs are on heitke:glm-sampling-target-rows, with redacted one-Mac qualification results, for separate review.
Validation
The maintainer may close this PR as merged as described in the linked review.