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

+15
View File
@@ -468,9 +468,23 @@ Related flags:
--gpu-headroom-mib 96 # VRAM left unclaimed on every card
--kv-cache-dtype fp8 # halve what a token of context costs (a real quantisation)
--host-pool-mib 8192 # pinned host tier for weights
--host-weights token_embd.weight # the embedding table off the card (below)
--weights-disk-tier # stream what fits neither from the container; needs O_DIRECT
```
**`--host-weights` takes the embedding table off the card.** It 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. Named here, it is placed in the pinned host pool before any
strategy runs and the lookup kernel reads it over the link in place, so it costs no VRAM and the
KV pool gets its share. On Qwen3.8-27B at two 16 GiB cards decode and prefill measured within noise
of the table on the card, against ~73K more tokens of context. The pool must hold it
(`--host-pool-mib`, every rank its own shard), a derived split leaves it out of the weight budget,
and a name any other op reads -- a head, a GEMM operand -- is refused: it would stream every step.
```sh
radiance --model m.rad --tp 2 --host-pool-mib 1280 --host-weights token_embd.weight
```
**A model larger than the card and the host pool together still serves with
`--weights-disk-tier`** -- and every step is then paced by the drive, which is the trade the flag
names. A routed expert that fits neither VRAM nor the pinned pool lives in the container and
@@ -850,6 +864,7 @@ one line naming each one the command line moved.
| `--vram-kv-mib N` | derive | the paged KV pool |
| `--kv-cache-dtype T` | bf16 | `bf16` or `fp8` |
| `--host-pool-mib N` | 0 | pinned host tier (weights) |
| `--host-weights NAMES` | none | embedding tables kept in the pinned host pool and read in place over the link (comma-separated, a trailing `*` matches a prefix); charged to `--host-pool-mib`, and only a weight embedding lookups alone read is accepted. See §4.3 |
| `--weights-disk-tier` | off | read weights that fit neither VRAM nor the host pool from the container (O_DIRECT); routed experts a layer at a time |
**Idle session tiers**