已合并
feat: add _group_start and _group_end bindings for ProcessGroupHCCL from v2.7.1 #41510
feat: add _group_start and _group_end bindings for ProcessGroupHCCL from v2.7.1 #41510
已合并
chansinging创建于 7月13日
chansinging
chansinging成员
7月13日

【合入来源】

如有社区issue,请关联issue链接
请勿携带内部流程信息(需求链接、问题单、内部issue等)

【修改方案】

该需求是将 ProcessGroupHCCL类中已有的groupStart和groupEnd方法通过 PyBind11 暴露给 Python,命名为_group_start和_group_end,对齐 PyTorch 社区 ProcessGroupNCCL 对应接口,允许用户在 Python 侧手动将多个 HCCL 通信操作合并为一个 kernel 下发执行,减少 launch overhead。

【资料变更】

不涉及

【接口变更】

新增 _group_start and _group_end python侧接口

【功能验证】

test_group_send_recv_performance
image.png
image.png
test_group_all_reduce_relibility
image.png
test_group_p2p_reliability用例通过
image.png

【CheckList】

PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 chansinging 的贡献)
chansingingchansinging成员
7月13日 创建了 pull request,commit 6da2fc72
atomgit-bot
atomgit-bot
7月13日 评论:

变更摘要

此 PR 为 ProcessGroupHCCL 的 Python 绑定新增了 _group_start_group_end 两个方法,分别映射到 C++ 的 groupStartgroupEnd 成员函数,用于支持 HCCL 通信组操作的启动与结束控制。同时修复了 _add_ephemeral_timeout 绑定中缺失 py::call_guard<py::gil_scoped_release>() 的问题,确保所有新增及已有绑定在调用期间均释放 GIL。

主要改动

  • 新增 _group_start 绑定:在 torch_npu/csrc/distributed/Init.cpp 中通过 .def("_group_start", &::c10d_npu::ProcessGroupHCCL::groupStart, py::call_guard<py::gil_scoped_release>()) 将 C++ 的 groupStart 方法暴露给 Python,调用时自动释放 GIL。
  • 新增 _group_end 绑定:在同一个 .def 链上追加 .def("_group_end", &::c10d_npu::ProcessGroupHCCL::groupEnd, py::call_guard<py::gil_scoped_release>()),将 C++ 的 groupEnd 方法暴露给 Python,同样带有 GIL 释放守卫。
  • 修复 _add_ephemeral_timeout 缺少 GIL 释放守卫:为已有的 _add_ephemeral_timeout 绑定补全 py::call_guard<py::gil_scoped_release>(),使其与其余绑定的行为保持一致。
likedislike
atomgit-bot
atomgit-bot
7月13日 评论:

代码审查

✅ 未发现问题

likedislike
ascend-robotascend-robot成员
7月13日 添加了label:ascend-cla/yes
此处折叠了382条消息 查看更多
ascend-robotascend-robot成员
9 天前 添加了label:lgtm
renyujin成员
9 天前 评论:

/approve

likedislike
ascend-robotascend-robot成员
9 天前 添加了label:approved
ascend-robotascend-robot成员
9 天前 合入了pull request
ascend-robot
ascend-robot成员
9 天前 评论:
流水线 pytorch_gitcode_PR_multiVersion#13907 [ commitID:e90b469a ] 运行失败
likedislike