Expand description
GPU memory auto-tuning for the KV pool.
Reads model config + on-disk weight file sizes + nvidia-smi reported
GPU total, then sets FERRUM_KV_MAX_BLOCKS so the KV pool fits inside
total_mem * gpu_memory_utilization after weights and a scratch reserve.
Mirrors vLLM’s gpu_memory_utilization knob (default 0.9).
Skipped when:
- nvidia-smi missing (Mac / CPU-only): keep static defaults.
config.jsonnot parseable: keep static defaults.- User explicitly set
FERRUM_KV_MAX_BLOCKS: respect their override.
Structs§
Enums§
- Auto
Size Profile - CLI usage profile: which presets the autosizer should consider.
Functions§
- apply_
auto_ size - 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), andFERRUM_KV_CAPACITY(per-sequence logical table stride). The model allocates the GPU KV pool fromKV_MAX_BLOCKS;PAGED_MAX_SEQS * KV_CAPACITYno longer reserves physical KV blocks up front. - apply_
auto_ size_ with_ profile - Apply auto-sizing with explicit usage profile. The chat profile flips priority — long context per seq beats wide batch — because the CLI REPL only ever has one active sequence and multi-turn dialogues blow past the default 512-token cap fast.
- auto_
size_ kv_ blocks - Compute target
FERRUM_KV_MAX_BLOCKSfromgpu_memory_utilization. - auto_
size_ kv_ blocks_ with_ pool_ copies