Repository navigation
Conversation
Jinyao618
force-pushed
the
feat/mpi-device-aware-send-recv
branch
from
November 24, 2026 10:29
8c2505b to
aae6bee
Compare
Jinyao618
force-pushed
the
feat/mpi-device-aware-send-recv
branch
from
November 25, 2026 06:27
aae6bee to
f2dbc05
Compare
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 a device-aware transport path for OpenMPI
Send/Recv. When the local MPI stack can consume device memory, the newMpiBufferPlanpasses device pointers directly toMPI_Send/MPI_Recv; otherwise it falls back to the existing host-staging path. The public API is unchanged, and onlySend/Recvare adapted in this PR.Capability is resolved once per communicator and stored in
OmpiInstance::device_support. Each rank keeps its own decision, so a heterogeneous job can mix one device-aware rank with another host-staged rank without a global capability agreement.Changes
MPI device-aware capability
MpiDeviceTraitsandMpiDeviceSupportinsrc/backends/mpi/ompi/device_support.h.INFINICCL_MPI_DEVICE_AWAREmodes:MPIX_Query_cuda_supportincmake/backends/MPI.cmake.device_support_config.hand consumed as a constexpr value, avoiding preprocessor conditionals in runtime code.Unified buffer plan
MpiBufferPlaninsrc/backends/mpi/ompi/buffer_plan.h.Commit().Mode::kPairis used explicitly bySend/Recv;Mode::kAliasis reserved for future single-buffer collectives.Send/Recv integration
src/backends/mpi/ompi/impl/send.handsrc/backends/mpi/ompi/impl/recv.has:Prepare plan ->
MPI_Send/MPI_Recv-> Commitsrc/backends/mpi/ompi/impl/comm_init_all.hto resolve and log the actual per-rank transport mode.src/devices/nvidia/device_.handsrc/devices/metax/device_.hso ordinary host pointers are classified as host instead of aborting.Platform and Backend Affected
Platform
Backend
Performance Impact
Benchmark:
examples/mpi/send_recv,float32, 4 MB message, 2 warm-up iterations, 20 profile iterations.The same-node NVIDIA direct path improves average latency from
0.599 msto0.035 ms, about17xcompared with host staging. The mixed NVIDIA/MetaX run improves latency from0.509 msto0.437 ms, about1.16x.Known Issues & Future Work
Send/Recvare adapted; other MPI collectives are unchanged.Test Results
Test Involved Platform
Test Involved Backend
metax-host-staged-mpi-send-recv.log
nvidia-device-direct-mpi-send-recv.log
nvidia-host-staged-mpi-send-recv.log
nvidia-metax-device-aware-mpi-send-recv.log
nvidia-metax-host-staged-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