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:
Andrew Bowen authored and StillDeadcode committed 2026-10-05 12:52:38 +02:00
1 parent 20d6c2119f
commit bb4dddc424
8 files changed
+259 -13

No files matched your search

+5
View File
@@ -616,6 +616,11 @@ struct Config {
bool weights_disk_tier = false;
std::string placement = "auto"; /* all_vram | layer_offload | expert_tiered | auto */
/* MODEL-LEVEL WEIGHTS KEPT IN THE PINNED HOST POOL by name, comma-separated (a trailing '*'
* matches a prefix). The device kernel reads them over the link in place (DeviceZeroCopy), so
* this is for a gather -- the embedding table, of which a step reads a few rows -- and not for
* a GEMM operand. Charged to --host-pool-mib; every strategy leaves them where they are. */
std::vector<std::string> host_weights;
bool deterministic = false;
int64_t checkpoint_interval = 2048; /* linear-state checkpoints (spec §7.3) */
/* HOW MANY LINEAR-STATE SNAPSHOTS THE SERVER MAY HOLD AT ONCE -- a CAP and not a charge.