libr4d: the eight-rank two-shot's timeline -- where a 16 MiB all-reduce spends 1.36 ms against 0.76 ms of link time

At 4 x Gen5 x16 + 4 x Gen5 x8 the weighted two-shot moves a 16 MiB message in 1316 to 1340 us
(K4 to K8, --perfar8), against 763 us that the x8 cards' links need for its bytes, and
measured(K) = f x link time(K) + h x (K + 1) fits f of about 1.45 and h of about 20 us a
handshake. Whether that is link efficiency, waiting for the slowest rank, the local reduce or the
step boundaries cannot be told from the period alone.

A launch now takes an optional `timeline` parameter, a device buffer of nblocks x
R4D_AR_TL_WORDS int64 (r4d_ar_shards.h). Every block of the eight-rank two-shot stamps the device
wall clock after its sequence step, at each handshake when all its stores have drained (arrive)
and when every peer's flag has been seen (release), and after its last local work. The stamps sit
in r4d_ar_handshake behind a null check, so a launch without the parameter pays a branch per
handshake; no value changes either way.

r4d_selftest --perfar8 --timeline launches each two-shot point once more with the stamps on and
prints, per rank, the first push, every step's work and wait, and the final assemble. In one piece
that is the reduce-scatter's send, its receipt, the reduce with the all-gather's send, its receipt
and the local assemble, so the two hops are measured apart; in K pieces it shows which rank works
while the others wait.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
NunzeandClaude Fable 5.1 authored and StillDeadcode committed 2026-10-22 11:54:56 +02:00
1 parent b34af6c509
commit 91200c900b
6 files changed
+138 -17

No files matched your search

+3 -1
View File
@@ -1174,6 +1174,8 @@ extern "C" int r4d_rad_ar_twoshot_8rank_exact(const RadArgs* a, RadStream s) {
const long long asked = r4d_pgeti_or(a->p, a->n_p, "pieces", in->pieces);
if (asked < 0 || asked > R4D_AR_TS_MAX_PIECES) return RAD_E_INVAL;
const long long pieces = ar8_pieces_for(in, c.numel, asked);
/* A diagnostic: a device buffer of nblocks * R4D_AR_TL_WORDS int64 stamps (r4d.h). */
const long long timeline = r4d_pgeti_or(a->p, a->n_p, "timeline", 0);
R4D_TRY("ar_twoshot_8rank_exact",
r4d_ar_twoshot_8rank_exact(in->peer_scratch[0], in->peer_scratch[1], in->peer_scratch[2],
in->peer_scratch[3], in->peer_scratch[4], in->peer_scratch[5],
@@ -1184,7 +1186,7 @@ extern "C" int r4d_rad_ar_twoshot_8rank_exact(const RadArgs* a, RadStream s) {
in->my_scratch, in->my_flags, in->my_seq, in->slot16,
c.inp, c.out, c.numel, in->dtype, in->rank,
(long)(uintptr_t)s, c.nblocks, c.nthreads, c.drain, c.acq,
c.pub, weights, (long)pieces));
c.pub, weights, (long)pieces, (long)timeline));
return RAD_OK;
}