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

+12
View File
@@ -1246,6 +1246,18 @@ void Engine::tier_tick() {
}
if (ranks_.size() > 1) (void)rad_dev_set(lead.device);
if (all) {
/* RADIANCE_DEBUG_TIER_VERIFY: now that every rank's window has landed, each
* follower's hash of the replicated groups it gathered is held against the window
* the leader wrote (rad_kv_group_replicated's claim). The sums are taken either way,
* so a failed batch leaves none behind. */
if (lead.tierx.verifying_replicated()) {
for (size_t i = 1; i < ranks_.size(); ++i)
for (const TierJob& j : P.copy) {
uint64_t sum = 0;
if (ranks_[i]->tierx.take_replicated_sum(j.key, &sum) && good)
(void)lead.tierx.verify_replicated(j, (int)i, sum);
}
}
/* A copy is good only if every rank's shard landed; otherwise the host copy is
* partly stale, so the whole batch fails and every slot goes back. */
const std::vector<char> ok(P.copy.size(), good ? 1 : 0);