Skip to content

Improve Python bootstrap thread and process-group handling - #889

Open
Binyang Li (Binyang2014) wants to merge 3 commits into
mainfrom
qinghuazhou/bootstrap-gil-release
Open

Improve Python bootstrap thread and process-group handling#889
Binyang Li (Binyang2014) wants to merge 3 commits into
mainfrom
qinghuazhou/bootstrap-gil-release

Conversation

@Binyang2014

@Binyang2014 Binyang Li (Binyang2014) commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • release the Python GIL around both pointer and vector bootstrap send/recv bindings
  • broadcast bootstrap unique IDs through the specified Torch process group instead of a fixed-size serialized tensor
  • rely on Torch to select the process-group-compatible broadcast device

This isolates the non-EP bootstrap changes from #852.

Validation

  • ./tools/lint.sh
  • cmake --build build --target mscclpp_py -j$(nproc)
  • python3 -m py_compile python/mscclpp/_core/comm.py

Allow other Python threads to make progress while blocking bootstrap point-to-point operations are in flight.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Binyang Li (Binyang2014) added a commit that referenced this pull request Aug 27, 2026
The bootstrap binding update is now isolated in PR #889 so the EP implementation PR no longer carries this unrelated core change.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use a group-aware object broadcast on the backend-compatible device instead of a fixed-size serialized tensor.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Binyang2014 Binyang Li (Binyang2014) changed the title Release Python GIL during bootstrap send and recv Improve Python bootstrap thread and process-group handling Aug 27, 2026
Let broadcast_object_list choose CUDA for NCCL process groups and CPU for other backends instead of duplicating that logic.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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

Updates Python bootstrap communication for safer threading and Torch subgroup support.

Changes:

  • Releases the Python GIL during blocking bootstrap send/receive operations.
  • Broadcasts unique IDs through the supplied Torch process group.
  • Removes fixed-size serialization logic.

Reviewed changes

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

File Description
python/mscclpp/_core/comm.py Uses Torch object broadcast with subgroup-aware root mapping.
python/csrc/core_py.cpp Releases the GIL around bootstrap send/receive bindings.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +56 to +57
group_root = dist.get_global_rank(torch_group, 0)
dist.broadcast_object_list(object_list, src=group_root, group=torch_group)
Comment thread python/csrc/core_py.cpp
self->send(data, size, peer, tag);
},
nb::arg("data"), nb::arg("size"), nb::arg("peer"), nb::arg("tag"))
nb::arg("data"), nb::arg("size"), nb::arg("peer"), nb::arg("tag"), nb::call_guard<nb::gil_scoped_release>())
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.

2 participants