Repository navigation
Support 2 ranks in AllreduceRsAgZeroCopy - #948
Merged
Binyang Li (Binyang2014) merged 2 commits intoNov 6, 2026
Merged
Conversation
The Blackwell allreduce selector (and the Python default config) returns default_allreduce_rsag_zero_copy for large messages in CUDA-graph mode, but the kernel was only instantiated for 4/8/16/32 ranks per IPC domain. With 2 ranks the launch returned cudaErrorInvalidValue without running, so ncclAllReduce through the NCCL shim failed with ncclInvalidArgument for messages above 2 MiB under CUDA graph capture (e.g. TP=2 with CUDA graphs on B200/B300). The kernel is generic in NRanks (NPeers = NRanks - 1), so add the NRanks == 2 instantiation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Binyang Li (Binyang2014)
approved these changes
Nov 4, 2026
Binyang Li (Binyang2014)
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the contribution, LGTM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
why
With 2 GPUs on Blackwell,
ncclAllReducethrough the MSCCL++ NCCL shim fails withncclInvalidArgumentfor messages above 2 MiB when the call is captured in a CUDA graph. That is the usual setup for TP=2 inference with CUDA graphs.selectSingleNodeAllreduceBlackwell(src/ext/nccl/algorithm_selector.cc) returnsdefault_allreduce_rsag_zero_copywhen symmetric memory is off, the call is being captured, and the message is larger than 2 MiB. The Python default config (mscclpp_benchmark/comm.py:_default_tuned_config) does the same above 512 KiB.AllreduceRsAgZeroCopyAdapteronly instantiates the kernel for 4, 8, 16 and 32 ranks per IPC domain. For any other count it logs a warning and returnscudaErrorInvalidValuewithout launching anything.Reproduced on 2× B300 (CUDA 13.3, driver 610.57) with nccl-tests
all_reduce_perf -g 1 -c 1, usingLD_PRELOAD=libmscclpp_nccl.soand no NCCL fallback library:-G 5), bf16 / fp32ncclInvalidArgument("invalid argument")The Python benchmark (
mscclpp_benchmark.bench_collective, 2 ranks, no--symmetric-memory) fails the same way, with "algorithm returned non-zero status" at every size of 640 KiB and above, for bf16, fp16 and fp8_e4m3fn.what changed
The kernel is already generic in
NRanks:NPeers = NRanks - 1, and the peer loops are unrolled at compile time. The setup path registers2 * nPeersremote memories with no rank-count assumption. So this change adds thenRanksPerIpcDomain == 2instantiation and updates the comment and the warning text.Other rank counts (3, 5, 6, 7, …) are still rejected. If you'd prefer the selectors to check rank count and fall back to another algorithm for those, I can add that in this PR or in a follow-up.
verification
2× B300 (sm_103a build, CUDA 13.3), nccl-tests
all_reduce_perf -b 16K -e 256M -f 4 -g 1 -c 1 -w 5 -n 20withLD_PRELOAD=libmscclpp_nccl.so. The base ismainat d5ce6c7. The table shows out-of-place time in µs, with busBW in GB/s in parentheses.The table is for bf16. fp16 and fp32 behave the same: the base fails at 4 MiB under CUDA graph, and this PR passes every size.
All runs with this PR report 0 wrong values.
Eager-mode results are unchanged from the base, which is expected because that path does not use this algorithm.
For reference, plain NCCL (CUDA graph, bf16) took 36.89 µs at 4 MiB, 50.94 µs at 16 MiB and 123.68 µs at 64 MiB. That was a separate run on a different GPU pair in the same node.
clang-format --dry-run --Werrorpasses on the changed file (clang-format 21.1.6), andgit diff --checkpasses.🤖 Generated with Claude Code