Archived
placement: --host-weights keeps an embedding table in the pinned host pool, read in place
The embedding table is the largest model-level weight a dense model has --
248320 x 5120 in bf16 is 1.18 GiB a card at --tp 2 -- and a step reads only
its rows: M of them, a few KiB at decode. On a 16 GiB card that is VRAM the
KV cache wants, and no strategy could move it: layer_offload spills whole
layers only, and the derived split charges every model-level weight to VRAM.
--host-weights NAMES places the named weights in the pinned host pool before
any strategy runs. The site is DeviceZeroCopy: the pool is mapped, so the
lookup kernel is handed its device-side address and reads the rows over the
link in place. The unit is never movable, and every assignment pass and VRAM
total skips it through one MoveUnit::preplaced(), as they skip the mapped
tier.
- weight_footprint() counts hosted units in their own bucket, so a derived
split leaves them out of the weight budget and the KV pool gets the room
without stating --vram-*-mib
- only a weight embedding lookups alone read is accepted: a GEMM operand
(the head) would stream its shard every step, and is refused
- names are parsed at config time (comma-separated, trimmed, a trailing '*'
a prefix); each one that matches nothing is warned about by name
- a weight the host pool cannot hold is refused with the plan filled in, and
the placement report gives host weights their own line beside the pool
- GUIDE.md §4.3 and the flags table; engine info carries host_weights
Measured on Qwen3.8-27B-FP8 with its MTP head, 2x RX 9070 XT (16 GiB),
--tp 2, two sequences, a 2560-token step, the split derived:
table in VRAM --host-weights token_embd.weight
KV pool (tokens) 70,976 144,576
decode, 500 tokens 115.8 tok/s 115.7 tok/s
prefill, 22K prompt 2773 tok/s 2798 tok/s
Tests: place_test covers the footprint bucket, the pinned zero-copy
placement, the refusal of a GEMM's weight and of a pool too small; ctest
-LE 'gpu|oot' passes.
This commit is contained in:
1 parent
20d6c2119f
commit
bb4dddc424
8 files changed
+259
-13
No files matched your search
@@ -57,6 +57,9 @@ static const Flag g_flags[] = {
|
||||
{ "--vram-kv-mib", "N", "the paged KV pool; 0 derives it from the card" },
|
||||
{ "--kv-cache-dtype", "T", "bf16 | fp8 -- fp8 halves what a token of context costs" },
|
||||
{ "--host-pool-mib", "N", "pinned host tier" },
|
||||
{ "--host-weights", "NAMES", "embedding tables to keep in the pinned host pool, read in place\n"
|
||||
" over the link: comma-separated weight names, a trailing *\n"
|
||||
" matching a prefix (token_embd.weight)" },
|
||||
{ "--weights-disk-tier", nullptr, "read weights that fit neither VRAM nor the host pool from the\n"
|
||||
" container on disk (O_DIRECT); a routed expert is read a layer\n"
|
||||
" at a time, so a step is paced by the drive" },
|
||||
@@ -377,6 +380,23 @@ int config_parse(int argc, char** argv, Config* c) {
|
||||
}
|
||||
}
|
||||
else if (S("--host-pool-mib")) { if (!(v = need(i))) return RAD_E_INVAL; c->host_pool_mib = atoll(v); }
|
||||
else if (S("--host-weights")) {
|
||||
if (!(v = need(i))) return RAD_E_INVAL;
|
||||
c->host_weights.clear();
|
||||
for (std::string p : split_commas(v)) {
|
||||
p.erase(0, p.find_first_not_of(" \t"));
|
||||
p.erase(p.find_last_not_of(" \t") + 1);
|
||||
if (p.empty() || p == "*") {
|
||||
RAD_ERR("--host-weights: '%s' is not a weight name", p.c_str());
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
c->host_weights.push_back(p);
|
||||
}
|
||||
if (c->host_weights.empty()) {
|
||||
RAD_ERR("--host-weights: no weight names in '%s'", v);
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
}
|
||||
else if (S("--weights-disk-tier")) { c->weights_disk_tier = true; }
|
||||
else if (S("--prefix-cache-host-mib")) { if (!(v = need(i))) return RAD_E_INVAL; c->prefix_cache_host_mib = atoll(v); }
|
||||
else if (S("--prefix-cache-dir")) { if (!(v = need(i))) return RAD_E_INVAL; c->prefix_cache_dir = v; }
|
||||
|
||||
Reference in new issue
Block a user