Pull Request已成功合入, 合并人@ascend-robot
(感谢 ascend-robot 的贡献)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 | ✅ wjlflyer, renyujin (2/2) | ✅ wjlflyer (1/1) |
| torch_npu/csrc/distributed | ✅ wjlflyer, renyujin (2/2) | ✅ wjlflyer (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
ascend-ds-bot, thanks for your pull request. All authors of the commits have signed the CLA. 👍


Ascend docs pipeline is running...


✅ 跳过 docs ci 检查,没有需要检查的文档文件


变更摘要
此 PR 同步自上游 PR-38965,核心目的是在 A5(Atlas A5 / Ascend950)机器上调用 div_ 进行集合通信的 AVG 归约时,显式传入 rounding_mode="trunc" 参数,以适配 A5 硬件对整数除法的取整行为差异,确保计算结果正确。改动集中在 ProcessGroupHCCL::_reduce_scatter_base 方法中,同时配套调整了两个分布式测试文件。
主要改动
-
ProcessGroupHCCL::_reduce_scatter_base添加 A5 平台的rounding_mode="trunc":在该函数的后处理回调中,通过GetSocVersion()检测当前是否为 A5(Ascend950 及以上)平台;若是,则对 output tensor 调用tensor.div_(getSize(), "trunc")(使用截断取整),否则沿用原有的tensor.div_(getSize())(默认取整),以确保 AVG 归约在 A5 上产生正确的整数除商结果。 -
测试文件
test_reduce_scatter_tensor.py和test_all_to_all_single.py配套微调:两个测试文件分别有 +11/-7 和 +1/-1 的小幅变更,用于适配上述 C++ 层的取整模式变化,确保分布式reduce_scatter_tensor及相关 all-to-all 单张量通信的测试用例在 A5 平台上验证通过。


compile


Ascend docs pipeline is running...


✅ 跳过 docs ci 检查,没有需要检查的文档文件


| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build_X86 | ✅ | >>> |
| Build_ARM | ✅ | >>> | |
| Build_LibTorch_x86 | ✅ | >>> | |
| Build_LibTorch_ARM | ✅ | >>> | |
| Build_X86_torchair | 🛑 | >>> | |
| Build_ARM_torchair | 🛑 | >>> | |
| patch_test | 🛑 | >>> | |
| 恶意代码检查 | Antipoison | ✅ | >>> |
| 编码安全与规范检查 | CodeCheck | ✅ | >>> |
| check_error | ✅ | >>> | |
| CodeCheck_lintrunner | ✅ | >>> | |
| 开源片段检查 | SCA | ✅ | >>> |
| 开发者测试 | UT_X86_Part_01 | 🛑 | >>> |
| UT_X86_Part_02 | 🛑 | >>> | |
| UT_ARM_A3_Part_01 | 🛑 | >>> | |
| UT_ARM_A3_Part_02 | 🛑 | >>> | |
| UT_ARM_A2_Part_01 | ✅ | >>> | |
| UT_ARM_A2_Part_02 | ✅ | >>> | |
| UT_ARM_A2_Part_03 | ✅ | >>> | |
| UT_inductor_Part_01 | 🛑 | >>> | |
| UT_inductor_Part_02 | 🛑 | >>> | |
| UT_inductor_Part_03 | 🛑 | >>> | |
| UT_inductor_Part_04 | 🛑 | >>> | |
| UT_DIST_ARM_Part_01 | ✅ | >>> | |
| UT_DIST_ARM_Part_02 | ✅ | >>> | |
| UT_DIST_ARM_Part_03 | ✅ | >>> | |
| UT_DIST_ARM_Part_04 | ✅ | >>> | |
| UT_ARM_A2_Select_Part_01 | ✅ | >>> | |
| UT_ARM_A2_Select_Part_02 | ✅ | >>> | |
| 流水线 | PR-pipeline_pytorch | ✅ | >>> |




1. Origin pull request:
https://gitcode.com/Ascend/pytorch/merge_requests/38965
2. Original pull request related issue(s):
https://gitcode.com/Ascend/pytorch/issues/2441
3. Original pull request related commit(s):