Archived
glm5next: the DSA indexer scores and selects by query rows over the ranks -- the prefill op that grows with context runs a run of rows a rank, bit for bit
Every rank scored every query row of a step against every complete block of its sequence and selected its 512 blocks, the same work eight times: 58 ms of a 1029 ms step at a 4096-row chunk and 20k of context, about 185 ms at 64k, the largest op that grows with the context. From GlmTp::kSplitRows each rank now scores one run of the step's rows with dsa_score's row_part, selects for the rows of its run under the bounds the scorer rebased (cu_part), and two all_gathers lay the page tables and lengths end to end (8 MiB a layer at 4096 rows). The key side stays replicated. The run's queries are all a rank needs, so the query projection, its quantiser and the head gates run on the run's rows too, and the gates lose their column split and gather; the bf16 projection stays on the step's rows where a run would be 64 rows or fewer, the skinny band whose split count a tuned configuration may set. Each row's selection is the same kernels' answer to the same operands, so the joined table is bit-identical to the replicated one and MLA reads it unchanged. The rule for a run is GlmTp's, stated once: ceil(T / world) rows rounded up to whole 16-byte words of the gathered row, because an all_gather moves whole words; the indexer gathers one i32 length a row, so its runs are multiples of four (DsaCache::part_rows). A rank whose run lies wholly past a small step takes the first run and computes dead rows, so every plane it gathers is written (GlmTp::run_of). The selection planes hold world runs, which can reach past the step, and the score plane shrinks to one run, 256 MiB to 32 MiB at 64k of context and a 4096-row chunk. A decode step splits too once rows x live blocks reach 2^18 from 16 rows (GlmTp::kSplitWork): eight sequences verifying five drafts from about 22k of context, where scoring 48 rows over 8000 blocks (250 us on one R9700) outweighs the two eight-rank gathers (about 50 us); a single sequence's six rows never pay. The replicated issue passes cu_part absent as its tenth operand, because the engine counts operands against the schema and refused the nine-operand issue at a served engine's first long prompt. On eight R9700s (TP8, two ranks on Gen4 x8 that day) a 19887-token prompt prefills 3927 tok/s against 3748 on 1.9.0, 7881 tokens 3990 against 3655, 2k 3849 against 3663; greedy text with the adaptive draft window is identical. r4d_emu splits decode rows beside a prefill chunk at 2, 4 and 8 ranks and joins the runs as the gather does, byte for byte against the unsplit scorer; glm5next_test declares the split at 2 and 8 ranks with the lint, holds the row rule to the formula it replaced at every world, and pins the graph and steps (world 1 0xed3fc26c486ea1b5 / 0x33e5f136f0dbba15, world 8 0x712f01858dbe1047 / 0xf9e357b1333c638f). dsa_score_fp8's selftest passes 62 of 62 on eight cards, and --perfdsa times the indexer whole and as one rank's run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
66812280bb
commit
1ad675e10c
5 files changed
+474
-58
No files matched your search
+34
-7
@@ -519,9 +519,18 @@ layer's latent, index and tail for every row and runs its MoE on the proposal ro
|
||||
|
||||
**Tensor parallelism.** At 1, 2, 4 or 8 ranks; declare refuses any other. `tests/glm5next_test.cpp`
|
||||
declares and steps the whole plugin at 1, 4 and 8, against pinned graph and step hashes at 1 and
|
||||
8, the connection, router and index-gate splits at 1, 2, 4 and 8, each issue's operand count
|
||||
against the loaded kernel libraries' schemas, and every declared weight against the served
|
||||
container's names and encodings.
|
||||
8, the connection, router and index-gate splits at 1, 2, 4 and 8, the indexer's row split at 2
|
||||
and 8, the row rule at every world, each issue's operand count against the loaded kernel
|
||||
libraries' schemas, and every declared weight against the served container's names and encodings.
|
||||
|
||||
One row rule (`GlmTp::run_rows`): from a pass of `GlmTp::kSplitRows` = 256 rows, a replicated
|
||||
piece of work splits by rows over the ranks instead, each rank taking one run of ceil(T / world)
|
||||
rows rounded up to whole 16-byte words of the row it gathers, because an `all_gather` moves whole
|
||||
words: multiples of four rows for the indexer's one i32 length a row. The last run may be short;
|
||||
a rank whose run lies wholly past a small step takes the first run and computes dead rows, so
|
||||
every plane it gathers is written (`GlmTp::run_of`). The indexer also splits a smaller step, from
|
||||
16 rows once rows x live blocks reach 2^18 (`GlmTp::kSplitWork`). Below the thresholds, as in
|
||||
decode, the collective costs more than it saves and every rank runs the replicated form.
|
||||
|
||||
- The routed and the shared experts split their 2048 width into equal contiguous slices, 256 a
|
||||
rank at eight; each rank computes its slice of every expert, and the block's all-reduce sums
|
||||
@@ -530,15 +539,33 @@ container's names and encodings.
|
||||
of o. q_a, kv_a and the latent are replicated.
|
||||
- KDA splits its 64 heads, with them the q/k/v rows, the convolution taps and the state; the two
|
||||
rank-128 projections into the gates are replicated.
|
||||
- The indexer is replicated whole.
|
||||
- The indexer's key side is replicated: every rank keeps the whole index cache and its tail. Its
|
||||
query side splits by rows from the threshold: each rank scores its run under the row rule,
|
||||
R = 4 * ceil(T / (4 * ranks)) query rows (`DsaCache::part_rows`), against the whole cache
|
||||
(`dsa_score` with `row_part`, the last run's rows past the step scoring `-inf`) and selects for
|
||||
the rows of its run that exist, under the bounds the scorer rebased to the run's first row
|
||||
(`cu_part`, docs/OPS.md); two `all_gather`s lay the runs' page tables and lengths end to end,
|
||||
513 and 1 i32 a row, 8 MiB a layer at a 4096-row chunk. The run's queries are all a rank needs,
|
||||
so the query projection, its quantiser and the head gates run on the run's rows too, and the
|
||||
gates need no gather; the bf16 projection stays on the step's rows where a run would be 64 rows
|
||||
or fewer, the skinny band whose split count a tuned configuration may set. Each row's selection
|
||||
is the same kernels' answer to the same operands, so the joined table is bit-identical to one
|
||||
rank's and MLA reads it unchanged. The scoring grows with the context (every row scores every
|
||||
complete block of its sequence), so this is where long prompts gain: the score plane shrinks to
|
||||
one run (256 MiB to 32 MiB at 64k of context and a 4096-row chunk). A smaller step splits too
|
||||
from 16 rows once rows x live blocks reach 2^18 (`GlmTp::kSplitWork`): eight sequences
|
||||
verifying five drafts from about 22k of context, where the scoring of 48 rows outweighs the two
|
||||
gathers; a single sequence's decode never does, and below both thresholds the indexer runs
|
||||
whole.
|
||||
- The vocabulary is row-sharded, 19360 rows a rank at eight; the embedding's all-reduce is exact.
|
||||
- The f32 projections (the router's 288 x 4096, the index head gates' 32 x 4096, each
|
||||
connection's mHC projection of 24 x 16384) are replicated. From a pass of 256 rows
|
||||
(`GlmTp::kSplitRows`; `SplitF32Proj` in `arch/common/rad_glm_tp.h`), each rank computes a disjoint part
|
||||
with the replicated kernel and an `all_gather` joins the parts, so every value is
|
||||
bit-identical: the router and the head gates split their output columns, the mHC projection
|
||||
its 16384-wide input into eight 2048-column chunks, whose partials `mhc_pre_finish` completes
|
||||
on every rank. Below the threshold, as in decode, the collective costs more than it saves.
|
||||
bit-identical: the router splits its output columns, the mHC projection its 16384-wide input
|
||||
into eight 2048-column chunks, whose partials `mhc_pre_finish` completes on every rank, and the
|
||||
head gates go with the indexer's rows (above). Below the threshold, as in decode, the
|
||||
collective costs more than it saves.
|
||||
|
||||
**MoE decode fusions.** Three, each byte-identical to the launches it replaces, declared
|
||||
wherever a loaded library serves the fused op (the separate launches otherwise):
|
||||
|
||||
Reference in new issue
Block a user