已合并
Add ProcessGroupHCCL::getCollNpuStreamId() to get or create NPU stream by device #34700
limuan创建于 4月29日
Add ProcessGroupHCCL::getCollNpuStreamId() to get or create NPU stream by device #34700
已合并
Pull Request已成功合入, 合并人@ascend-robot
(感谢 limuan 的贡献)ascend-robot
4月29日 评论:
4月29日 评论:
ascend-robot
4月29日 评论:
4月29日 评论:
Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| test | ✅ renyujin, wjlflyer (2/2) | ✅ renyujin (1/1) |
| torch_npu/csrc/distributed | ✅ renyujin, wjlflyer (2/2) | ✅ renyujin (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
limuan, thanks for your pull request. All authors of the commits have signed the CLA. 👍


4月29日 添加了label:ascend-cla/yes
ascend-robot
4月29日 评论:
4月29日 评论:
当前仓库存在以下 保护分支 :
| Protected Branch | Version | Release |
|---|---|---|
| master | ||
| v2.11.0 | ||
| v2.10.0 | ||
| v2.9.0 | ||
| v2.7.1 | ||
| v2.8.0 |
评论 /sync <branch1> <branch2> ... 可将当前 PR 修改同步到其它分支(创建同步 PR):
a) 如果当前 PR 是 Open 状态,同步操作将延迟到 PR 被合并时执行
b) 如果当前 PR 已经 Merged,将立即执行同步操作
注意:
- /sync 命令可以指定同步到多个分支,仅最后一个 /sync 命令生效
- 如果创建的同步 PR 不正确,可通过向同步 PR 的源分支提交轻量级 PR 完善,或使用 /close 命令关闭


此处折叠了45条消息 查看更多
5月13日 添加了label:approvedlgtm
ascend-robot
5月13日 评论:
5月13日 评论:
5月13日 合入了pull request
【合入来源】
https://gitcode.com/Ascend/pytorch/issues/1884
【修改方案】
ProcessGroupHCCL类中新增getCollNpuStreamId(at::Device device)方法。根据 device 参数生成 key,从hcclStreams_map 中查询对应的 NPU stream ID,如果不存在则创建新的 stream。hcclStreams_中存在对应 key 且 stream 列表不为空时,直接返回已有的 stream ID,确保幂等性。hcclStreams_中不存在对应 key 或 stream 列表为空时,从 stream pool 中创建新的 NPU stream,存入hcclStreams_,并返回新创建的 stream ID。options_->is_high_priority_stream或环境变量TORCH_HCCL_HIGH_PRIORITY决定是否创建高优先级 stream。Init.cpp中通过 pybind11 将getCollNpuStreamId暴露为 Python 接口get_coll_npu_stream_id,参数包括device(torch.device),返回值为 int(stream ID)。【资料变更】
不涉及
【接口变更】
新增Python 用户侧接口:
ProcessGroupHCCL.get_p2p_stream_id*接口描述:通过 pybind11 将
getCollNpuStreamId暴露至 Python 层,供用户在分布式训练脚本中直接调用,获取指定设备的集合通信 stream ID 用于 stream 级别的同步与管理。*接口原型:
输入参数:
at::Deviceat::DeviceNPU 设备对象,用于生成 key 和创建 streamint64_t【功能验证】
【CheckList】