Archived
config: --gpu-memory-mib, the inverse of --gpu-headroom-mib
N claims that many MiB of every card; headroom is the rest. The two flags cannot be combined. vLLM's utilisation fraction, written in MiB.
This commit is contained in:
1 parent
aa182fc156
commit
9cb04f62a8
10 files changed
+164
-22
No files matched your search
+18
-4
@@ -87,7 +87,10 @@ static const Flag g_flags[] = {
|
||||
{ "--rope-scaling", "SPEC", "yarn:FACTOR[:ORIG]: static YaRN over the container's own rotary\n"
|
||||
"keys, no reconvert (docs/YARN.md); none: off" },
|
||||
|
||||
{ "--gpu-headroom-mib", "N", "VRAM left unclaimed on every card (default 96)" },
|
||||
{ "--gpu-memory-mib", "N", "VRAM claimed on every card; the rest is left unclaimed.\n"
|
||||
"Not with --gpu-headroom-mib" },
|
||||
{ "--gpu-headroom-mib", "N", "VRAM left unclaimed on every card (default 96).\n"
|
||||
"Not with --gpu-memory-mib" },
|
||||
{ "--kv-cache-dtype", "T", "bf16 | fp8 | fp8_v4 | k6_v4 -- fp8 halves what a token of\n"
|
||||
"context costs; fp8_v4 keeps V in 4 bits (0.78 of fp8), k6_v4\n"
|
||||
"also K in 6 (0.69); both Qwen3.8-27B and -Flash-Next" },
|
||||
@@ -587,14 +590,15 @@ int config_parse(int argc, char** argv, Config* c) {
|
||||
* old launch lines at the flags that move the split. */
|
||||
else if (S("--vram-weights-mib") || S("--vram-kv-mib")) {
|
||||
RAD_ERR("%s was removed: the card is split between the weights and the cache from what "
|
||||
"the model needs. --gpu-headroom-mib takes card space away, --max-model-len and "
|
||||
"--max-num-seqs bound the cache, and --host-pool-mib decides which experts stay "
|
||||
"on the card", a.c_str());
|
||||
"the model needs. --gpu-headroom-mib or --gpu-memory-mib take card space away, "
|
||||
"--max-model-len and --max-num-seqs bound the cache, and --host-pool-mib "
|
||||
"decides which experts stay on the card", a.c_str());
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
/* --gpu-headroom is accepted as an alias of --gpu-headroom-mib. */
|
||||
else if (S("--gpu-headroom-mib") || S("--gpu-headroom"))
|
||||
{ if (!num(0, INT64_MAX, &c->gpu_headroom_mib)) return RAD_E_INVAL; }
|
||||
else if (S("--gpu-memory-mib")) { if (!num(1, INT64_MAX, &c->gpu_memory_mib)) return RAD_E_INVAL; }
|
||||
else if (S("--host-headroom-mib")) { if (!num(0, INT64_MAX, &c->host_headroom_mib)) return RAD_E_INVAL; }
|
||||
else if (S("--kv-cache-dtype")) {
|
||||
if (!(v = need(i))) return RAD_E_INVAL;
|
||||
@@ -1130,6 +1134,14 @@ int config_parse(int argc, char** argv, Config* c) {
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
|
||||
/* --gpu-memory-mib claims the card; --gpu-headroom-mib leaves it unclaimed. The alias
|
||||
* --gpu-headroom is recorded as --gpu-headroom-mib, so it is covered. */
|
||||
if (c->given.count("--gpu-memory-mib") && c->given.count("--gpu-headroom-mib")) {
|
||||
RAD_ERR("--gpu-memory-mib claims the card and --gpu-headroom-mib leaves it unclaimed; "
|
||||
"give one");
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
|
||||
/* Prompt lookup alone: the window is its K, stated once. */
|
||||
if (c->spec_ngram_min > c->spec_ngram_max) {
|
||||
RAD_ERR("--spec-ngram-min %d is longer than --spec-ngram-max %d", c->spec_ngram_min,
|
||||
@@ -1328,6 +1340,8 @@ const ShowRow kShow[] = {
|
||||
{ "--max-model-len", [](const Config& c) {
|
||||
return c.max_ctx ? num(c.max_ctx) : std::string("0 (the model's training context)"); } },
|
||||
{ "--rope-scaling", [](const Config& c) { return or_none(c.rope_scaling, "the checkpoint's own"); } },
|
||||
{ "--gpu-memory-mib", [](const Config& c) {
|
||||
return c.gpu_memory_mib ? num(c.gpu_memory_mib) : std::string("0 (use --gpu-headroom-mib)"); } },
|
||||
{ "--gpu-headroom-mib", [](const Config& c) { return num(c.gpu_headroom_mib); } },
|
||||
{ "--kv-cache-dtype", [](const Config& c) { return c.kv_cache_dtype; } },
|
||||
{ "--state-cache-dtype", [](const Config& c) { return c.state_cache_dtype; } },
|
||||
|
||||
@@ -4133,10 +4133,16 @@ int Engine::start() {
|
||||
: fmt("%s --gpu-headroom-mib", humanb(want).c_str());
|
||||
if (room < allowance) {
|
||||
const int64_t raise_mib = (allowance - room + MiB - 1) / MiB;
|
||||
const int64_t need_head = std::max<int64_t>(cfg_.gpu_headroom_mib, 0) + raise_mib;
|
||||
const std::string fix = cfg_.gpu_memory_mib > 0
|
||||
? fmt("Set --gpu-memory-mib to at most %lld: what is left here falls with it one "
|
||||
"for one.",
|
||||
(long long)(props.vram_bytes / MiB - need_head))
|
||||
: fmt("Set --gpu-headroom-mib to at least %lld: what is left here rises with it "
|
||||
"one for one.", (long long)need_head);
|
||||
RAD_WARN("card %d settled at %s free against %s, which leaves %s for a kernel's first "
|
||||
"launch to load its code object and size its scratch in -- under the %s this "
|
||||
"engine allows for its own. %s Set --gpu-headroom-mib to at least %lld: what "
|
||||
"is left here rises with it one for one.",
|
||||
"engine allows for its own. %s %s",
|
||||
r->device, humanb(got).c_str(), asked.c_str(),
|
||||
humanb(std::max<int64_t>(room, 0)).c_str(), humanb(allowance).c_str(),
|
||||
got < want
|
||||
@@ -4144,7 +4150,7 @@ int Engine::start() {
|
||||
"another process on it or an allocation the budget does not "
|
||||
"count.", humanb(want - got).c_str()).c_str()
|
||||
: "",
|
||||
(long long)(std::max<int64_t>(cfg_.gpu_headroom_mib, 0) + raise_mib));
|
||||
fix.c_str());
|
||||
} else if (got < want) {
|
||||
RAD_INFO("card %d settled at %s free against %s: %s of the headroom was taken after "
|
||||
"the budget read the card, by another process on it or an allocation the "
|
||||
|
||||
+4
-4
@@ -524,8 +524,8 @@ int KVManager::carve_into(Pool& kv_pool) {
|
||||
" vram_kv %10s\n"
|
||||
" short by %10s\n"
|
||||
"Lower --max-num-seqs, or give the cache more of the card: a smaller "
|
||||
"--gpu-headroom-mib or a larger --host-pool-mib. The engine will not shrink one of "
|
||||
"them for you (spec §6).",
|
||||
"--gpu-headroom-mib, a larger --gpu-memory-mib, or a larger --host-pool-mib. The "
|
||||
"engine will not shrink one of them for you (spec §6).",
|
||||
humanb(fixed).c_str(), (long long)max_seqs_, humanb(budget_bytes).c_str(),
|
||||
humanb(fixed - budget_bytes + 1).c_str());
|
||||
return RAD_E_NOMEM;
|
||||
@@ -554,8 +554,8 @@ int KVManager::carve_into(Pool& kv_pool) {
|
||||
}
|
||||
if (p.n_blocks <= 0) {
|
||||
RAD_ERR("KV group '%s': a %s KV pool leaves 0 blocks (%s a page) after the fixed "
|
||||
"linear/conv costs of %s. Raise --host-pool-mib or lower --gpu-headroom-mib, or "
|
||||
"lower --max-num-seqs.",
|
||||
"linear/conv costs of %s. Raise --host-pool-mib or --gpu-memory-mib, or lower "
|
||||
"--gpu-headroom-mib or --max-num-seqs.",
|
||||
p.name.c_str(), humanb(budget_bytes).c_str(),
|
||||
humanb(p.bytes_per_block).c_str(), humanb(fixed).c_str());
|
||||
return RAD_E_NOMEM;
|
||||
|
||||
@@ -76,6 +76,21 @@ static int resolve(Config& cfg, const std::vector<VramFacts>& per_rank, VramBudg
|
||||
if (f.unified) b.host_pinned = std::max(b.host_pinned, f.host_pinned);
|
||||
}
|
||||
if (!b.unified) b.host_pinned = 0;
|
||||
/* --gpu-memory-mib is the inverse of --gpu-headroom-mib: N + headroom = the card, in MiB.
|
||||
* Convert once the smallest rank capacity is known. A device that reports no capacity has
|
||||
* nothing to claim, so the flag does not apply. */
|
||||
if (b.capacity > 0 && cfg.gpu_memory_mib > 0) {
|
||||
const int64_t cap_mib = b.capacity / kMiB;
|
||||
if (cfg.gpu_memory_mib > cap_mib) {
|
||||
b.report = fmt("--gpu-memory-mib %lld is above this card's %lld MiB",
|
||||
(long long)cfg.gpu_memory_mib, (long long)cap_mib);
|
||||
if (log) RAD_ERR("%s", b.report.c_str());
|
||||
if (out) *out = b;
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
cfg.gpu_headroom_mib = cap_mib - cfg.gpu_memory_mib;
|
||||
cfg.given["--gpu-headroom-mib"] = "derived from --gpu-memory-mib";
|
||||
}
|
||||
b.headroom = std::max<int64_t>(cfg.gpu_headroom_mib, 0) * kMiB;
|
||||
int64_t host_reserve = 0;
|
||||
for (const VramFacts& f : per_rank) host_reserve = std::max(host_reserve, f.host_reserve);
|
||||
@@ -116,6 +131,11 @@ static int resolve(Config& cfg, const std::vector<VramFacts>& per_rank, VramBudg
|
||||
b.queues + b.prefetch + b.host_pinned);
|
||||
|
||||
if (b.claimable < 0) {
|
||||
const char* how = cfg.gpu_memory_mib > 0
|
||||
? "Raise --gpu-memory-mib, lower --max-num-batched-tokens (the arena scales with it), "
|
||||
"or free the card.\n"
|
||||
: "Lower --gpu-headroom-mib, lower --max-num-batched-tokens (the arena scales with it), "
|
||||
"or free the card.\n";
|
||||
b.report = fmt(
|
||||
"VRAM does not cover the fixed costs before a single pool is sized:\n"
|
||||
" card total %10s\n"
|
||||
@@ -128,12 +148,11 @@ static int resolve(Config& cfg, const std::vector<VramFacts>& per_rank, VramBudg
|
||||
" expert prefetch %10s (its ring of expert units and buffers)\n"
|
||||
" ------------------------------\n"
|
||||
" short by %10s\n"
|
||||
"Lower --gpu-headroom-mib, lower --max-num-batched-tokens (the arena scales with it), "
|
||||
"or free the card.\n",
|
||||
"%s",
|
||||
humanb(b.capacity).c_str(), humanb(b.already_held).c_str(), humanb(b.drift).c_str(),
|
||||
humanb(b.headroom).c_str(), humanb(b.arena).c_str(), humanb(b.staging).c_str(),
|
||||
humanb(b.queues).c_str(), b.n_queues, humanb(b.queue_bytes).c_str(),
|
||||
humanb(b.prefetch).c_str(), humanb(-b.claimable).c_str());
|
||||
humanb(b.prefetch).c_str(), humanb(-b.claimable).c_str(), how);
|
||||
if (log) RAD_ERR("%s", b.report.c_str());
|
||||
if (out) *out = b;
|
||||
return RAD_E_NOMEM;
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
* loaded code. The only observed term, printed on its own line so a
|
||||
* desktop on the card shows up there instead of shrinking a pool.
|
||||
* --gpu-headroom-mib what the operator leaves alone (default 96 MiB).
|
||||
* --gpu-memory-mib the inverse: claim this much of the card; headroom is the rest.
|
||||
* Not with --gpu-headroom-mib.
|
||||
* arena activation arena plus scratch, from arena_plan_bytes() on the buffer
|
||||
* plan, the same call that later allocates it.
|
||||
*
|
||||
@@ -32,9 +34,9 @@
|
||||
* KVManager::ceiling; the experts at the whole plane) and one side's excess goes to the other.
|
||||
*
|
||||
* No flag states a pool size: unbudgeted VRAM is unusable, and on a model whose experts do not
|
||||
* fit every unbudgeted GiB costs decode time. Operators move the inputs instead: --gpu-headroom-mib,
|
||||
* --max-model-len and --max-num-seqs (cache bound), --host-pool-mib (which experts must stay on
|
||||
* the card).
|
||||
* fit every unbudgeted GiB costs decode time. Operators move the inputs instead: --gpu-headroom-mib
|
||||
* or --gpu-memory-mib, --max-model-len and --max-num-seqs (cache bound), --host-pool-mib (which
|
||||
* experts must stay on the card).
|
||||
*
|
||||
* The host backend uses half the machine's memory as its capacity (host_vram_bytes) and splits it
|
||||
* like a card; its weights pool holds what a host kernel cannot read where the container stores it
|
||||
|
||||
@@ -859,6 +859,9 @@ struct Config {
|
||||
int64_t vram_weights_mib = 0;
|
||||
int64_t vram_kv_mib = 0;
|
||||
int64_t gpu_headroom_mib = 96; /* --gpu-headroom-mib, left unclaimed on every card */
|
||||
/* --gpu-memory-mib: claim this much of every card; 0 uses gpu_headroom_mib. Inverse of
|
||||
* headroom: N + headroom = the card, in MiB. Not with --gpu-headroom-mib. */
|
||||
int64_t gpu_memory_mib = 0;
|
||||
/* --kv-cache-dtype bf16|fp8|fp8_v4|k6_v4. fp8 is an E4M3 cache with per-(sequence, head)
|
||||
* descales; it halves the per-token cost, most of the KV pool at production context. fp8_v4
|
||||
* keeps K as E4M3 and V as int4 in groups of 32, k6_v4 also K as int6 (RadBuildCtx::kv_quant),
|
||||
|
||||
+8
-4
@@ -709,7 +709,8 @@ radiance --model m.rad --debug-placement # the placement plan only
|
||||
|
||||
The card is split into resident weights and the paged KV pool. The engine derives the split from the
|
||||
card and the model; no flag states either pool. Its inputs: `--gpu-headroom-mib` leaves card space
|
||||
alone, `--max-model-len` and `--max-num-seqs` bound the cache, and `--host-pool-mib` decides which
|
||||
alone, `--gpu-memory-mib` claims a size (headroom is the card less that; give one of the two),
|
||||
`--max-model-len` and `--max-num-seqs` bound the cache, and `--host-pool-mib` decides which
|
||||
experts must stay on the card. The startup receipt prints every term. With no visible card (the host
|
||||
backend) half of RAM stands in for the card and is split the same way; the weights pool is then host
|
||||
memory, holding the weights a host kernel cannot read where the container stores them.
|
||||
@@ -785,6 +786,7 @@ Related flags:
|
||||
|
||||
```sh
|
||||
--gpu-headroom-mib 96 # VRAM left unclaimed on every card
|
||||
# --gpu-memory-mib 28000 # the same knob as a claim; not with --gpu-headroom-mib
|
||||
--kv-cache-dtype fp8 # halve what a token of context costs (a real quantisation)
|
||||
--host-pool-mib 8192 # pinned host tier for weights
|
||||
--embedding-placement vram # keep the token embedding on the card (below)
|
||||
@@ -885,9 +887,10 @@ plane grows into what it releases, so a model whose experts do not fit never str
|
||||
for unused cache.
|
||||
|
||||
**Headroom.** `--gpu-headroom-mib` is kept for allocations the engine does not make, chiefly a
|
||||
kernel's code object, which HIP loads at the kernel's first launch. With too little left, the first
|
||||
kernel that has never run (a draft head's, a sampler chain's) fails its load and faults inside the
|
||||
HIP runtime: a segfault in a correct kernel on a server that had been serving.
|
||||
kernel's code object, which HIP loads at the kernel's first launch. `--gpu-memory-mib N` is the same
|
||||
knob written as a claim: headroom is the card less N. The two flags cannot be combined. With too
|
||||
little left, the first kernel that has never run (a draft head's, a sampler chain's) fails its load
|
||||
and faults inside the HIP runtime: a segfault in a correct kernel on a server that had been serving.
|
||||
|
||||
Once everything is allocated, startup logs `card N settled at ... free`. Memory taken after the budget
|
||||
read the card (another process such as a desktop, or a driver allocation) comes out of the headroom,
|
||||
@@ -2058,6 +2061,7 @@ by 0.002-0.003 nats.
|
||||
| flag | default | |
|
||||
|---|---|---|
|
||||
| `--gpu-headroom-mib N` | 96 | VRAM left unclaimed on every card |
|
||||
| `--gpu-memory-mib N` | 0 (use `--gpu-headroom-mib`) | VRAM claimed on every card; inverse of `--gpu-headroom-mib`. Give one (§4.3) |
|
||||
| `--kv-cache-dtype T` | bf16 | `bf16`, `fp8`, or on Qwen3.8-27B and Qwen3.8-Flash-Next `fp8_v4` or `k6_v4` (§4.4) |
|
||||
| `--state-cache-dtype T` | f32 | `f32` or `f16`: the recurrent (delta-net) state cache; f16 halves the state memory and is lossy, `qwen35` plugins only (§4.4) |
|
||||
| `--attn-prefill-fp8 MODE` | off | `off`, `qk`, `pv` or `both`: the prefill attention's Q·Kᵀ, P·V or both in E4M3 over an `fp8`, `fp8_v4` or `k6_v4` cache; lossy, Qwen3.8-27B (§4.4) |
|
||||
|
||||
@@ -935,12 +935,15 @@ utilisation fraction:
|
||||
| flag | |
|
||||
|---|---|
|
||||
| `--gpu-headroom-mib` | VRAM left unclaimed on every card (default 96) |
|
||||
| `--gpu-memory-mib` | VRAM claimed on every card; inverse of `--gpu-headroom-mib` (headroom is the card less N). The two cannot be combined |
|
||||
| `--host-pool-mib` | the pinned host tier |
|
||||
| `--host-headroom-mib` | host RAM left free for the system at startup (default 4096); a snapshot store's floor takes back the shortfall from it, down to 1 GiB |
|
||||
| `--weights-disk-tier` | the file tier for weights, read from the container; needs `O_DIRECT` |
|
||||
| `--max-model-len`, `--max-num-seqs` | the KV cache's bound |
|
||||
| `--kv-resident` | stream the sparse attention group's KV from pinned host memory, keeping a ring of N tokens on the card; off by default. Raised to 32 768 and to one decode step's selection; a ring that covers the context streams nothing; ignored with a warning on an architecture that cannot stream (docs/KV-STREAMING.md) |
|
||||
|
||||
`--gpu-memory-mib N` is the same input as `--gpu-headroom-mib` written as a claim. Give one.
|
||||
|
||||
Nothing is inferred from the free VRAM at startup, which would size pools differently depending on
|
||||
what else is open. Each term is a fixed property, a computed quantity, or a measurement printed on
|
||||
its own line (`core/mem/vram_budget.h`). The startup report lists them in the order spent (sizes
|
||||
|
||||
+22
-1
@@ -507,7 +507,8 @@ const std::map<std::string, std::vector<std::string>>& legal_values() {
|
||||
{ "--preempt-wait-ms", { "5000" } },
|
||||
{ "--max-num-seqs", { "4" } },
|
||||
{ "--max-model-len", { "4096" } }, { "--rope-scaling", { "yarn:4" } },
|
||||
{ "--gpu-headroom-mib", { "128" } }, { "--kv-cache-dtype", { "fp8" } },
|
||||
{ "--gpu-memory-mib", { "16384" } }, { "--gpu-headroom-mib", { "128" } },
|
||||
{ "--kv-cache-dtype", { "fp8" } },
|
||||
{ "--state-cache-dtype", { "f16" } }, { "--attn-prefill-fp8", { "both" } },
|
||||
{ "--kv-resident", { "65536" } },
|
||||
{ "--host-pool-mib", { "1024" } }, { "--host-headroom-mib", { "2048" } },
|
||||
@@ -1387,6 +1388,26 @@ TEST(gpu_headroom_parses_under_both_spellings) {
|
||||
CHECK_EQ(d.gpu_headroom_mib, 96ll);
|
||||
}
|
||||
|
||||
/* --gpu-memory-mib is the inverse of --gpu-headroom-mib; they cannot be combined. The default
|
||||
* headroom is not "given", so memory alone is legal and leaves the default until the resolver. */
|
||||
TEST(gpu_memory_mib_parses_and_excludes_headroom) {
|
||||
Config a;
|
||||
CHECK_EQ(parse({ "--gpu-memory-mib", "28000" }, &a), RAD_OK);
|
||||
CHECK_EQ(a.gpu_memory_mib, 28000ll);
|
||||
CHECK_EQ(a.gpu_headroom_mib, 96ll);
|
||||
CHECK(a.given.count("--gpu-memory-mib"));
|
||||
CHECK(!a.given.count("--gpu-headroom-mib"));
|
||||
|
||||
Config z;
|
||||
CHECK_EQ(parse({ "--gpu-memory-mib", "0" }, &z), RAD_E_INVAL);
|
||||
CHECK_EQ(parse({ "--gpu-memory-mib", "-1" }, &z), RAD_E_INVAL);
|
||||
CHECK_EQ(parse({ "--gpu-memory-mib", "8x" }, &z), RAD_E_INVAL);
|
||||
|
||||
Config b, c;
|
||||
CHECK_EQ(parse({ "--gpu-memory-mib", "28000", "--gpu-headroom-mib", "96" }, &b), RAD_E_INVAL);
|
||||
CHECK_EQ(parse({ "--gpu-memory-mib", "28000", "--gpu-headroom", "96" }, &c), RAD_E_INVAL);
|
||||
}
|
||||
|
||||
TEST(the_kernel_hierarchy_is_separated_by_commas_or_colons_and_ordered) {
|
||||
Config c;
|
||||
CHECK_EQ(parse({ "--kernels", "libr4d.so,libref.so" }, &c), RAD_OK);
|
||||
|
||||
@@ -7273,6 +7273,76 @@ TEST(the_prefill_stage_is_two_layers_of_what_the_card_leaves_off) {
|
||||
}
|
||||
}
|
||||
|
||||
/* --gpu-memory-mib N is --gpu-headroom-mib (card - N): the same split, the same pools. Over the
|
||||
* card is a named refuse, and the trial still writes nothing. */
|
||||
TEST(gpu_memory_mib_is_the_inverse_of_gpu_headroom_mib) {
|
||||
constexpr int64_t MiB = 1 << 20;
|
||||
constexpr int64_t cap_mib = 16384;
|
||||
{
|
||||
Config via_head = derive_config();
|
||||
via_head.gpu_headroom_mib = 256;
|
||||
Config via_mem = derive_config();
|
||||
via_mem.gpu_memory_mib = cap_mib - 256;
|
||||
VramBudget bh, bm;
|
||||
int rc_h = 0, rc_m = 0;
|
||||
stderr_of([&] {
|
||||
rc_h = vram_budget_resolve(via_head, { hand_facts(false) }, &bh);
|
||||
rc_m = vram_budget_resolve(via_mem, { hand_facts(false) }, &bm);
|
||||
});
|
||||
CHECK_OK(rc_h);
|
||||
CHECK_OK(rc_m);
|
||||
CHECK_EQ(bh.headroom, bm.headroom);
|
||||
CHECK_EQ(bh.claimable, bm.claimable);
|
||||
CHECK_EQ(via_head.vram_weights_mib, via_mem.vram_weights_mib);
|
||||
CHECK_EQ(via_head.vram_kv_mib, via_mem.vram_kv_mib);
|
||||
CHECK_EQ(via_mem.gpu_headroom_mib, 256ll);
|
||||
CHECK_EQ(via_mem.given["--gpu-headroom-mib"], std::string("derived from --gpu-memory-mib"));
|
||||
}
|
||||
{
|
||||
Config c = derive_config();
|
||||
c.gpu_memory_mib = cap_mib; /* headroom 0 */
|
||||
VramBudget b;
|
||||
int rc = 0;
|
||||
stderr_of([&] { rc = vram_budget_resolve(c, { hand_facts(false) }, &b); });
|
||||
CHECK_OK(rc);
|
||||
CHECK_EQ(c.gpu_headroom_mib, 0ll);
|
||||
CHECK_EQ(b.headroom, 0ll);
|
||||
CHECK_EQ(b.claimable, (15096 + 96) * MiB);
|
||||
}
|
||||
{
|
||||
Config c = derive_config();
|
||||
c.gpu_memory_mib = cap_mib + 1;
|
||||
VramBudget b;
|
||||
int rc = 0;
|
||||
stderr_of([&] { rc = vram_budget_resolve(c, { hand_facts(false) }, &b); });
|
||||
CHECK_EQ(rc, RAD_E_INVAL);
|
||||
CHECK(has(b.report, "--gpu-memory-mib"));
|
||||
CHECK_EQ(c.gpu_headroom_mib, 96ll); /* not rewritten on refuse */
|
||||
}
|
||||
{
|
||||
Config c = derive_config();
|
||||
c.gpu_memory_mib = cap_mib - 256;
|
||||
const Config before = c;
|
||||
VramBudget t;
|
||||
CHECK_OK(vram_budget_trial(c, { hand_facts(false) }, &t));
|
||||
CHECK_EQ(c.gpu_headroom_mib, before.gpu_headroom_mib);
|
||||
CHECK_EQ(c.vram_weights_mib, before.vram_weights_mib);
|
||||
CHECK_EQ(c.vram_kv_mib, before.vram_kv_mib);
|
||||
CHECK_EQ(t.headroom, 256 * MiB);
|
||||
}
|
||||
/* A device with no capacity has nothing to claim: the flag is ignored. */
|
||||
{
|
||||
Config c = derive_config();
|
||||
c.gpu_memory_mib = 4096;
|
||||
VramFacts f{};
|
||||
f.kv_ceiling = 300LL << 20;
|
||||
VramBudget b;
|
||||
CHECK_OK(vram_budget_resolve(c, { f }, &b));
|
||||
CHECK_EQ(c.gpu_headroom_mib, 96ll);
|
||||
CHECK_EQ(c.vram_kv_mib, 300ll);
|
||||
}
|
||||
}
|
||||
|
||||
/* Over random cards and programs the split either refuses by name or hands out no more than the
|
||||
* card: every granted pool plus every fixed term fits the capacity, with at most the MiB each of
|
||||
* the two pools may round into the headroom. The shares add up to the elastic part, the static
|
||||
|
||||
Reference in new issue
Block a user