Repository navigation
Conversation
…ode TP) + opt-in one-shot all-reduce
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
#8012 @ c3b4113, head 2026-11-16T06:45:00Z) Applied as the PR diff onto the rebased 1116 tree; PR state: draft. Conflicts resolved by keeping both sides (both PRs add different opt-in routes next to each other): communicator_cuda.py (#8015 Lamport one-shot check, then this PR's INT4 two-shot check), custom_all_reduce.py (constants, both symm_mem inits, both init methods), custom_all_reduce_gfx1250.h / pybind (main's #7927 allreduce_lamport and fused AR+RMS+quant declarations kept next to this PR's q4 declarations). (cherry picked from commit 1bb791e) Rebase onto main 12-03: #8015 (one-shot + symm_mem inbox) is not carried: main's #7937 final builds the Lamport inbox on every transport and routes plain all-reduce itself (should_lamport_ar(inp, two_shot)). So _LAMPORT_AR_MAX_SIZE / _init_lamport_symm / should_lamport_ar / lamport_all_reduce and the communicator's one-shot branch from #8015 are left out; the symm_mem init calls main's _init_lamport_ar_rms, then this PR's _init_lamport_q4_2s(symm=True). pybind keeps main's allreduce_lamport(split=False) next to the q4 bindings.
Summary
On gfx1250 the Lamport inbox behind the fused all-reduce + RMSNorm and all-reduce + add kernels is set up only on the IPC transport. TP groups that span nodes use the torch.symm_mem transport, so they never get it. This PR:
lamport_ar_rms_buffer_size_gfx1250bytes.init_lamport_ar_rms_gfx1250and the same kernels as the IPC inbox.AITER_CUSTOM_AR_LAMPORT_RMS_MAX_SIZE, which is unset at TP8 by default. So nothing changes unless the env var is set.AITER_CUSTOM_AR_LAMPORT_AR_MAX_SIZE=<bytes>(default 0 = off) routesCudaCommunicator.all_reduceinputs of at most that size tolamport_ar_addwith a zero addend.inp + 0rounds toinp, so the result has the plain sum's bits.The decision is shape-only, so every rank takes the same route.
Results
TP8 across two MI455X nodes (torch.symm_mem, mori backend). bf16, CUDA graphs, slowest rank's median, us per all-reduce. "Off" is the same call through the custom all-reduce window, with #7937's two-shot in that window:
Above the 1 MiB cap both configurations take the same route (1.09 MiB: 18.8 vs 18.0 us, 2.19 MiB: 19.8 vs 19.0 us, run to run).
Test
tensor_model_parallel_all_reducewas compared against an fp32 reference and for equal bits on all ranks. It ran eager and inside CUDA graphs replayed with fresh inputs, with sizes crossing the cap, and had no failing call.communicator_cuda.pyhas a pre-existing black difference on main, unrelated to this PR.Related: #8012 (INT4 / INT8-coded two-shot, also on the symm_mem transport), #7937, #7861 (gfx1250 Lamport all-gather).