[Runtime][Disco][Relax] Add CPUCCL support for distributed execution - #20077
Open
Laiyyi wants to merge 10 commits into
Open
[Runtime][Disco][Relax] Add CPUCCL support for distributed execution#20077Laiyyi wants to merge 10 commits into
Laiyyi wants to merge 10 commits into
Conversation
added 10 commits
July 30, 2026 09:40
[RUNTIME][Disco] Add CPU collective communication support [FixBugs] Add build_ring and UploadModule()
[FixBugs] RemoteConnect [FixBugs] Fix multiple broadcast issues in iptables
[FixBugs] Re-wrap Tensor args when relaying kSend to local workers Fix ruff line length and import order for gather_to_worker0
…readSess test [Disco][Test] Rename test_socket_cpuccl.py and add ProcessSess and ThreadSess test [Disco][Test] Adjust the comment format Fix pre-commit formatting issues
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
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
Currently, TVM Disco supports multi-node distributed execution through NCCL and RCCL. However, these backends require all participating devices to have GPUs. In some environments where only CPU resources are available, existing collective communication backends cannot be directly used.
Therefore, this PR introduces CPUCCL, enabling TVM Disco to perform multi-node distributed execution in CPU-only environments.
cpuccl.ccto implement the CPU-based collective communication backend.upload_vm_moduleto support VM module transfer across nodes..somodule.upload_vm_module.load_vm_moduleand participate in distributed execution.allreduceusing a ring-based algorithm. These functions interface follows the implementation style ofnccl.cc.build_ringoption toThreadedSession,ProcessSession,SocketSessionandprocess_pool.pyto enable optional ring construction for CPUCCL communication.disco_worker.pywith corresponding changes to support CPUCCL communication.gather_to_worker0support in Relax.SocketSession Cross-node Communication
In
SocketSession, CPUCCL cross-node communication is implemented using local rings combined with TCP forwarding.Assume two nodes, A and B, each containing two workers. Each node first creates its own local ring:
Node A:
W0 ─A0→ W1 ─A1→ W0
Node B:
W0 ─B0→ W1 ─B1→ W0
Each session additionally creates two threads responsible for cross-node TCP communication.
When Node A's W1 needs to send data to Node B's W0, it only writes data into the local ring channel
A1. The send thread monitorsA1and forwards the data to Node B through TCP.On Node B,
SocketSessioncreates a proxy channel. The recv thread receives data from Node A and writes it intoproxy_out_to_tcp_. Since Node B W0'sring_inis rerouted throughRerouteRingIn, W0 on node B can correctly receive data from Node A W1.Bug Fix
test_session.pycaused by duplicated shutdown messages during session destruction. Added shutdown state checking inbcast_session.ccto prevent repeated shutdown handling.Build Configuration
USE_CPU_CCLoption to allow users to choose whether to compilecpuccl.cc.CMakeLists.txtfiles to include CPUCCL in the build process.Tests
test_cpuccl.py, reusing NCCL test cases to validate CPUCCL collective communication.test_session.py.test_socket_uploadto validate theupload_vm_modulefunctionality.test_op_ccl.pyandtest_transform_legalize_ops_ccl.pyto verify Relaxgather_to_worker0functionality.