152 static const std::pair<const char*, double>
kScales[] = {
163 for (
const auto& entry :
kScales) {
164 if (type == entry.first) {
165 scale = entry.second;
188 }
else if (gpu_layers == 0) {
229 est.reason =
"partial offload: layer count is not knowable without "
230 "GGUF metadata, so the budget gate stays open";
237 resident =
in.weights_bytes +
in.mmproj_bytes;
249 resident -= std::min(resident,
in.host_expert_bytes);
252 resident +=
in.draft_bytes;
253 const int ctx =
in.context_length > 0 ?
in.context_length : 0;
254 const int sessions =
in.max_sessions > 0 ?
in.max_sessions : 1;
262 static_cast<double>(
ctx) *
static_cast<double>(
sessions)
265 est.bytes = resident +
kv
266 +
static_cast<uint64_t>(
in.vram_reserve_mb) * 1024ull * 1024ull;
296 const int sessions =
in.max_sessions > 0 ?
in.max_sessions : 1;
306 return static_cast<int>(
chosen);
Activate model on GPU (WARM → ACTIVE).
FootprintEstimate estimate_vram_footprint(const FootprintInputs &in)
Estimate the VRAM a tier will occupy, or report that it cannot.
@ optional
optional: every escape asks the host's path approver
constexpr uint64_t kBaseKvPerTokenF16
KV bytes per token at f16, the rate the v2.2.4 estimate assumed.
constexpr int kAllLayersSentinel
gpu_layers at or above this means "every layer" (llama.cpp's 99).
double kv_scale_for_cache_type(const std::string &type)
Cost of a KV cache type relative to f16.
Offload classify_offload(int gpu_layers)
Classify a tier's offload request into a priceable placement.
@ none
Child tools share the session's working dir (default)
double kv_bytes_per_token(const FootprintInputs &in)
Per-token KV cost in bytes for this tier's cache configuration.
int recommend_context_length(const FootprintInputs &in, uint64_t available_bytes)
Largest context length that fits, for the "won't fit" recommendation.
Offload
Where a tier's weights land, as far as the estimate can tell.
@ none
gpu_layers == 0: weights cost no VRAM.
@ partial_unknown
A layer count we cannot price without GGUF metadata.
@ full
-1 or >= 99: the whole file is resident.