已合并
feat(libtorch_npu): add HCCL test case for libtorch_npu #31743
kuhn7创建于 3月12日
feat(libtorch_npu): add HCCL test case for libtorch_npu #31743
已合并
Pull Request已成功合入, 合并人@ascend-robot
(感谢 kuhn7 的贡献)AtlasAccount
3月12日 评论:
3月12日 评论:
ascend-robot
3月12日 评论:
3月12日 评论:
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 |
|---|---|---|
| repo-Ascend/pytorch | ✅ liwei386, huangyunlong2022 (2/2) | ✅ liwei386 (1/1) |
| torch_npu/csrc/distributed | ✅ liwei386, huangyunlong2022 (2/2) | ✅ liwei386 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)


3月12日 添加了label:ascend-cla/yes
ascend-robot
3月12日 评论:
3月12日 评论:
AtlasAccount
3月12日 评论:
3月12日 评论:
问题/功能描述
本次PR主要包含三个方面的修改:一是优化构建脚本,调整头文件复制规则以支持第三方库并移除冗余递归;二是新增一个独立的HCCL集合通信示例,用于验证NPU设备上的ProcessGroupHCCL功能;三是对现有代码进行了一系列优化和修复,包括移除冗余的条件编译宏、通过条件编译优化调试功能以提升libtorch的纯净度、以及修复分布式跟踪记录功能中潜在的线程安全问题。
修改方案描述
- 构建脚本与示例代码:修改了
build_libtorch_npu.py中的copy_hpp函数,将递归复制模式替换为精确的第三方库头文件路径。同时,新增了examples/libtorch_hccl目录,包含完整的HCCL AllReduce测试用例(C++代码、CMakeLists、运行脚本和文档)。 - 代码优化与清理:移除了
getMstxHcclMsg函数中重复的#ifndef BUILD_LIBTORCH条件编译宏,简化了代码结构。 - 条件编译优化:通过
#ifndef BUILD_LIBTORCH宏将调试功能DumpPipe结构体的定义包裹起来,确保在构建libtorch库时不编译此调试依赖,并更新了相关事件头文件的引用路径。 - 线程安全修复:调整了
HCCLTraceBuffer::record方法中互斥锁的获取时机,将其提前至收集堆栈跟踪信息之前,从而消除了多线程并发访问时的数据竞争风险。


3月12日 添加了label:ci-pipeline-running
3月12日 删除了label:ci-pipeline-running
3月12日 添加了label:ci-pipeline-failed
ascend-robot
3月12日 评论:
3月12日 评论:
流水线 PR-pipeline_pytorch#10337 运行失败
| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build_X86 | ✅ | >>> |
| Build_LibTorch | ✅ | >>> | |
| Build_ARM | ✅ | >>> | |
| Build_ARM_inductor | 🛑 | >>> | |
| Build_X86_torchair | 🛑 | >>> | |
| Build_ARM_torchair | 🛑 | >>> | |
| 恶意代码检查 | Antipoison | ✅ | >>> |
| 编码安全与规范检查 | CodeCheck | ✅ | >>> |
| check_error | ✅ | >>> | |
| 开源片段检查 | SCA | ✅ | >>> |
| 开发者测试 | UT_X86_Part_01 | 🛑 | >>> |
| UT_X86_Part_02 | 🛑 | >>> | |
| UT_ARM_A3_Part_01 | 🛑 | >>> | |
| UT_ARM_A3_Part_02 | 🛑 | >>> | |
| UT_DIST_X86_Part_01 | ✅ | >>> | |
| UT_DIST_X86_Part_02 | ✅ | >>> | |
| UT_DIST_X86_Part_03 | ❌ | >>> | |
| UT_DIST_X86_Part_04 | ❌ | >>> | |
| UT_inductor_Part_01 | 🛑 | >>> | |
| UT_inductor_Part_02 | 🛑 | >>> | |
| UT_inductor_Part_03 | 🛑 | >>> | |
| UT_inductor_Part_04 | 🛑 | >>> | |
| UT_ARM_A2_Part_01 | ❌ | >>> | |
| UT_ARM_A2_Part_02 | ❌ | >>> | |
| 流水线 | PR-pipeline_pytorch | ❌ | >>> |


3月13日 删除了label:ci-pipeline-failed
3月13日 添加了label:ci-pipeline-running
3月13日 删除了label:ci-pipeline-running
3月13日 添加了label:ci-pipeline-failed
ascend-robot
3月13日 评论:
3月13日 评论:
流水线 PR-pipeline_pytorch#10366 运行失败
| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build_X86 | ✅ | >>> |
| Build_LibTorch | ✅ | >>> | |
| Build_ARM | ✅ | >>> | |
| Build_ARM_inductor | 🛑 | >>> | |
| Build_X86_torchair | 🛑 | >>> | |
| Build_ARM_torchair | 🛑 | >>> | |
| 恶意代码检查 | Antipoison | ✅ | >>> |
| 编码安全与规范检查 | CodeCheck | ✅ | >>> |
| check_error | ✅ | >>> | |
| 开源片段检查 | SCA | ✅ | >>> |
| 开发者测试 | UT_X86_Part_01 | 🛑 | >>> |
| UT_X86_Part_02 | 🛑 | >>> | |
| UT_ARM_A3_Part_01 | 🛑 | >>> | |
| UT_ARM_A3_Part_02 | 🛑 | >>> | |
| UT_DIST_X86_Part_01 | ❌ | >>> | |
| UT_DIST_X86_Part_02 | ✅ | >>> | |
| UT_DIST_X86_Part_03 | ❌ | >>> | |
| UT_DIST_X86_Part_04 | ✅ | >>> | |
| UT_inductor_Part_01 | 🛑 | >>> | |
| UT_inductor_Part_02 | 🛑 | >>> | |
| UT_inductor_Part_03 | 🛑 | >>> | |
| UT_inductor_Part_04 | 🛑 | >>> | |
| UT_ARM_A2_Part_01 | ✅ | >>> | |
| UT_ARM_A2_Part_02 | ❌ | >>> | |
| 流水线 | PR-pipeline_pytorch | ❌ | >>> |


3月13日 删除了label:ci-pipeline-failed
3月13日 添加了label:ci-pipeline-running
3月13日 删除了label:ci-pipeline-running
3月13日 添加了label:ci-pipeline-failed
ascend-robot
3月13日 评论:
3月13日 评论:
流水线 PR-pipeline_pytorch#10428 运行失败
| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build_X86 | ✅ | >>> |
| Build_LibTorch | ✅ | >>> | |
| Build_ARM | ✅ | >>> | |
| Build_ARM_inductor | 🛑 | >>> | |
| Build_X86_torchair | 🛑 | >>> | |
| Build_ARM_torchair | 🛑 | >>> | |
| 恶意代码检查 | Antipoison | ✅ | >>> |
| 编码安全与规范检查 | CodeCheck | ✅ | >>> |
| check_error | ✅ | >>> | |
| 开源片段检查 | SCA | ✅ | >>> |
| 开发者测试 | UT_X86_Part_01 | 🛑 | >>> |
| UT_X86_Part_02 | 🛑 | >>> | |
| UT_ARM_A3_Part_01 | 🛑 | >>> | |
| UT_ARM_A3_Part_02 | 🛑 | >>> | |
| UT_DIST_X86_Part_01 | ✅ | >>> | |
| UT_DIST_X86_Part_02 | ✅ | >>> | |
| UT_DIST_X86_Part_03 | ✅ | >>> | |
| UT_DIST_X86_Part_04 | ✅ | >>> | |
| UT_inductor_Part_01 | 🛑 | >>> | |
| UT_inductor_Part_02 | 🛑 | >>> | |
| UT_inductor_Part_03 | 🛑 | >>> | |
| UT_inductor_Part_04 | 🛑 | >>> | |
| UT_ARM_A2_Part_01 | ✅ | >>> | |
| UT_ARM_A2_Part_02 | ✅ | >>> | |
| 流水线 | PR-pipeline_pytorch | ❌ | >>> |


3月13日 删除了label:ci-pipeline-failed
3月13日 添加了label:ci-pipeline-passed
huangyunlong
3月14日 评论:
3月14日 评论:
/lgtm


3月14日 添加了label:approvedlgtm
ascend-robot
3月14日 评论:
3月14日 评论:
Review Guide
This pull-request passes review.
Committers who wrote a comment of /approve are: liwei386.
Reviewers who wrote a comment of /lgtm are: liwei386, huangyunlong2022.


3月14日 合入了pull request
【合入来源】
【修改方案】
【资料变更】
【接口变更】
【功能验证】
【CheckList】