Archived
radiance 1.0.8
- Qwen3.8-Flash-Next serves at --tp 4, contributed by goodman-b (PR 9). Rank pairs share each of the model's two KV heads, every rank computes a slice of every expert's width, and four ranks run the unfused all-reduce plus a new four-rank all-gather for the vocab-parallel sampler. Two ranks declare and compute exactly as before. The README has a four-rank flag row; it pins --host-pool-mib on every card, 48 GiB in all. At four ranks the expert shares are not equal: ranks 0 and 1 compute three blocks of every even/odd pair of experts and ranks 2 and 3 two (docs/ARCHITECTURES.md). - The four- and eight-rank all-gathers require peer access between the cards, as every other collective does since 1.0.7, and the kernel library's selftest now refuses any multi-rank kernel that does not.
This commit is contained in:
1 parent
146318894d
commit
140987fa7b
13 files changed
+86
-63
No files matched your search
+1
-1
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.21)
|
|||||||
# VERSION is what /version reports and what a client checks compatibility against. It is NOT the
|
# VERSION is what /version reports and what a client checks compatibility against. It is NOT the
|
||||||
# ABI version -- that lives in abi/rad_abi.h and is read out of the header below, because
|
# ABI version -- that lives in abi/rad_abi.h and is read out of the header below, because
|
||||||
# a plugin contract and a server release do not move together.
|
# a plugin contract and a server release do not move together.
|
||||||
project(radiance VERSION 1.0.7 LANGUAGES C CXX)
|
project(radiance VERSION 1.0.8 LANGUAGES C CXX)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
radiance
|
radiance
|
||||||
Copyright 2026 Deadcode and the radiance contributors
|
Copyright 2026 Deadcode and the radiance contributors
|
||||||
|
|
||||||
Written by Deadcode, with contributions from tcclaviger (the N-rank all-reduce kernels) and ggz14
|
Written by Deadcode, with contributions from tcclaviger (the N-rank all-reduce kernels), ggz14
|
||||||
(the MXFP4 GEMM and the GDN kernels' overflow guards).
|
(the MXFP4 GEMM and the GDN kernels' overflow guards) and goodman-b (four-rank tensor parallelism
|
||||||
|
for Qwen3.8-Flash-Next).
|
||||||
|
|
||||||
This product includes software from the following projects, each under the MIT License. The
|
This product includes software from the following projects, each under the MIT License. The
|
||||||
license text is in the file named beside each.
|
license text is in the file named beside each.
|
||||||
|
|||||||
@@ -94,15 +94,18 @@ sequence holds its own recurrent state and 32 of them leave the attention cache
|
|||||||
keeps the 200K request and costs single-stream decode about 15%) and the 27B in bf16. See
|
keeps the 200K request and costs single-stream decode about 15%) and the 27B in bf16. See
|
||||||
[`docs/GUIDE.md`](docs/GUIDE.md) §4.4.
|
[`docs/GUIDE.md`](docs/GUIDE.md) §4.4.
|
||||||
|
|
||||||
`--tp 4` runs the unfused all-reduce chain, so it is slower per step than `--tp 2` on the same
|
`--tp 4` runs the unfused all-reduce chain, because the fused forms are two-rank, and it takes no
|
||||||
cards (unmeasured) — it is a capacity configuration, not a speed one, and it takes no `--tp-wire`:
|
`--tp-wire`: `wht6` is a two-rank wire and four ranks run the exact one. It is a capacity
|
||||||
`wht6` is a two-rank wire and four ranks run the exact one. The tiering flags above are the tp2
|
configuration; its per-step rate against `--tp 2` on the same cards has not been measured. The
|
||||||
recipe carried over; above two ranks each rank still owns a **slice of every expert's width** —
|
tiering flags are the tp2 recipe carried over. Above two ranks each rank still owns a **slice of
|
||||||
each parity's 128-column blocks are cut contiguously over the ranks and the odd block alternates
|
every expert's width** — each parity's 128-column blocks are cut contiguously over the ranks and the
|
||||||
with the parity, so every rank's share is whole blocks and every block has exactly one owner —
|
odd block alternates with the parity, so every rank's share is whole blocks and every block has
|
||||||
and the resident expert bytes per rank are smaller, so the elastic window is a
|
exactly one owner — and the resident expert bytes per rank are smaller, so the elastic window is a
|
||||||
different shape: read the boot log's `elastic` line and re-derive `--expert-vs-cache-ratio`
|
different shape: read the boot log's `elastic` line and re-derive `--expert-vs-cache-ratio` and
|
||||||
and `--host-pool-mib` before trusting them.
|
`--host-pool-mib` before trusting them. **`--host-pool-mib` is pinned on every card**, so the row
|
||||||
|
above pins 4 × 12 GiB = 48 GiB, and the amdgpu driver caps pinned memory at `ttm.pages_limit`, half
|
||||||
|
of RAM by default: that row needs 96 GiB of RAM or a raised limit
|
||||||
|
([`docs/GUIDE.md`](docs/GUIDE.md) §7).
|
||||||
|
|
||||||
Add `--api-key KEY` to require `Authorization: Bearer KEY`. Add `--debug-graph` to print every op
|
Add `--api-key KEY` to require `Authorization: Bearer KEY`. Add `--debug-graph` to print every op
|
||||||
and the kernel it resolved to, then exit without serving. Then:
|
and the kernel it resolved to, then exit without serving. Then:
|
||||||
|
|||||||
@@ -782,8 +782,8 @@ inline int geom_from(Geom& g, const RadModelMeta* m, const RadBuildCtx* c,
|
|||||||
* replaces (Flash-Next: 2 KV heads x 5120 x 256 rows read twice instead of once). What it buys
|
* replaces (Flash-Next: 2 KV heads x 5120 x 256 rows read twice instead of once). What it buys
|
||||||
* is that world 4 is declarable at all.
|
* is that world 4 is declarable at all.
|
||||||
*
|
*
|
||||||
* When world <= n_head_kv_all the split below is untouched: TP2 stays byte-identical, the
|
* When world <= n_head_kv_all the split below is untouched, so a world that divides the KV
|
||||||
* geometry paro is served on cannot regress. */
|
* heads -- TP2 on this family -- declares exactly as it did before replication existed. */
|
||||||
if (g.world > g.n_head_kv_all) {
|
if (g.world > g.n_head_kv_all) {
|
||||||
if (g.world % g.n_head_kv_all != 0) {
|
if (g.world % g.n_head_kv_all != 0) {
|
||||||
fprintf(stderr, "radiance: world_size = %d cannot replicate n_head_kv = %lld; "
|
fprintf(stderr, "radiance: world_size = %d cannot replicate n_head_kv = %lld; "
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ inline int AttnGatedBF16::declare(RadBuilder* b, Names& nm, const Geom& geom, in
|
|||||||
return RAD_E_INVAL;
|
return RAD_E_INVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* KV-HEAD REPLICATION IS NOT PLUMBLED HERE. `geom_from` answers a world size above the KV head
|
/* KV-HEAD REPLICATION IS NOT PLUMBED HERE. `geom_from` answers a world size above the KV head
|
||||||
* count by giving every rank ONE kv head and a `kv_off` row span into a projection that stays
|
* count by giving every rank ONE kv head and a `kv_off` row span into a projection that stays
|
||||||
* `n_head_kv_all * head_dim` rows in the container -- and this block declares its k and v with
|
* `n_head_kv_all * head_dim` rows in the container -- and this block declares its k and v with
|
||||||
* the plain even row-shard, which at four ranks would hand a rank half of one KV head. The
|
* the plain even row-shard, which at four ranks would hand a rank half of one KV head. The
|
||||||
|
|||||||
@@ -1075,8 +1075,8 @@ inline int MoeFP8::declare(RadBuilder* b, Names& nm, const Geom& geom, int l,
|
|||||||
* tiles, which four ranks take as 3, 3, 2, 2. Every tile has exactly one owner, each
|
* tiles, which four ranks take as 3, 3, 2, 2. Every tile has exactly one owner, each
|
||||||
* rank writes its own columns of gate/up and reads its own of down, and the block's
|
* rank writes its own columns of gate/up and reads its own of down, and the block's
|
||||||
* all-reduce sums the partials exactly as it does for the quantised experts and for
|
* all-reduce sums the partials exactly as it does for the quantised experts and for
|
||||||
* the shared arm. The even case keeps the old declaration verbatim -- no span at all --
|
* the shared arm. The even case keeps the even-split declaration verbatim -- no span
|
||||||
* so a rank count that divides stays byte-identical to the tree this fork started on. */
|
* at all -- so a rank count that divides declares exactly as it did before. */
|
||||||
psh_row = RAD_SHARD_ROW;
|
psh_row = RAD_SHARD_ROW;
|
||||||
psh_col = RAD_SHARD_COL;
|
psh_col = RAD_SHARD_COL;
|
||||||
pparts = 2;
|
pparts = 2;
|
||||||
|
|||||||
@@ -479,31 +479,33 @@ static int declare(RadBuilder* b, const RadModelMeta* meta, const RadBuildCtx* c
|
|||||||
g.w_bf16 = mc.expert_bf16 != 0;
|
g.w_bf16 = mc.expert_bf16 != 0;
|
||||||
/* ...and the connections in front of the blocks emit no codes, since nothing reads any. */
|
/* ...and the connections in front of the blocks emit no codes, since nothing reads any. */
|
||||||
m.hccfg.quant = g.w_bf16 ? 0 : 1;
|
m.hccfg.quant = g.w_bf16 ? 0 : 1;
|
||||||
/* ================= THE RANKS EITHER SLICE EVERY EXPERT, OR OWN WHOLE ONES =================
|
/* ============================== EVERY RANK HOLDS A SLICE OF EVERY EXPERT ==============================
|
||||||
*
|
*
|
||||||
* An expert of this model is 640 columns, five 128-column blocks -- the fp8 scale block,
|
* An expert of this model is 640 columns, five 128-column blocks -- the fp8 scale block,
|
||||||
* the 4-bit plane's scale group and the rotation's width all at once -- so two ranks
|
* the 4-bit plane's scale group and the rotation's width all at once -- so two ranks
|
||||||
* cannot halve one.
|
* cannot halve one.
|
||||||
*
|
*
|
||||||
* AT TWO RANKS EVERY EXPERT IS SLICED BY PARITY: each rank takes three blocks of the
|
* THE SPLIT IS BY PARITY: each parity's five blocks are cut contiguously over the ranks,
|
||||||
* experts of one parity and two of the other's -- rank r's slice of expert e is the first
|
* and the rank that takes the extra block alternates with the expert's parity
|
||||||
* three blocks when e % 2 == r and the last two otherwise (MoeFP8::Config::ff_lo says why
|
* (MoeFP8::Config::ff_lo says why by parity). At two ranks, rank r's slice of expert e is
|
||||||
* by parity). The router stays replicated, every rank computes its slice of every routed
|
* the first three blocks when e % 2 == r and the last two otherwise. The router stays
|
||||||
* expert, and the block's all-reduce sums the partials.
|
* replicated, every rank computes its slice of every routed expert, and the block's
|
||||||
|
* all-reduce sums the partials.
|
||||||
*
|
*
|
||||||
* ABOVE TWO RANKS THE RANKS OWN WHOLE EXPERTS: rank r owns [r*E/W, (r+1)*E/W). A width
|
* AT FOUR RANKS THE SHARES ARE NOT EQUAL. Parity gives the extra block only two places to
|
||||||
* that divides into whole blocks at the rank count is still split evenly and has one
|
* go, so ranks 0 and 1 compute three blocks of every even/odd pair of experts and ranks 2
|
||||||
* slice, but five blocks cannot be cut into four even whole-block slices, and the parity
|
* and 3 compute two, and the all-reduce has ranks 2 and 3 wait for the other two. Equal
|
||||||
* trick is by construction a two-rank rule. So the block's all-reduce sums whole-expert
|
* shares need the extra block rotated over four places -- the expert's number mod 4, four
|
||||||
* partials instead.
|
* slice tables where moe_gemm_q takes two.
|
||||||
*
|
*
|
||||||
* THE TRADE IS ROUTING BALANCE FOR A WORKING TP4. The bytes a rank reads are the same on
|
* WHY NOT EXPERT PARALLELISM, which splits the EXPERTS: rank r owns [r*E/W, (r+1)*E/W)
|
||||||
* average either way, but which rank a routed expert lands on is a coin flip, and a verify
|
* whole. The bytes a rank reads are the same on average either way, but which rank a
|
||||||
* step's forty routed slots leave one rank about five experts ahead -- which the all-reduce
|
* routed expert lands on is a coin flip, and a verify step's forty routed slots leave one
|
||||||
* turns into the other ranks waiting, about a millisecond a step at one sequence. Split by
|
* rank about five experts ahead -- which the all-reduce turns into the other ranks waiting,
|
||||||
* parity the ranks differ by a fifth of an expert per unit of the even/odd difference
|
* about a millisecond a step at one sequence. Split by parity the ranks differ by a fifth
|
||||||
* instead. This is correctness-first v1: the follow-up is a 4-way block split, an
|
* of an expert per unit of the even/odd difference instead. Whole experts would also break
|
||||||
* ff_lo[4]/ff_hi[4] generalising the parity tables, which keeps that balance at four.
|
* the protected experts' pairing: the recipe protects them in pairs so each rank's count of
|
||||||
|
* quantised experts stays even, which the two parity tables need.
|
||||||
*
|
*
|
||||||
* A CALIBRATION RUN SPLITS THE EXPERTS INSTEAD, whole experts per rank. The down
|
* A CALIBRATION RUN SPLITS THE EXPERTS INSTEAD, whole experts per rank. The down
|
||||||
* projection's Hessian is over an expert's whole K, and a rank holding a slice of each
|
* projection's Hessian is over an expert's whole K, and a rank holding a slice of each
|
||||||
@@ -522,21 +524,9 @@ static int declare(RadBuilder* b, const RadModelMeta* meta, const RadBuildCtx* c
|
|||||||
mc.n_ff_exp = g.n_ff_all;
|
mc.n_ff_exp = g.n_ff_all;
|
||||||
mc.n_expert = per;
|
mc.n_expert = per;
|
||||||
mc.expert_base = (int64_t)g.rank * per;
|
mc.expert_base = (int64_t)g.rank * per;
|
||||||
/* WHY this run owns whole experts: whichever of the three reasons applies. The parity
|
|
||||||
* case says so by the block count, because that is the number that refuses the split. */
|
|
||||||
char why[192];
|
|
||||||
if (mc.calib)
|
|
||||||
snprintf(why, sizeof why,
|
|
||||||
"calibration (each expert's Hessian is over its whole width)");
|
|
||||||
else if (mc.expert_bf16)
|
|
||||||
snprintf(why, sizeof why, "bf16 experts");
|
|
||||||
else
|
|
||||||
snprintf(why, sizeof why,
|
|
||||||
"%lld blocks of %d split %d ways are not whole blocks, so the ranks own "
|
|
||||||
"whole experts", (long long)(g.n_ff_all / RAD_FP8_BLOCK),
|
|
||||||
RAD_FP8_BLOCK, g.world);
|
|
||||||
rad_note(b, "%s: rank %d owns experts [%lld, %lld) of %lld whole.",
|
rad_note(b, "%s: rank %d owns experts [%lld, %lld) of %lld whole.",
|
||||||
why, g.rank,
|
mc.calib ? "calibration (each expert's Hessian is over its whole width)"
|
||||||
|
: "bf16 experts", g.rank,
|
||||||
(long long)mc.expert_base, (long long)(mc.expert_base + mc.n_expert),
|
(long long)mc.expert_base, (long long)(mc.expert_base + mc.n_expert),
|
||||||
(long long)mc.n_expert_all);
|
(long long)mc.n_expert_all);
|
||||||
} else if (g.world > 1) {
|
} else if (g.world > 1) {
|
||||||
|
|||||||
+14
-7
@@ -299,14 +299,20 @@ three blocks on rank 0 and two on rank 1.
|
|||||||
even share is 160 columns, 1.25 blocks — but the split is TWO SLICES per expert, not one slice a
|
even share is 160 columns, 1.25 blocks — but the split is TWO SLICES per expert, not one slice a
|
||||||
rank: each parity's blocks are cut contiguously across the ranks and the rank taking the odd block
|
rank: each parity's blocks are cut contiguously across the ranks and the rank taking the odd block
|
||||||
alternates with the parity, so every rank's share is whole blocks, every block of every expert has
|
alternates with the parity, so every rank's share is whole blocks, every block of every expert has
|
||||||
exactly one owner, and each rank still computes a slice of every routed expert — the balance the
|
exactly one owner, and each rank still computes a slice of every routed expert. At four ranks and
|
||||||
parity tables buy at two ranks survives at any world. At four ranks and five blocks an even-parity
|
five blocks an even-parity expert is `[0, 2)` blocks on rank 0, `[2, 3)` on rank 1, `[3, 4)` on
|
||||||
expert is `[0, 2)` blocks on rank 0, `[2, 3)` on rank 1, `[3, 4)` on rank 2, `[4, 5)` on rank 3,
|
rank 2, `[4, 5)` on rank 3, and each rank's place on the odd parity shifts by one — rank 1 takes the
|
||||||
and each rank's place on the odd parity shifts by one — rank 1 takes the fat block there instead of
|
fat block there instead of rank 0 — so no rank takes the extra block of both parities. A world
|
||||||
rank 0 — so no rank takes the extra block of both parities. A world
|
|
||||||
above the block count is refused at declare, by name: a rank with an empty slice computes nothing
|
above the block count is refused at declare, by name: a rank with an empty slice computes nothing
|
||||||
and still joins the all-reduce. The shared expert's 640 columns split as evenly as whole blocks
|
and still joins the all-reduce. The shared expert's 640 columns split as evenly as whole blocks
|
||||||
allow: five blocks over four ranks is rank 0 `[0, 256)` and one block each on ranks 1, 2 and 3.
|
allow: five blocks over four ranks is rank 0 `[0, 256)` and one block each on ranks 1, 2 and 3.
|
||||||
|
|
||||||
|
**At four ranks the shares are not equal.** Parity gives the extra block only two places to go, so
|
||||||
|
ranks 0 and 1 compute three blocks of every even/odd pair of routed experts and ranks 2 and 3
|
||||||
|
compute two; the shared expert's extra block is rank 0's, and the protected bf16 experts' ten
|
||||||
|
64-wide tiles go 3, 3, 2, 2. Ranks 2 and 3 wait for the other two at every block's all-reduce.
|
||||||
|
Equal shares need the extra block rotated by the expert's number mod 4: four slice tables where
|
||||||
|
`moe_gemm_q` takes two.
|
||||||
Expert parallelism — whole experts a rank — is what this replaced, and why it stays replaced: the
|
Expert parallelism — whole experts a rank — is what this replaced, and why it stays replaced: the
|
||||||
recipe protects its bf16 experts in pairs precisely so each rank's quantised count stays even, and
|
recipe protects its bf16 experts in pairs precisely so each rank's quantised count stays even, and
|
||||||
sharding experts by rank breaks that parity property the weight tables rest on.
|
sharding experts by rank breaks that parity property the weight tables rest on.
|
||||||
@@ -325,8 +331,9 @@ time.
|
|||||||
**The fused all-reduce forms are two-rank.** At four ranks nothing fuses: the hyper-connection pair
|
**The fused all-reduce forms are two-rank.** At four ranks nothing fuses: the hyper-connection pair
|
||||||
runs the standalone sequence — `all_reduce` (libr4d's 4-rank oneshot/twoshot), then
|
runs the standalone sequence — `all_reduce` (libr4d's 4-rank oneshot/twoshot), then
|
||||||
`hc_write_bf16`, then `moe_gather` — 2 to 3 extra launches per pair against the two-rank fused
|
`hc_write_bf16`, then `moe_gather` — 2 to 3 extra launches per pair against the two-rank fused
|
||||||
form, and the fused attention ops have no bs4/gqa6 instantiation either. The unfused sequence is
|
form. The unfused sequence is declared beside the probe, so nothing is unresolved at boot. The
|
||||||
declared beside the probe, so nothing is unresolved at boot. The per-step cost against tp2 on the
|
attention's own fusion is not a collective and does carry over: the sparse decode with the output
|
||||||
|
gate and the quantiser in its merge (`attn_paged_gate_quant`) has gqa-6, page-4 rows. The per-step cost against tp2 on the
|
||||||
same cards is unmeasured.
|
same cards is unmeasured.
|
||||||
|
|
||||||
**One collective does generalise, because it has to.** The lm_head is vocab-sharded, so the sampler
|
**One collective does generalise, because it has to.** The lm_head is vocab-sharded, so the sampler
|
||||||
|
|||||||
@@ -16,7 +16,8 @@
|
|||||||
// unit entirely rather than shipping them untested.
|
// unit entirely rather than shipping them untested.
|
||||||
#define R4D_ATTN_GQA 12
|
#define R4D_ATTN_GQA 12
|
||||||
#define R4D_ATTN_H128 0
|
#define R4D_ATTN_H128 0
|
||||||
// THE KV PAGE IS FOUR TOKENS HERE, AND IT IS THE ONLY GEOMETRY IN THIS LIBRARY WHERE IT IS NOT 16.
|
// THE KV PAGE IS FOUR TOKENS HERE, as in the gqa 6 unit that serves the same layers at four
|
||||||
|
// ranks; every other geometry in this library pages at 16.
|
||||||
//
|
//
|
||||||
// Qwen3.8-Flash-Next's QSA indexer selects 4-TOKEN BLOCKS of the key history. With a page of 4 a
|
// Qwen3.8-Flash-Next's QSA indexer selects 4-TOKEN BLOCKS of the key history. With a page of 4 a
|
||||||
// selected block IS a page, so the selection is a paged block table and the sparse attention is
|
// selected block IS a page, so the selection is a paged block table and the sparse attention is
|
||||||
|
|||||||
@@ -21,7 +21,8 @@
|
|||||||
// points out of this translation unit entirely rather than shipping them untested.
|
// points out of this translation unit entirely rather than shipping them untested.
|
||||||
#define R4D_ATTN_GQA 6
|
#define R4D_ATTN_GQA 6
|
||||||
#define R4D_ATTN_H128 0
|
#define R4D_ATTN_H128 0
|
||||||
// THE KV PAGE IS FOUR TOKENS HERE, AND IT IS THE ONLY GEOMETRY IN THIS LIBRARY WHERE IT IS NOT 16.
|
// THE KV PAGE IS FOUR TOKENS HERE, as in the gqa 12 unit; every other geometry in this library
|
||||||
|
// pages at 16.
|
||||||
//
|
//
|
||||||
// Qwen3.8-Flash-Next's QSA indexer selects 4-TOKEN BLOCKS of the key history. With a page of 4 a
|
// Qwen3.8-Flash-Next's QSA indexer selects 4-TOKEN BLOCKS of the key history. With a page of 4 a
|
||||||
// selected block IS a page, so the selection is a paged block table and the sparse attention is
|
// selected block IS a page, so the selection is a paged block table and the sparse attention is
|
||||||
|
|||||||
@@ -2351,9 +2351,11 @@ static const RadConstraint cArGather2[] = {
|
|||||||
* dtype set is cArGather2's verbatim for the same reason -- the two callers' synonyms. */
|
* dtype set is cArGather2's verbatim for the same reason -- the two callers' synonyms. */
|
||||||
static const RadConstraint cArGather4[] = {
|
static const RadConstraint cArGather4[] = {
|
||||||
C_EQ("world_size", 4), C_IN("dtype", "bf16 fp16 f16 fp32 f32"),
|
C_EQ("world_size", 4), C_IN("dtype", "bf16 fp16 f16 fp32 f32"),
|
||||||
|
C_P2P,
|
||||||
};
|
};
|
||||||
static const RadConstraint cArGather8[] = {
|
static const RadConstraint cArGather8[] = {
|
||||||
C_EQ("world_size", 8), C_IN("dtype", "bf16 fp16 f16 fp32 f32"),
|
C_EQ("world_size", 8), C_IN("dtype", "bf16 fp16 f16 fp32 f32"),
|
||||||
|
C_P2P,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const RadConstraint cArExact[] = {
|
static const RadConstraint cArExact[] = {
|
||||||
|
|||||||
+20
-2
@@ -285,10 +285,10 @@ static void cross_check(const Plugin& pl) {
|
|||||||
ok("op schema names are unique", dup_schema == 0);
|
ok("op schema names are unique", dup_schema == 0);
|
||||||
ok("kernel names are unique", dup_kernel == 0);
|
ok("kernel names are unique", dup_kernel == 0);
|
||||||
|
|
||||||
int no_schema = 0, bad_key = 0, no_launch = 0, init_no_fini = 0, bad_domain = 0;
|
int no_schema = 0, bad_key = 0, no_launch = 0, init_no_fini = 0, bad_domain = 0, no_p2p = 0;
|
||||||
int bad_axis = 0, bad_deflt = 0, dup_axis = 0;
|
int bad_axis = 0, bad_deflt = 0, dup_axis = 0;
|
||||||
std::string axisdetail;
|
std::string axisdetail;
|
||||||
std::string keydetail;
|
std::string keydetail, p2pdetail;
|
||||||
for (int k = 0; k < nk; ++k) {
|
for (int k = 0; k < nk; ++k) {
|
||||||
const RadKernelInfo* r = pl.kernel_at(k);
|
const RadKernelInfo* r = pl.kernel_at(k);
|
||||||
if (!r->launch) { ++no_launch; continue; }
|
if (!r->launch) { ++no_launch; continue; }
|
||||||
@@ -351,6 +351,23 @@ static void cross_check(const Plugin& pl) {
|
|||||||
"' which op '" + r->op + "' does not declare; ";
|
"' which op '" + r->op + "' does not declare; ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* EVERY MULTI-CARD ROW NEEDS PEER ACCESS. Each kernel in this library that runs only at
|
||||||
|
* two or more ranks reads or writes the other cards' memory directly, so without
|
||||||
|
* device.p2p a machine whose cards cannot reach each other resolves it and the launch
|
||||||
|
* faults or hangs instead of being refused by name at selection. */
|
||||||
|
bool multi = false, p2p = false;
|
||||||
|
for (int c = 0; c < r->n_constraints; ++c) {
|
||||||
|
const RadConstraint& rc = r->constraints[c];
|
||||||
|
if (!std::strcmp(rc.key, "world_size") &&
|
||||||
|
(rc.op == RAD_C_EQ || rc.op == RAD_C_GE) && rc.ival >= 2)
|
||||||
|
multi = true;
|
||||||
|
if (!std::strcmp(rc.key, RAD_FACT_P2P) && rc.op == RAD_C_EQ && rc.ival == 1)
|
||||||
|
p2p = true;
|
||||||
|
}
|
||||||
|
if (multi && !p2p) {
|
||||||
|
++no_p2p;
|
||||||
|
p2pdetail += std::string(r->name) + "; ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ok("every row has a launch", no_launch == 0);
|
ok("every row has a launch", no_launch == 0);
|
||||||
ok("every row with init has fini", init_no_fini == 0);
|
ok("every row with init has fini", init_no_fini == 0);
|
||||||
@@ -360,6 +377,7 @@ static void cross_check(const Plugin& pl) {
|
|||||||
ok("no row declares the same axis key twice", dup_axis == 0, axisdetail);
|
ok("no row declares the same axis key twice", dup_axis == 0, axisdetail);
|
||||||
ok("every row's op has a schema", no_schema == 0, keydetail);
|
ok("every row's op has a schema", no_schema == 0, keydetail);
|
||||||
ok("every constraint key is a declared parameter of its op", bad_key == 0, keydetail);
|
ok("every constraint key is a declared parameter of its op", bad_key == 0, keydetail);
|
||||||
|
ok("every row that needs two or more ranks requires device.p2p", no_p2p == 0, p2pdetail);
|
||||||
|
|
||||||
/* The libr4d orderings the integer priority has to preserve. */
|
/* The libr4d orderings the integer priority has to preserve. */
|
||||||
int p_ts = -1, p_os = -1, p_dec = -1, p_pre = -1, p_m16 = -1, p_m64 = -1, p_bt = -1;
|
int p_ts = -1, p_os = -1, p_dec = -1, p_pre = -1, p_m16 = -1, p_m64 = -1, p_bt = -1;
|
||||||
|
|||||||
+3
-3
@@ -1832,7 +1832,7 @@ TEST(a_sizing_declare_leaves_the_step_state_alone_and_shrinks_only_rows) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* FOUR RANKS: THE KV HEADS REPLICATE, THE EXPERTS SPLIT WHOLE, THE FUSED COLLECTIVES STOP.
|
/* FOUR RANKS: THE KV HEADS REPLICATE, THE EXPERT WIDTHS SPLIT, THE FUSED COLLECTIVES STOP.
|
||||||
*
|
*
|
||||||
* This is the tensor-parallel test above's sibling for the other model in the tree, and it exists
|
* This is the tensor-parallel test above's sibling for the other model in the tree, and it exists
|
||||||
* because world 4 was not declarable at all: `geom_from` refused any world larger than the KV head
|
* because world 4 was not declarable at all: `geom_from` refused any world larger than the KV head
|
||||||
@@ -2039,8 +2039,8 @@ TEST(flashnext_tp4_replicates_kv_heads_and_splits_expert_widths) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* AT TWO, THE OLD DECLARATION: the KV heads split, so the even shard already selects the right
|
/* AT TWO, THE OLD DECLARATION: the KV heads split, so the even shard already selects the right
|
||||||
* rows and NO SPAN is declared at all -- TP2 is byte-identical to the tree this fork started
|
* rows and NO SPAN is declared at all -- TP2 declares as it did before replication existed.
|
||||||
* from. The fused forms are the tell that world 2 is a different deployment and not the same
|
* The fused forms are the tell that world 2 is a different deployment and not the same
|
||||||
* one stretched: they resolve there and nowhere else. */
|
* one stretched: they resolve there and nowhere else. */
|
||||||
{
|
{
|
||||||
RadBuilder h[2];
|
RadBuilder h[2];
|
||||||
|
|||||||
Reference in new issue
Block a user