Skip to content

[coll] Prevent all-to-all connection.#12075

Merged
trivialfis merged 9 commits into
dmlc:masterfrom
trivialfis:coll-sparse
Mar 12, 2026
Merged

[coll] Prevent all-to-all connection.#12075
trivialfis merged 9 commits into
dmlc:masterfrom
trivialfis:coll-sparse

Conversation

@trivialfis

@trivialfis trivialfis commented Mar 11, 2026

Copy link
Copy Markdown
Member

Use a static topology instead. The topology is a union of a ring and a tree.

Close #10840

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the CPU collective TCP backend to avoid an all-to-all connection pattern by using a fixed, sparse topology (ring neighbors + binomial tree rooted at rank 0), while keeping collective semantics intact (including non-zero-root broadcast via relay).

Changes:

  • Introduce sparse peer selection (SparsePeers) and sparse channel population (HasChan + Chan guard) for the TCP communicator.
  • Rework worker-to-worker connection bootstrap to connect only to the sparse peer set, and adjust tests to account for missing channels.
  • Update CPU broadcast to use a fixed tree rooted at rank 0 (with relay for non-zero roots) and adjust CPU allgatherV to prefer ring.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/cpp/collective/test_worker.h Avoids touching non-existent channels in tests by checking HasChan.
src/collective/comm.h Adds sparse topology helper (SparsePeers) and HasChan; makes Chan() enforce topology.
src/collective/comm.cc Changes bootstrap to connect only to sparse peers; stores nullptr channels for non-neighbors.
src/collective/coll.h Copyright year range update.
src/collective/broadcast.cc Implements fixed-tree broadcast rooted at 0 with relay for non-zero roots.
src/collective/allgather.h Selects ring allgatherV for CPU and broadcast-based for CUDA.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/collective/comm.cc
Comment thread src/collective/broadcast.cc

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/collective/broadcast.cc
Comment thread src/collective/broadcast.cc
Comment thread src/collective/comm.cc
@trivialfis trivialfis changed the title [wip][coll] Prevent all-to-all connection. [coll] Prevent all-to-all connection. Mar 12, 2026
@trivialfis
trivialfis requested a review from RAMitchell March 12, 2026 11:05

@RAMitchell RAMitchell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What benefits are you expecting from this? The changes looked clean to me I'm just not familiar with networking code. By the way the only major user of cpu all gather now seems to be cpu histogram column mode split sharing.

@trivialfis

Copy link
Copy Markdown
Member Author

What benefits are you expecting from this?

Reduced the number of connections. Before this PR, with N nodes, we had O(N^2) connections. Now it's linear. One can reproduce the connection error locally by over-subscribing the machine. For example, my desktop has 24 logical CPUs, and running 32 workers can cause trouble. In practice, this significantly limits the ability to scale.

Different implementations use different strategies to avoid all-to-all connections. It might be lazy connection, might be a routing table, might be something more sophisticated. The PR picks the easiest one.

By the way the only major user of cpu all gather now seems to be cpu histogram column mode split sharing.

That's great news! Thank you for working on the quantile sketching!

@trivialfis
trivialfis merged commit 03c196f into dmlc:master Mar 12, 2026
78 checks passed
@trivialfis
trivialfis deleted the coll-sparse branch March 12, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants