Archived
At three ranks the exact all-reduce was the one-shot at every size: the two-shot required the message to shard evenly, and a 2048-wide bf16 row is 256 16-byte words, a multiple of 3 only one step in three. Every prefill chunk therefore sent twice its message per rank where the two-shot sends 4/3. The two-shot kernel now splits n16 words into shards of n16/ws, the first n16 % ws one word longer, with region B at the longest shard. At 4 and 8 ranks every message the entries accept divides, so nothing there changes. ar_twoshot_3rank_exact takes the band above R4D_AR_WIDE_ONESHOT_MAX_ELEMS the way the 4- and 8-rank rows do. Its fold is the one-shot's -- fp32, ascending rank order -- so the band edge between the two rows changes no bits. r4d_selftest runs both three-rank rows through a per-element oracle (bf16 and fp32, words % 3 of 0, 1 and 2, 16 words to the 20971520-element ceiling, in and out of place, back to back on one instance).