Archived
gemma3 + libr4d: the fused all-reduce junction on the lossy wire, for rows of whole 64-element groups
Under --tp-wire wht6 a TranslateGemma step of 2-3 sequences (16-24 rows) sent its junction as three launches (the standalone lossy all_reduce, rmsnorm, rmsnorm_quant_fp8): the fused ar_rmsnorm_post_quant_fp8 sent the exact wire only, and the compressed fused form needed a row of whole 512-element chunks, which Gemma 3 27B's 5376 is not (10.5). - r4d_fused_quant_fp8.hip: a row of whole 64-element groups that is not whole chunks ends in a partial chunk whose missing groups go out as zeros and are not stored back. Every real group is the same 64 elements as in the flat message, so its bytes and the sum are the standalone wire's. The (row, chunk) mapping is a template parameter (PAD, wire 6 only), so a row of whole chunks (Qwen3.8's 5120) runs exactly the code it ran before; as a runtime branch it cost a Qwen3.8 x4 step 1.3-1.6 %. POST (the sandwich post-norm) on either wire. - r4d_ar_entry.hip: K % 64 instead of K % 512 for wire 6, a size check of the padded message against the slot and the local pack, and the local pack's scale region a sixteenth of the slot instead of a thirty-second (padding adds up to 7 groups a row: a 2048-row prefill chunk would have overrun the old size). - gemma3: the junction declares its lossy twin (op_ar6) and takes it up to kAr6MaxRows (24); a taller step keeps the standalone all-reduce, which spread over more blocks wins there (the fused kernel gives a block one row). TranslateGemma-27B MXFP4 + DFlash2, 2x R9700, --tp-wire wht6 --draft-short-from 8, greedy, aggregate tok/s, two rounds, junction limit never / 24 / any: 2 streams (16 rows) 350.7 346.2 / 370.4 367.0 / 357.7 356.0 3 streams (24 rows) 455.8 451.2 / 462.8 460.6 / 437.3 436.8 4 streams (32 rows) 553.7 553.6 / 553.9 560.2 / 521.0 523.0 8 streams (32 rows) 717.4 718.0 / 716.7 720.8 / 662.4 661.9 So 2 streams +6 %, 3 +2 %, 4 and 8 unchanged. Bit identity: with --tp-wire-min-kb 1 (one stream's steps go out lossy) the fused path gives the unfused one's greedy top-5 logprobs, 300 of 300 tokens, max |d| 0, on two pieces (x1 there 197.6 -> 212.6 tok/s). Qwen3.8-27B MXFP4: 300 of 300 identical on two prompts, speed unchanged. Tests: arch_test (the lossy-wire junction test now also expects a 24-row step to fuse through the twin, other op instances than the 8-row step's, and the 64-row prefill to stay unfused). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
9497bf9061
commit
812cdeceb0
6 files changed
+156
-45
No files matched your search
+2
-2
@@ -791,8 +791,8 @@ int r4d_gate_quant_fp8(long g, long x, long y, long q, long s, int M, int n, in
|
||||
// on the norm's load. IPC arguments are r4d_ar_oneshot_2rank_exact's; `nblocks` is clamped to M
|
||||
// because a block owns whole rows, and `x` takes no pitch because it is also the message. Like the
|
||||
// int8 twin r4d_ar_ln_had_quant_i8 it has two wires: `wire` 0 is the exact bf16 payload, 6 the
|
||||
// rotated 6-bit one. Wire 6 needs `n` to be a multiple of r4d_ar_rmsnorm_quant_fp8_chunk_elems()
|
||||
// so a chunk never straddles a row.
|
||||
// rotated 6-bit one. Wire 6 needs `n` to be a multiple of 64 (a group never straddles a row); a
|
||||
// row that is not whole r4d_ar_rmsnorm_quant_fp8_chunk_elems() chunks pads its last one with zeros.
|
||||
int r4d_ar_rmsnorm_quant_fp8(long peer_scratch, long my_scratch, long peer_flags, long my_flags,
|
||||
long seq_ctrs, long slot_stride16,
|
||||
long x, long res, long w, long y, long q, long s,
|
||||
|
||||
Reference in new issue
Block a user