171 in.block_count =
shape.block_count;
172 in.block_bytes =
shape.block_bytes;
173 in.non_block_bytes =
shape.non_block_bytes;
174 in.host_expert_bytes =
175 shape.expert_bytes_per_block() *
static_cast<uint64_t>(cpu_moe_layers);
202 out->
reason =
"fully resident";
224 if (
shape.expert_count <= 0 ||
shape.expert_bytes == 0) {
return false; }
236 out->
reason =
"all layers resident, experts host-side";
263 out->
reason =
"partial offload";
298 out->
reason =
"fully resident at a reduced n_ubatch";
337 out.
reason =
"GGUF shape or free VRAM unknown";
365 out.
reason =
"nothing fits, even with no layers offloaded";
long budget
Max content bytes; <= 0 = unbounded.
Activate model on GPU (WARM → ACTIVE).
constexpr uint64_t kComputeBytesAtUbatch512
Measured compute scratch for ONE context at a 512-token ubatch (vram_footprint.h: 1222 MiB,...
uint64_t compute_allowance_bytes(const FootprintInputs &base, int n_ubatch)
VRAM to hold back for graph/activation scratch.
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 int kComputeReferenceUbatch
The ubatch that figure was measured at.
bool try_smaller_ubatch(const GgufShape &shape, const FootprintInputs &base, uint64_t free_vram_bytes, int configured, AutoPlacement *out)
Try full residency at each ubatch below the configured one.
bool try_fully_resident(const GgufShape &shape, const FootprintInputs &base, uint64_t budget, AutoPlacement *out)
Try the best case: every layer and every expert on the card.
constexpr int kUbatchLadder[]
Values auto will step down through, descending.
bool try_expert_offload(const GgufShape &shape, const FootprintInputs &base, uint64_t budget, AutoPlacement *out)
Try keeping every layer resident by moving experts host-side.
bool try_fewer_layers(const GgufShape &shape, const FootprintInputs &base, uint64_t budget, AutoPlacement *out)
Last resort: take the largest layer count that fits.
AutoPlacement derive_auto_placement(const GgufShape &shape, const FootprintInputs &base, uint64_t free_vram_bytes, int n_ubatch=0)
Choose the placement that uses the card best without overcommitting.
constexpr int kDefaultUbatch
llama.cpp's default ubatch, assumed when the tier does not set one.
bool placement_fits(const FootprintInputs &base, const GgufShape &shape, int gpu_layers, int cpu_moe_layers, uint64_t budget_bytes, uint64_t *used)
Does a candidate placement fit the budget?
A placement decision, with the reason it was reached.
bool known
False = could not decide; leave config alone.
const char * reason
Why this placement, for the operator's log.
uint64_t margin_bytes
Free VRAM left over once this placement is loaded, in bytes.
int cpu_moe_layers
Layers whose experts stay host-side.
bool fully_resident
True when gpu_layers is the -1 sentinel.
int gpu_layers
Layers to offload, or -1 meaning ALL.
uint64_t bytes
Estimated resident footprint of the choice.
int n_ubatch
n_ubatch auto chose, or 0 to leave the operator's value alone.
A GGUF's shape, as far as its metadata states it.