Repository navigation
flashnext cuda: the mixed PLE shard and the nested shards leave the page cache after load - #3467
Conversation
|
Thanks @jschmied. The mixed shard keeps its n-gram ranges, and the index sweep reaches nested shards while excluding live aliases. The receipt correctly separates reclaimed file cache from unchanged GPU allocation. We will run the device check on our side for Flash Next's NVIDIA checkpoint, checking retained n-gram pages, exact replies and load/decode timing. The required zig, zig-windows, pytest and fmt jobs must also be green at the final head before landing.
|
|
@ashhart Thanks. On the required jobs:
Could you approve the workflows at this head? |
|
@jschmied, the device checks are done on a GB10 with Flash Next NVFP4, at fe9b4fc's tree (your last push only re-pinned the two load files). Replies are exact (0 of 20 prompt rows differ across runs) and cold-prompt speed is level from 2k to 64k. One cell looked slower in the balanced run: 8 streams, greedy, the same chat prompt on every stream (median 153.7 to 142.5 tok/s). That shape runs identical replies in lockstep and swings with how they line up, so we reran just that cell with a different prompt on each stream, four runs an arm: greedy goes from 73.0 to 73.0 tok/s and sampled from 72.9 to 71.7, with the runs overlapping. The other 8-stream cells were level or faster, so there's no slowdown to fix. CI is green and it's queued; if #3456 lands first,
|
|
Thanks @jschmied. We re-checked this head against current main. The four source files it touches are unchanged on main since your base. The two rows you re-pinned in The final sweep now walks the index's shard list, the index
|
…age cache after load Shard 15 of the NVFP4 checkpoint holds the n-gram table beside 3.27 GiB of load-only tensors (embedding, HC, MTP, vision); the runtimePages guard skipped its release whole, and the final sweep listed only top-level *.safetensors while this checkpoint keeps its shards under tensors/. Now a shard drops everything but the n-gram tensors' pages (releaseExcept), and the sweep walks the index's shards (core.checkpoint.shardFiles).
fe9b4fc to
c85ad8f
Compare
|
Thank you @jschmied. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
Head: fe9b4fc (two commits on origin/main 41a72fd: the change dbb5625 and its gradient-serving pin rows).
After a Flash Next CUDA load (NVIDIA's NVFP4 export, shards under
tensors/), about 3 GiB of checkpoint pages stay in the page cache for as long as the server runs. They are only freed under pressure. The cause is shard 15, which holds the n-gram table (1.26 GiB) beside 3.27 GiB of load-only tensors (embedding 1.18 GiB, HC, MTP layer, vision).runtimePagesskipped the release of the whole shard. The final sweep (cache.directory) listed only top-level*.safetensors, so for this checkpoint it advised nothing.Change
flashnext/cuda_prompt_wt.zig,cuda_lanes_load.zig):Shard.drop, which calls core'sreleaseExcept), in all three places that released before: close,release,use.core.checkpoint.shardFiles), so nested shards are reached. Files the n-gram table holds open are still skipped by inode.core/checkpoint_cache.zig):directory(io, dir, keep)becomesshards(io, paths, keep), which walks the paths it is given. Flash Next is its only caller.files,dropandvisit, which the other families use, are unchanged.releaseExceptandshardFilesare existing core code, not new.zig/cuda_checkpoint_cache_host.zig): it now pins the new call text.Replies keep their tokens. Only page-cache advice changes: the mapping is read-only, a dropped page refaults from the file, and no bytes change.
Planted control
zig/src/core/checkpoint_cache.zig:88. Its fixture has nestedtensors/shards, a held PLE file and a symlink alias. It expects 2 files advised, and the held file and the alias are never advised.expected 2, found 0.test-cuda-load-cache-host22/22.Served, GB10, A-B-B-A (
TENSORFOLD_MEMORY_RESERVE_GIB=16, default flags; page cache dropped before every start)model 72.76 GiB; 3 streams at once, 7.86 GiB each at a 262144-token window ... loaded in 44.8s.CI (x86,
-Dfixed-cpu test test-golden test-kernel-contract test-server-security test-pull-security fuzz-cortheon check-release-paths,check-native-cuda-host compile-cuda-tests,tools/pr_check.py,zig fmt --check):cli_config_test"serve --config: expand reads the file...". That test fails the same way on origin/main 41a72fd on the same runner.Proposed CHANGELOG line (for you to place):
- Flash Next on CUDA: after load, the checkpoint's mixed n-gram shard keeps only the n-gram table in the page cache, and the final sweep reaches shards nested under tensors/ (about 3 GiB of page cache freed on the NVFP4 export).