Repository navigation
Flash Next on CUDA: drop the checkpoint from the page cache after load (fixes #1868) - #1880
Merged
Merged
Conversation
… load (#1868) On a GB10 the device's memory is the system's. A loaded Flash Next server kept about 36 GiB of its safetensors shards in the page cache (the last layers' shards in full) beside the weights on the device, leaving under 1 GiB free; under that pressure long prompts dropped to about 0.73x from some point in a server's life on, with the same tokens. Every shard now leaves the cache when its mapping closes, and once the weights and the MTP head are on the device every shard file's pages are dropped. Nothing reads them after load; a later read would fault the bytes back in.
This was referenced Nov 2, 2026
Closed
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.
Fixes #1868.
On a GB10 the GPU's memory is the system's. A loaded Flash Next CUDA server kept about 36 GiB of its safetensors shards in the page cache (the last layers' shards in full) beside the weights on the GPU, leaving under 1 GiB free. Under that pressure, the kernel's reclaim and compaction made long prompts drop to about 0.73x from some point in a server's life until a restart, with the same tokens. 1.2.0 does this too.
core.safetensors.File.release, which skips heap copies, so no live reader's bytes can be zeroed).dropPageCache). Nothing reads them after load; a later read would fault them back in.Measured on a GB10 with Qwen3.8-Flash-Next MLX 4-bit + MTP, one stream, 32K and 64K prompts:
Host checks: test-flashnext-cleanup-host, test-flashnext-memory-host, test-flashnext-buffer-plan-host and check-native-cuda-host pass; the light gate passes. An independent review found it safe to land. The same drop for the other CUDA loaders is a follow-up (a Qwen3.8-27B server keeps its whole 15 GiB checkpoint cached).