feat: support NCCL AllReduce#47
Merged
Merged
Conversation
…ination` trait - add a new return status `infiniNotSupported` to indicate a functionality is not supported - add `IsSupportedCombination` trait to control valid combinations between different `BackendType`s and `Device::Type`s - update `Operation::Call()` to use `IsSupportedCombination` to ensure only valid combinations are instantiated and forwarded
…s well as NCCL checks - add `infiniGetUniqueId()` in `include/comm.h` - add `GetUniqueId` and its NCCL implementation - modify the nccl path in `BACKEND_PATH_MAP` in `scripts/gen_bridge.py` - add `src/nvidia/nccl/checks.h` which contains the error handling function and macro for NCCL
- add `infiniCommInitRank()` and its NCCL backend implementation - fix a comment style issue in `src/ompi/impl/comm_init_all.h`
- add `kNcclTypeMap` for converting `DataType` to `ncclDataType_t` and its runtime accessor `DataTypeToNcclType` - add `kNcclOpMap` for converting `ReductionOpType` to `ncclRedOp_t` and its runtime accessor `RedOpToNcclOp`
…ccl/impl/all_reduce.h`
Resolve compilation errors in standalone backend builds (e.g., NCCL-only) by checking the filesystem for implemented operations and generating `ReturnStatus::kNotSupported` stubs for the missing ones.
…xists instead of the whole communicator
- add a thread-per-GPU CCL AllReduce example for single-node runs in `examples/ccl/all_reduce.cc` - add an OpenMPI-assisted hybrid AllReduce example for multi-node runs in `examples/ccl_mpi_hybrid/all_reduce.cc`
…rguments after a `--` separator
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.
Summary
This PR adds NVIDIA NCCL support for
AllReduce, including the public unique-ID and rank-based communicator initialization APIs needed for NCCL-style bootstrap flows. It also teaches the generated C bridge to returninfinicclNotSupportedfor unavailable operations, adds backend/device combination filtering, includes CCL-only plus OpenMPI-assisted NCCL example programs, and documents NCCL as a partial backend option.Changes
Public API and Dispatch
infinicclUniqueId,infinicclGetUniqueId(), andinfinicclCommInitRank()to the public communication API.infinicclNotSupported/ReturnStatus::kNotSupported.IsSupportedCombinationso unsupported backend/device pairs do not instantiate invalid operation implementations.NotSupportedinstead of failing to compile.NCCL Backend
GetUniqueId,CommInitRank,CommDestroy, andAllReduce.GetDevicealiases needed by rank-based communicator initialization.Hybrid Communicator Ownership
CommInitAllandCommInitRankto populate separateinter_commandintra_commslots on oneCommunicator.Examples and Runner Tooling
AllReduceexample.AllReduceexample that uses MPI for rank discovery and unique-ID broadcast, then initializes an NCCL communicator.scripts/run_examples.pyto forward executable arguments after--.Documentation and PR Template
Platform and Backend Affected
Platform
Backend
Performance Impact
This adds a GPU-native NCCL path for NVIDIA
AllReduce, avoiding the existing MPI host-staging path when the NCCL backend is available. Existing MPI collectives are intended to remain unchanged.Known Issues & Future Work
GetUniqueId,CommInitRank,CommDestroy, andAllReduce; other NCCL collective operations remain future work.Test Results
Test Involved Platform
Test Involved Backend
Pure CCL (NCCL) on single-node NVIDIA:
ccl_all_reduce.log
CCL + MPI on single-node NVIDIA:
ccl_mpi_hybrid_all_reduce.log
MPI on Heterogeneous Cluster:
mpi_all_gather.log
mpi_all_reduce.log
mpi_all_to_all.log
mpi_broadcast.log
mpi_gather.log
mpi_reduce.log
mpi_reduce_scatter.log
mpi_scatter.log
mpi_send_recv.log
Checklist
Title, Branch, and Commits
feat: …,fix(nccl): …).<type>/xxx-yyyy-zzzzwhere<type>matches the PR title's Conventional Commits type and words are joined with hyphens (seeCONTRIBUTING.md§Branches).CONTRIBUTING.md§Pull Requests).master— the branch is rebased cleanly on top of the currentmaster.fixup!/squash!/wipcommits remain.Scope and Design
CONTRIBUTING.md§Code/General).printf/std::cout/print(...)left behind, orTODOwithout an owner and issue link.General Code Hygiene
CONTRIBUTING.md§Code/General).CONTRIBUTING.md§Code/General).the `AllReduce` implementation) (CONTRIBUTING.md§Code/General).CONTRIBUTING.md§Code/General).CONTRIBUTING.md§Code/General; §Python).C++ Specific (if C++ files changed)
clang-format(version 16, per.github/workflows/clang-format.yml) has been run against all modified applicable files; the diff is clean.assertwith messages that include at least__FILE__,__LINE__, and__func__(CONTRIBUTING.md§C++).CONTRIBUTING.md§C++).CONTRIBUTING.md§C++).CONTRIBUTING.md§C++).CONTRIBUTING.md§C++).CONTRIBUTING.md§C++).Python Specific (if Python files changed)
ruff checkpasses cleanly on CI (see.github/workflows/ruff.yml).ruff format --checkpasses cleanly — if not, runruff formatand commit the result.CONTRIBUTING.md§Python).pytest.skipmessages without terminal period) are honored where applicable (CONTRIBUTING.md§Python).CONTRIBUTING.md§Python).if,for, and similar control-flow statements (CONTRIBUTING.md§Python).return, except when it directly follows a control-flow statement (CONTRIBUTING.md§Python).CONTRIBUTING.md§Python).Testing
Build, CI, and Tooling
CMakeLists.txtunderif(AUTO_DETECT_DEVICES)or toif(AUTO_DETECT_BACKENDS)if applicable.clang-format.yml,ruff.yml) are green locally (or expected to be green on CI).Documentation
README.md,CONTRIBUTING.md, or inline docs updated when behavior, build flags, or developer workflow changed.!orBREAKING CHANGE:footer.Security and Safety