Repository navigation
[Benchmark] Add all-reduce rank-skew calibration - #57037
samnordmann wants to merge 1 commit into
Conversation
ff629d8 to
c543d3b
Compare
|
This pull request has merge conflicts that must be resolved before it can be |
calvin-fei
left a comment
There was a problem hiding this comment.
Thanks for picking up the calibration step of #52777. The approach matches what the RFC intended. There is
a CPU barrier before each trial but no extra collective inside the timed region. The delay is injected
on the GPU with the measured delay recorded next to the requested one. Rank records are merged
afterwards without comparing CUDA clocks across ranks.
I ran it on 2× H100 80GB (NVLink, TP2): your test-plan command, the same in eager mode, all six
all-reduce backends in graph mode, and --skew-rank 1. test_device_communicator_benchmark.py passes
(20), and the default benchmark mode still works. Your result reproduces:
- pynccl, 8627×8192, with a requested 1 ms delay adds 0.989 ms of max-rank residence in graph mode
and 0.981 ms in eager. - The other five backends, including
ca_1stage/ca_2stage, add 0.965–0.978 ms.
Suggestions:
-
Expose the last-arriving rank's residence in the trial summary.
max_gpu_collective_msis the
waiting rank's residence. On the delayed rank the residence stays flat as the delay grows, so it is
the zero-wait cost (pynccl graph, 8627×8192, medians):injected delay max-rank delayed (last-arriving) rank measured delay 0 0.492 ms 0.491 ms 0.003 ms 250 µs 0.740 ms 0.488 ms 0.259 ms 1 ms 1.481 ms 0.488 ms 1.009 ms ca_1stagebehaves the same way: 0.528 → 0.513 ms on the late rank, while max rises to 1.498 ms.
So max − last-arriver ≈ the waiting time, which is the split #52777 is after. It also matches
@wickist's observation there that the waiting rank's spin inside custom AR gets counted as
communication. The per-rank values are already inranks, so this is only a summary/print change. -
Report the measured delay.
_delay_us_to_cyclesuses the ratedclock_rate, and on H100 the
requested and measured delays drift apart most at small values:- 1000 µs → 1.009 ms (+1%)
- 250 µs → 0.259 ms (+4%)
- 50 µs → 0.059 ms (+18%)
Since you already record
measured_gpu_delay_ms, any fitted skew-sensitivity curve should use it
rather than the requested value. -
Zero-delay baseline in eager mode. At delay 0, host enqueue spread is about 22–25 µs in eager
vs 3–15 µs in graph mode (unpinned CPUs). So the "delayed" rank sometimes arrives first at delay 0,
and its eager baseline is about 0.03 ms higher than at larger delays. It may be worth noting that the
delay-0 row in eager mode already includes some natural skew. -
Schema alignment (optional). The field names already follow the RFC's record. A
collective_ordinal/signature key would make the later trace-join phase easier. -
Rebase. The conflict with main is from #52136 (pydocstyle in ruff) and is mechanical: keep this
PR's side in both hunks. After that, ruff 0.14.0 reports two of the new rules on this file:- D413 on the module docstring's "Example" section;
- D202 on the blank line after the
benchmark_allreducedocstring.
ruff check --fixhandles both.
Not tested: more than 2 GPUs, multi-node, and GB200.
Signed-off-by: snordmann <snordmann@nvidia.com> Assisted-by: OpenAI Codex
c543d3b to
fbd7dd7
Compare
|
Thanks for reproducing this on H100. Addressed in fbd7dd7:
Validation: 22 tests and local hooks pass; 720 fresh GB200 trials cover TP2/TP4, eager/graph and six backends, plus both legacy CLI runs. The new summaries also pass replay over all 10,560 retained trials. GPU timing logic is unchanged. |
Purpose
All-reduce duration includes time waiting for late ranks. Add an opt-in calibration mode to the existing communicator benchmark: inject a GPU delay on one rank and report per-rank timings for exact BF16 shapes in eager or CUDA-graph mode.
Trial summaries expose maximum residence, injected-rank residence, measured delay, and their residence gap. The injected rank is not assumed to arrive last, especially at zero requested delay; use measured delay for skew-sensitivity analysis.
Implements the calibration step of #52777; no duplicate implementation was found in open-PR searches. Benchmark and tests only; default output and serving behavior are unchanged.
Test Plan
Repeat with 4 ranks, eager mode, and alternate injected ranks.
Test Result
44fe2a392runtime as the original matrix, not a full rebuild of main.For BF16
8627×8192per rank, original median maximum-rank GPU residence:Actual injected delays were ≈1.01 ms. TP4 used eight GPU-local CPU cores/rank; unrestricted runs exposed millisecond-scale host enqueue skew. GPU residence includes launch gaps and peer waiting, not just transport; the residence gap is diagnostic, not an isolated wait-time measurement.
AI assistance: OpenAI Codex. Model evaluation is not applicable to this benchmark-only change.