Repository navigation
core: a checkpoint's pages out of the page cache once a loader is done with them - #766
Conversation
…e with them A GLM-5.3-Flash rank reads about half of the 183 GB checkpoint through the mapping, and its column cuts touch whole tensors. On GB10's unified memory the page cache holds memory the rank's device allocations need (our Python serving engine drops it with posix_fadvise for the same reason). safetensors.File.release drops a file's pages from the mapping (madvise) and the page cache (fadvise DONTNEED); Checkpoint.release does every file. The mapping stays valid and refaults on a later read, which a test checks. The GLM-5.3-Flash CUDA family (ashhart#548) calls it after each layer it loads.
73ef050 to
2ac303e
Compare
|
Rebased onto 1.0.9 ( |
|
Thank you, @Bizuayeu. Dropping a checkpoint's pages once a loader is done with them matters on a GB10's unified memory, and keeping the mapping valid, so a later read faults the bytes back, is the right shape. It ships in TensorFold 1.0.12 under your name ( On a GB10, a cold read of Nemotron 3.5 Lightning NVFP4's 52 files (21.56 GB) left 20.1 GiB cached; Posted by Ash's AI Assistant Synthena |
The contributor's commit landed above with the same code; this keeps the PR's head in the history with no change to the tree.
…and ashhart#757 onto the candidate
…date The contributor's five GLM commits landed above, with our fixes after them; the head's first seven commits are the same changes as ashhart#757, ashhart#758, ashhart#766, ashhart#762, ashhart#764 and ashhart#763, which the candidate already has from their own heads. This keeps the PR's head in the history with no change to the tree.
What this changes
A GLM-5.3-Flash rank reads about half of the 183 GB checkpoint through the mapping, and its column cuts touch whole
tensors. On GB10's unified memory the page cache holds memory the rank's device allocations need.
safetensors.File.releasedrops a file's pages from the mapping (madvise) and the page cache(
fadvise DONTNEED), andCheckpoint.releasedoes every file; the mapping stays valid and refaults on a laterread. Linux only (a no-op elsewhere). The GLM-5.3-Flash CUDA family (#548) calls it after each layer it loads.
Receipt
c36b536d) plus this change; one GB10 (DGX Spark, sm_121, CUDA 13.3).zig build test: 662 passed, 5 skipped, 0 failed; the new "after release the mapping stays readable: a laterread faults the same bytes back in" needs this change.
zig build test-cuda-host: 430 passed, 0 failed.zig fmt --check: clean.lean_check: 538, as main.cache:
mincore()could ask, butfadvise(DONTNEED)is advisory and skips dirty pages (a test's file has justbeen written), so the answer would depend on the kernel and on writeback, and the test would be flaky in CI. The
test checks what must not break instead: the mapping stays valid and a later read faults the same bytes in.
Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.