Archived
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:
1 parent
17d004d0d0
commit
66a1d5aa15
15 files changed
+490
-87
No files matched your search
@@ -928,10 +928,38 @@ int Builder::kv_group_zero(rad_kvgroup h) {
|
||||
prog_.kv_groups[h].name.c_str());
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
if (prog_.kv_groups[h].replicated) {
|
||||
err(RAD_E_INVAL, "kv group '%s': kv_group_zero on a group declared replicated; a "
|
||||
"replicated group is held whole on every rank", prog_.kv_groups[h].name.c_str());
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
prog_.kv_groups[h].zero = true;
|
||||
return RAD_OK;
|
||||
}
|
||||
|
||||
int Builder::kv_group_replicated(rad_kvgroup h) {
|
||||
if (finished_) {
|
||||
err(RAD_E_STATE, "kv_group_replicated after declare finished");
|
||||
return RAD_E_STATE;
|
||||
}
|
||||
if (h == 0 || h >= prog_.kv_groups.size()) return RAD_E_INVAL;
|
||||
/* Paged groups only: the tiers move blocks. A linear or conv group's state travels in the
|
||||
* checkpoint store, which has no such window. */
|
||||
const int kind = prog_.kv_groups[h].decl.kind;
|
||||
if (kind != RAD_KV_FULL && kind != RAD_KV_WINDOW) {
|
||||
err(RAD_E_INVAL, "kv group '%s': kv_group_replicated on a group that is not paged",
|
||||
prog_.kv_groups[h].name.c_str());
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
if (prog_.kv_groups[h].zero) {
|
||||
err(RAD_E_INVAL, "kv group '%s': kv_group_replicated on a group declared zero; a zero "
|
||||
"rank holds none of it", prog_.kv_groups[h].name.c_str());
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
prog_.kv_groups[h].replicated = true;
|
||||
return RAD_OK;
|
||||
}
|
||||
|
||||
/* ================================================================== name map */
|
||||
int Builder::decl_name_map(const RadNameMap* m) {
|
||||
if (finished_) { err(RAD_E_STATE, "decl_name_map after declare finished"); return RAD_E_STATE; }
|
||||
@@ -2319,6 +2347,11 @@ int rad_kv_group_zero(RadBuilder* b, rad_kvgroup g) {
|
||||
return B(b)->kv_group_zero(g);
|
||||
}
|
||||
|
||||
int rad_kv_group_replicated(RadBuilder* b, rad_kvgroup g) {
|
||||
if (!b) return RAD_E_INVAL;
|
||||
return B(b)->kv_group_replicated(g);
|
||||
}
|
||||
|
||||
int rad_decl_name_map(RadBuilder* b, const RadNameMap* m) {
|
||||
if (!b) return RAD_E_INVAL;
|
||||
return B(b)->decl_name_map(m);
|
||||
|
||||
Reference in new issue
Block a user