Expand description
Auto-sizing math for llama-server’s host-RAM prompt cache (--cache-ram).
Extracted from server_config so the pure budget arithmetic lives
alongside the rest of the domain’s pure calculations, with its own
focused test suite.
Enums§
- Cache
RamHealth - How healthy a resolved
--cache-rambudget is, for user-facing display.
Constants§
- CACHE_
RAM_ FLOOR_ BYTES - Below this, a prompt cache holds too little to be worth the memory
pressure, so the budget collapses to
0(explicitly disabled). - CACHE_
RAM_ HEADROOM_ BYTES - RAM reserved for the OS, other applications, and llama.cpp’s own compute/scratch buffers — never handed to the prompt cache.
- CACHE_
RAM_ LOW_ WATERMARK_ BYTES - Threshold below which a working prompt cache counts as cramped.
- CACHE_
RAM_ UNKNOWN_ KV_ ALLOWANCE_ BYTES - KV allowance assumed when the model’s metadata doesn’t permit an estimate. Deliberately generous: over-reserving shrinks the cache (safe), whereas under-reserving risks memory pressure.
Functions§
- classify_
cache_ ram - Classify a resolved
--cache-rambudget. - compute_
auto_ cache_ ram_ mb - Compute the auto
--cache-rambudget, in MiB.