engine: release the page cache of the shards and MTP pack once more after the serve stack is open (4-5 GiB of dense tensors were left resident)
This commit is contained in:
@@ -719,6 +719,18 @@ mod runner {
|
||||
})]);
|
||||
publish_prefix_summary(&stack, shared);
|
||||
crate::load_clock::lap("serve_stack_open_total");
|
||||
// The first release (right after the expert bank was copied) cannot see what the stack open reads next: the dense tensors of shard 0 and the
|
||||
// MTP pack go through the page cache (4-5 GiB measured at idle on the 5090), and the resident copies are in the engine's own memory. Give
|
||||
// those pages back too, so that no model byte is held twice (clean pages only, POSIX_FADV_DONTNEED, never drop_caches; best effort).
|
||||
#[cfg(target_os = "linux")]
|
||||
if options.expert_source == crate::backend::ExpertSource::Resident {
|
||||
let mut files: Vec<PathBuf> = model_files.clone();
|
||||
if let Some(dir) = options.mtp_rt_directory.as_ref() {
|
||||
files.extend(["experts.bin", "dense.bin"].map(|name| dir.join(name)));
|
||||
}
|
||||
let paths: Vec<&std::path::Path> = files.iter().map(PathBuf::as_path).collect();
|
||||
crate::memory_governor::drop_file_cache(&paths);
|
||||
}
|
||||
leleka_memory::telemetry::set_settings(crate::serve_tuning::describe(&options, context_tokens, workers, None));
|
||||
// operator telemetry: GPU/RAM/CPU once a second, throughput and cache hits recorded per request
|
||||
leleka_memory::telemetry::set_context_max(u64::from(context_tokens));
|
||||
|
||||
Reference in New Issue
Block a user