Expand description
Canonical context-size resolver (5-level fallback chain).
Extracted to gglib-core so that crates which cannot depend on
gglib-runtime (e.g. gglib-proxy) can still use the same resolution
logic for idle-model advertisements in /v1/models.
Re-exports§
pub use crate::cache_config::CacheRamSetting;
Structs§
- Server
Config Options - Caller-supplied overrides for
resolve_context_size.
Enums§
- Context
Size Source - Which rung of the context fallback chain supplied the resolved value.
- CtxSize
Arg - A parsed
--ctx-sizeCLI flag, before it is resolved against model metadata.
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_ 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§
- compute_
auto_ cache_ ram_ mb - Compute the auto
--cache-rambudget, in MiB. - parse_
ctx_ size_ flag - Parse an optional raw
--ctx-sizeflag into aCtxSizeArg. - resolve_
context_ size - Resolve context size using the 5-level fallback chain.
- resolve_
context_ size_ with_ source - Resolve context size using the 5-level fallback chain, reporting which rung won.