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

+1
View File
@@ -228,6 +228,7 @@ int KVManager::plan_groups(const std::vector<KVGroupInfo>& groups, const Config&
p.bytes_per_block = 0;
p.bytes_per_state = 0;
}
p.replicated = g.replicated && p.paged() && !g.zero;
plans_.push_back(std::move(p));
}
bundling_ = compare_bundling(bundles);
+4
View File
@@ -73,6 +73,10 @@ struct KVGroupPlan {
* block count (one block table serves every rank); its costs are zero and nothing is carved.
* No op on this rank names it (issue refuses a group with no pool bound). */
bool zero = false;
/* rad_kv_group_replicated: every rank holds the same bytes, so a tier slot carries this
* group once, in a window at its front that rank 0 writes and every rank reads
* (TierExec::slot_layout). The pool is carved as for any group. */
bool replicated = false;
int64_t n_states = 0; /* LINEAR/CONV: n_seq_states * state_copies */
/* Physical slots per logical state: 1, or 2 under speculation. A verify runs 1 + n_spec
* tokens through the recurrence before acceptance is known; libr4d keeps the committed state
+3 -1
View File
@@ -96,7 +96,9 @@ class IdleTiers {
public:
struct Config {
int64_t host_cap_bytes = 0; /* 0 is off */
int64_t entry_bytes = 0; /* one entry: sum over cached groups of bytes_per_block */
/* One host slot: every cached group's bytes_per_block, under tensor parallelism every
* rank's own shard end to end and a replicated group once (TierExec::SlotLayout). */
int64_t entry_bytes = 0;
/* ---- the linear half ----
* `ckpt_bytes` is one snapshot including every rank's shard, like `entry_bytes`. The
* snapshots live in the engine's checkpoint store, `ckpt_slots` deep; reported here, not