Skip to main content

apply_auto_size

Function apply_auto_size 

Source
pub fn apply_auto_size(model_dir: &Path, gpu_util: f32)
Expand description

Apply auto-sizing: read CLI flag, query nvidia-smi, set env vars. Sets FERRUM_KV_MAX_BLOCKS (global physical paged-KV block budget), FERRUM_PAGED_MAX_SEQS (scheduler/model concurrency shape), and FERRUM_KV_CAPACITY (per-sequence logical table stride). The model allocates the GPU KV pool from KV_MAX_BLOCKS; PAGED_MAX_SEQS * KV_CAPACITY no longer reserves physical KV blocks up front.

Idempotent — caller invokes once per CLI invocation before engine init. Respects user overrides (no clobber if env already set).

Defaults to AutoSizeProfile::Server. Use apply_auto_size_with_profile for chat (ferrum run) — it picks longer per-seq context.