refactor: separate device and communication backend layout#48
Merged
Conversation
- Move platform runtime code under `src/devices` and MPI backend code under `src/backends/mpi`. - Introduce a shared CCL abstraction under `src/backends/ccl/common` and move NCCL provider code under `src/backends/ccl/nccl`. - Update CMake source discovery and bridge generation for the new directory layout.
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
Refactor the InfiniCCL internal source layout to separate device/platform code from communication backend code. Device-specific implementations now live under
src/devices, MPI backend code lives undersrc/backends/mpi, and NCCL is moved into the new CCL backend hierarchy undersrc/backends/ccl.This change is needed so CCL backends are no longer owned by a single platform directory. The PR introduces a common CCL layer plus an NCCL provider layout for NVIDIA, leaving future platforms/backends to add their own provider aliases or overrides under the backend hierarchy.
Changes
Source Layout
src/{cpu,cuda,nvidia,iluvatar,metax,moore,cambricon}intosrc/devices/*.src/ompiintosrc/backends/mpi/ompi.CCL Backend Abstraction
src/backends/ccl/common/for common CCL APIs and communicator instances.src/backends/ccl/common/impl.src/backends/ccl/nccl/implso common CCL code stays backend-agnostic.NCCL provider structure
src/backends/ccl/nccl/api.has the shared NCCL API wrapper.src/backends/ccl/nccl/nvidia/api.has the NVIDIA specialization that bindsBackendType::kNccltoDevice::Type::kNvidia.src/backends/ccl/nccl.Build and generation
src/CMakeLists.txtsource discovery for the newsrc/devicesandsrc/backendslayout.scripts/gen_bridge.pyso generated manifests include moved device headers, MPI backend headers, NCCL provider headers, NCCL type maps, and NCCL operation registration headers from the new locations.Platform and Backend Affected
Platform
Backend
Performance Impact
N/A. This is a source-layout and backend-abstraction refactor.
Known Issues & Future Work
src/backends/ccl/<backend>/<provider>/api.h.src/backends/ccl/<backend>structure introduced here.Test Results
Test Involved Platform
Test Involved Backend
NV+MetaX+Iluvatar+Moore with OpenMPI:
mpi_all_gather.log
mpi_all_to_all.log
mpi_all_reduce.log
mpi_broadcast.log
mpi_gather.log
mpi_reduce.log
mpi_reduce_scatter.log
mpi_scatter.log
mpi_send_recv.log
NV with NCCL:
ccl_all_reduce.log
NV with NCCL+OpenMPI:
ccl_mpi_hybrid_all_reduce.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