tune: measure collectives as the exchange -- per-rank operands and instances, device.p2p measured before declare, tune requests carrying their instance

This commit is contained in:
Dustin Ewan authored and StillDeadcode committed 2026-10-25 10:30:52 +01:00
1 parent d0c44cf5a3
commit e9555d2bc1
7 files changed
+339 -101

No files matched your search

+10
View File
@@ -655,6 +655,16 @@ Declare at the shapes you serve:
At `--tp > 1` every rank declares at once, each on its own thread and device, as the engine does:
a collective's `init` is a rendezvous, so declaring rank 0 alone at world size 2 hangs.
A collective is then measured as the exchange, not as one rank's copy of it. Each rank gets its own
operands -- drawn with its own seed, so a fold of two identical halves cannot pass a correctness
check -- its own scratch, its own stream, and the instance its own declare made: `init` is what
publishes the peer bundle (scratch, flags, sequence counters) and a launch with no instance is
refused before it starts. The candidate's launches are fired on every rank at once and the clock
stops when the last stream drains, so the reported time is the round trip through the peer, which
is what the served step pays; timing rank 0 alone would time a local copy. Candidates are still
judged against the defaults on rank 0's output. A row that is not collective runs on rank 0 alone,
as it always did.
Before trusting a cache, check that the tuned variants beat the defaults. `RADIANCE_TUNE` pins a
kernel's axes for such a comparison; it is a measurement aid, not a deployment setting.