Repository navigation
CUDA: every loader drops its checkpoint from the page cache after load (part of #1868) - #1884
Merged
Merged
Conversation
Release each temporary checkpoint at its existing close boundary, including separate vision, MTP and draft weights. Drop completed DeepSeek pack and prepared reads, retaining the live PLE files and mixed PLE shards. Add host checks for family cleanup scopes, release order, explicit shard lists and runtime file exclusions. GPU arithmetic and runtime readers are unchanged.
ashhart
force-pushed
the
lead/cuda-drop-load-cache
branch
from
November 2, 2026 01:57
68598da to
ee6985b
Compare
This was referenced Nov 2, 2026
Merged
8 of 9 tasks
This was referenced Nov 3, 2026
ashhart
added a commit
that referenced
this pull request
Nov 18, 2026
… checkpoint leaves the page cache On a GB10 the memory admission read /proc/meminfo alone. MemAvailable counts the page cache, which CUDA can't allocate until the kernel reclaims it: after one 60 GB checkpoint read CUDA reported 60.17 GiB free against MemAvailable's 115.85 GiB, and admission granted 103.44 GiB, 43.27 GiB above CUDA's figure (#1857). Both admission readers, poolFor and readPool (the Qwen3 embedding and reranker engine, the speech engine's limit), now take the smaller of the host figure and CUDA's free (cuda_memory.boundFree), less the same reserve. The parked share is the part of that free above MemAvailable, so its debug line stays true. Before the weights check, the CUDA open on an integrated device advises POSIX_FADV_DONTNEED on the shards core's loader opens (checkpoint.shardFiles: the weight map's files inside the model folder, else model*.safetensors) through checkpoint_cache.drop, so a checkpoint just downloaded or read is not refused for its own cached pages. Only clean cached pages go; no file's bytes change, and an index naming a file outside the folder drops nothing. After the load no second drop runs: each loader's own release (#1884) has dropped its load-only pages already and keeps the ranges it reads at run time, such as Flash Next's n-gram rows. Discrete cards and Windows keep their counts (boundFree passes them through and the drop never runs off an integrated Linux device); Metal and HIP don't reach this code. Admission sizes streams and caches only, so replies keep their tokens. The docs' unified-memory budget says the same. Host tests replay the 6 Nov figures; a GB10 device check is owed.
ashhart
added a commit
that referenced
this pull request
Nov 19, 2026
… checkpoint leaves the page cache On a GB10 the memory admission read /proc/meminfo alone. MemAvailable counts the page cache, which CUDA can't allocate until the kernel reclaims it: after one 60 GB checkpoint read CUDA reported 60.17 GiB free against MemAvailable's 115.85 GiB, and admission granted 103.44 GiB, 43.27 GiB above CUDA's figure (#1857). Both admission readers, poolFor and readPool (the Qwen3 embedding and reranker engine, the speech engine's limit), now take the smaller of the host figure and CUDA's free (cuda_memory.boundFree), less the same reserve. The parked share is the part of that free above MemAvailable, so its debug line stays true. Before the weights check, the CUDA open on an integrated device advises POSIX_FADV_DONTNEED on the shards core's loader opens (checkpoint.shardFiles: the weight map's files inside the model folder, else model*.safetensors) through checkpoint_cache.drop, so a checkpoint just downloaded or read is not refused for its own cached pages. Only clean cached pages go; no file's bytes change, and an index naming a file outside the folder drops nothing. After the load no second drop runs: each loader's own release (#1884) has dropped its load-only pages already and keeps the ranges it reads at run time, such as Flash Next's n-gram rows. Discrete cards and Windows keep their counts (boundFree passes them through and the drop never runs off an integrated Linux device); Metal and HIP don't reach this code. Admission sizes streams and caches only, so replies keep their tokens. The docs' unified-memory budget says the same. Host tests replay the 6 Nov figures; a GB10 device check is owed.
ashhart
added a commit
that referenced
this pull request
Nov 21, 2026
… checkpoint leaves the page cache On a GB10 the memory admission read /proc/meminfo alone. MemAvailable counts the page cache, which CUDA can't allocate until the kernel reclaims it: after one 60 GB checkpoint read CUDA reported 60.17 GiB free against MemAvailable's 115.85 GiB, and admission granted 103.44 GiB, 43.27 GiB above CUDA's figure (#1857). Both admission readers, poolFor and readPool (the Qwen3 embedding and reranker engine, the speech engine's limit), now take the smaller of the host figure and CUDA's free (cuda_memory.boundFree), less the same reserve. The parked share is the part of that free above MemAvailable, so its debug line stays true. Before the weights check, the CUDA open on an integrated device advises POSIX_FADV_DONTNEED on the shards core's loader opens (checkpoint.shardFiles: the weight map's files inside the model folder, else model*.safetensors) through checkpoint_cache.drop, so a checkpoint just downloaded or read is not refused for its own cached pages. Only clean cached pages go; no file's bytes change, and an index naming a file outside the folder drops nothing. After the load no second drop runs: each loader's own release (#1884) has dropped its load-only pages already and keeps the ranges it reads at run time, such as Flash Next's n-gram rows. Discrete cards and Windows keep their counts (boundFree passes them through and the drop never runs off an integrated Linux device); Metal and HIP don't reach this code. Admission sizes streams and caches only, so replies keep their tokens. The docs' unified-memory budget says the same. Host tests replay the 6 Nov figures; a GB10 device check is owed.
ashhart
added a commit
that referenced
this pull request
Nov 21, 2026
… checkpoint leaves the page cache On a GB10 the memory admission read /proc/meminfo alone. MemAvailable counts the page cache, which CUDA can't allocate until the kernel reclaims it: after one 60 GB checkpoint read CUDA reported 60.17 GiB free against MemAvailable's 115.85 GiB, and admission granted 103.44 GiB, 43.27 GiB above CUDA's figure (#1857). Both admission readers, poolFor and readPool (the Qwen3 embedding and reranker engine, the speech engine's limit), now take the smaller of the host figure and CUDA's free (cuda_memory.boundFree), less the same reserve. The parked share is the part of that free above MemAvailable, so its debug line stays true. Before the weights check, the CUDA open on an integrated device advises POSIX_FADV_DONTNEED on the shards core's loader opens (checkpoint.shardFiles: the weight map's files inside the model folder, else model*.safetensors) through checkpoint_cache.drop, so a checkpoint just downloaded or read is not refused for its own cached pages. Only clean cached pages go; no file's bytes change, and an index naming a file outside the folder drops nothing. After the load no second drop runs: each loader's own release (#1884) has dropped its load-only pages already and keeps the ranges it reads at run time, such as Flash Next's n-gram rows. Discrete cards and Windows keep their counts (boundFree passes them through and the drop never runs off an integrated Linux device); Metal and HIP don't reach this code. Admission sizes streams and caches only, so replies keep their tokens. The docs' unified-memory budget says the same. Host tests replay the 6 Nov figures; a GB10 device check is owed.
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.
Part of #1868.
1.2.1 fixed Flash Next: a loaded server left its checkpoint in the page cache, which on a GB10 is the GPU's memory too. Every other CUDA loader did the same: a served Qwen3.8-27B keeps its whole 15 GiB checkpoint cached. Each family now releases its checkpoint's pages at its existing close boundary, after the last read: drafters, MTP heads, vision towers, tensor-parallel ranks and learners included. Files read at runtime are kept: Flash Next's PLE rows, DeepSeek's Engram tables and MOSS-Image's mapping. Heap copies are skipped, so no live reader can lose bytes; nothing else changes, so tokens can't.
An independent review found it safe to land. Two gaps follow in their own PR: Qwen4 dense on CUDA, and tensor-parallel ranks on one machine that share a page cache.