libr4d: all-reduce and all-gather at three ranks

Instantiate the wide one-shot all-reduce at WS=3 and add an all-gather on the
wide transport (ar_gather_3rank), with dispatch rows for world_size 3, so a
three-card box resolves 'all_reduce' and the vocab-parallel sampler's
'all_gather'. The two-shot is not instantiated at 3: it shards the message
world ways and the residual width does not divide. Selftest: 3-rank sum,
block-count sweep and both gather placements (skipped on fewer than 3 cards).

Local lab build on top of 1.0.3 (f487864); not submitted upstream.

(cherry picked from commit a76f2ab66500b9a7711b8f52abbf48eb88758359)
This commit is contained in:
baKon authored and StillDeadcode committed 2026-10-05 19:31:12 +02:00
1 parent 709d9beb1b
commit b60e329d93
8 files changed
+302 -19

No files matched your search

+7
View File
@@ -738,6 +738,13 @@ rows start above 524288 elements, which makes that a band edge of the ranged `nu
states nothing for it. `hops` is a caller's request for one or the other (1 or 2); libref accepts
and ignores it, and no libr4d row reads it. Every all-reduce kernel serves `y` absent, in place.
libr4d serves these at **2, 3, 4 and 8 ranks**. Two ranks have their own kernels (one flag word a
block, the rotated 6-bit wire, the fused norm-and-reduce forms). The wide family is one template on
the world size; 4 and 8 have both hops, 3 has the one-shot only -- the two-shot shards the message
`world` ways and a residual width such as 2560 does not divide by 3 -- and `all_gather` at width
rides the same instance as the wide `all_reduce` (`ar_gather_3rank`, `_4rank`, `_8rank`). The fused forms are declared
only at two ranks by the arch blocks, which fall back to the plain pair at any other width.
`min_bytes` is the byte floor under which a LOSSY row must serve the message exactly anyway, and it
is a parameter rather than a constant in the library because it is a property of the link and not
of the kernel. Compression only pays once the transfer is bandwidth-bound: a decode step