已合并
feat: add _group_start and _group_end bindings for ProcessGroupHCCL from v2.7.1 #41510
chansinging创建于 7月13日
feat: add _group_start and _group_end bindings for ProcessGroupHCCL from v2.7.1 #41510
已合并
Pull Request已成功合入, 合并人@ascend-robot
(感谢 chansinging 的贡献)7月13日 创建了 pull request,commit 6da2fc72
atomgit-bot
7月13日 评论:
7月13日 评论:
变更摘要
此 PR 为 ProcessGroupHCCL 的 Python 绑定新增了 _group_start 和 _group_end 两个方法,分别映射到 C++ 的 groupStart 和 groupEnd 成员函数,用于支持 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>(),使其与其余绑定的行为保持一致。


ascend-robot
7月13日 评论:
7月13日 评论:
atomgit-bot
7月13日 评论:
7月13日 评论:
7月13日 添加了label:ascend-cla/yes
此处折叠了382条消息 查看更多
9 天前 添加了label:lgtm
9 天前 添加了label:approved
9 天前 合入了pull request
ascend-robot
9 天前 评论:
9 天前 评论:
流水线 pytorch_gitcode_PR_multiVersion#13907 [ commitID:e90b469a ] 运行失败


【合入来源】
【修改方案】
该需求是将 ProcessGroupHCCL类中已有的groupStart和groupEnd方法通过 PyBind11 暴露给 Python,命名为_group_start和_group_end,对齐 PyTorch 社区 ProcessGroupNCCL 对应接口,允许用户在 Python 侧手动将多个 HCCL 通信操作合并为一个 kernel 下发执行,减少 launch overhead。
【资料变更】
不涉及
【接口变更】
新增
_group_start and _group_endpython侧接口【功能验证】
test_group_send_recv_performance




test_group_all_reduce_relibility
test_group_p2p_reliability用例通过
【CheckList】