pub struct SpillCtx {
pub file_map: Arc<Mmap>,
pub file: Arc<File>,
pub pinned_remaining: usize,
pub n_pinned: usize,
pub n_mmap: usize,
pub mmap_bytes: usize,
}Expand description
Shared load-time spill context (SPILLING-PLAN §2 step 4). Built ONCE per model load when the
disk tier is on, then handed by &mut to each HostExps::load so all layers/projections share
ONE file mmap and draw down a single running pinned-RAM budget. Greedy in load order: pin until
pinned_remaining is exhausted, then spill every later expert to Mmap.
Fields§
§file_map: Arc<Mmap>One MAP_SHARED mmap of the whole GGUF, shared (Arc) across every spilled expert block.
file: Arc<File>The same opened inode backing file_map, retained for future positioned expert reads.
pinned_remaining: usizePinned-RAM budget still available (bytes); decremented as experts are pinned.
n_pinned: usizeDiagnostics: how many experts landed pinned vs. mmap’d, and total disk-tier bytes.
n_mmap: usize§mmap_bytes: usizeImplementations§
Source§impl SpillCtx
impl SpillCtx
Sourcepub fn open(g: &GgufFile, budget: &MemBudget) -> Result<Self, Box<dyn Error>>
pub fn open(g: &GgufFile, budget: &MemBudget) -> Result<Self, Box<dyn Error>>
Clone the parsed GGUF’s opened inode, create a MAP_SHARED mmap from it, and seed the pinned
budget from a live MemBudget probe.
The whole-map expert advice defaults to random (the historical behavior); setting
MEMRA_MOE_MMAP_ADVICE=normal restores ordinary Linux readahead. SPILLING-PLAN §1.