feat: support CCL ReduceScatter - #64
Open
GordonYang1 wants to merge 1 commit into
Open
Conversation
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
ReduceScattersupport to the shared CCL backend abstraction, including native bindings through the existing NCCL and MCCL provider layers for the publicinfinicclReduceScatter()API. It also keeps inter-only communicators on the existing OpenMPI staging path during mixed-backend bootstrap flows, hardens the shared OpenMPI/MPICHReduceScatterimplementation with typed-reduction validation, overflow checks, and automatic host-buffer cleanup, defines zero-count behavior, makes the existing MPI example validate rank-specific destination blocks and propagate failures, and includes CCL-only plus OpenMPI-assistedReduceScatterexample programs covering out-of-place and canonical in-place flows.Changes
Public API and Dispatch
infinicclReduceScatter()API for configured CCL backends through generated bridge dispatch without changing its public signature.ReduceScatterafter validating the communicator, data type, and reduction operation, without requiring non-null buffers or entering a backend.Common CCL Implementation
ReduceScatterimplementation following the existingAllReducestructure.NotSupportedwhen the provider cannot represent either value.Existing CCL Provider Bindings
ncclReduceScatter()andmcclReduceScatter().ReduceScatterwith the existing NCCL and MCCL provider layers.MPI Correctness and Safety
MPI_Reduce_scatter_block()calls and reject data types that map toMPI_BYTE, avoiding invalid byte-wise reductions forFloat16andBFloat16.size_tmultiplication, buffer-size, and MPIintcount-range checks for staged transfers.Examples and Validation
ReduceScatterexample using one shared unique ID and rank-based communicator initialization.ReduceScatterexample that first uses the publicReduceScatterAPI through the OpenMPI inter communicator to distribute the native unique ID, then initializes the native CCL communicator for GPU reduction and scatter.ReduceScatterstatus operation.Platform and Backend Affected
Platform
Backend
Performance Impact
This adds GPU-native NCCL and MCCL paths for
ReduceScatter, avoiding the existing MPI host-staging path when a supported CCL backend and native communicator are available. The shared MPI path remains host-staged and retains typed reduction semantics with additional validation and cleanup. Other collective operations are intended to remain unchanged.Known Issues & Future Work
AllReduceandReduceScatter; other CCL collective operations remain future work.ReduceScatterinherits the backend/device combinations, data types, and reduction operations supported by the existing CCL providers; this PR does not add a new provider or device integration.Float32Sumpayloads on the default stream. Additional payload data types, reduction operations, non-default streams, and runtime coverage on Iluvatar and Moore Threads remain future work.Float16andBFloat16arithmetic reductions until a typed host conversion path is available, and rejects per-rank counts above the MPIintrange; chunked transfers remain future work.Test Results
Test Involved Platform
Test Involved Backend
Pure CCL (NCCL) on single-node NVIDIA:
ccl_all_reduce.log
ccl_reduce_scatter.log
CCL + MPI on single-node NVIDIA:
ccl_mpi_hybrid_all_reduce.log
ccl_mpi_hybrid_reduce_scatter.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
Pure CCL (MCCL) on single-node MetaX:
ccl_all_reduce.log
ccl_reduce_scatter.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