kv tiers: rad_kv_group_replicated -- a group every rank holds whole is kept once a host slot

Under tensor parallelism a host slot held every rank's shard of an entry end to end, so a
group every rank holds whole (an MLA latent cache computed from a replicated projection) was
stored once a rank: on GLM-5.3-Flash at eight ranks 396.75 KiB a 4-token block for 49.59 KiB
of distinct bytes. The plugin now says which paged groups are replicated (additive export,
RAD_ABI_VERSION does not move), and the slot holds those once, in one window at its front
that rank 0 writes and every rank reads back on a restore; the sharded groups follow, one
window a rank, as before. Without the declaration nothing changes.

TierExec::slot_layout is the one place the slot arithmetic lives: bringup takes the windows
from it, and it refuses a group replicated on one rank but zero, unflagged or another width
on another. A follower moves only its own window on a copy out (nothing, when every cached
group is replicated) and both windows on a restore. The startup log names what is held once
and the tokens the tier holds either way.

RADIANCE_DEBUG_TIER_VERIFY now covers the claim: each follower gathers the replicated groups
into a pinned scratch beside the copy and hashes them once landed, and the engine, once every
rank has landed, has the leader compare its window with every follower's sum.

mem_test moves a chain through the real TierExec with a replicated and a sharded group at 1,
2 and 8 ranks, the ranks' copies differing on purpose, and checks every rank gets the leader's
bytes back; beside a zero group; the verify path alike and differing; and the layout's refusal.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
NunzeandClaude Fable 5.1 committed 2026-10-22 09:08:44 +00:00
1 parent 17d004d0d0
commit 66a1d5aa15
15 files changed
+490 -87

No files matched your search

+16
View File
@@ -1213,6 +1213,22 @@ radiance --model m.rad --prefix-cache-mib 8192 --prefix-cache-ttl 3600
- `--prefix-cache-ttl S`: seconds an unused conversation is kept (default 3600); `0` keeps it until
the memory is wanted.
**What a slot holds under tensor parallelism.** One host slot holds the whole engine's entry: each
rank's shard of every cached group, end to end, so a slot is as many entries wide as there are
ranks. A group every rank holds whole, which the architecture plugin declares with
`rad_kv_group_replicated`, is in the slot once: rank 0 writes it and every rank reads it back on a
restore. GLM-5.3-Flash declares both of its cached groups so (the MLA latent, which every rank
computes whole, and the DSA index cache, which every rank pools into), so at `--tp 8` a 4-token
block costs 49.59 KiB a slot (`kv_latent` 48.00 KiB over its 12 layers, `kv_dsa_index` 1.59 KiB)
rather than the 396.75 KiB of eight copies: 12.4 KiB a token rather than 99.2 KiB.
`--prefix-cache-mib 32768` then holds 2.7M tokens rather than 338K, and 80 GiB hold 6.8M rather
than 846K. The startup log names what is held once (`kv tiers: kv_latent, kv_dsa_index ... held
once a slot`) and the tokens the tier holds either way. The claim is the plugin's; under
`RADIANCE_DEBUG_TIER_VERIFY` every follower also hashes what it would have written and the leader
compares, logging `kv tiers: the replicated groups of ... differ between rank 0 and rank N` when
a rank holds other bytes. Sharded groups (a GQA model's K/V heads) are unaffected and still take a
window per rank.
Restoring a 200K-token turn costs a copy over PCIe; recomputing it costs minutes.
On a hybrid model the recurrent state matters as much as the attention blocks: restoring the blocks