已合并
feat(libtorch_npu): add HCCL test case for libtorch_npu #31742
kuhn7创建于 3月12日
feat(libtorch_npu): add HCCL test case for libtorch_npu #31742
已合并
Pull Request已成功合入, 合并人@ascend-robot
(感谢 kuhn7 的贡献)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)


AtlasAccount
3月12日 评论:
3月12日 评论:
3月12日 添加了label:ascend-cla/yes
ascend-robot
3月12日 评论:
3月12日 评论:
AtlasAccount
3月12日 评论:
3月12日 评论:
问题/功能描述
本次PR主要包含三方面内容:一是优化构建脚本,调整头文件复制规则以支持第三方库(ACL/HCCL)并简化分布式目录的匹配;二是新增一个独立的HCCL AllReduce示例程序,用于演示和验证NPU设备上的多进程分布式通信功能;三是进行了一系列代码优化与修复,包括清理冗余的条件编译宏、修正头文件路径、通过条件编译移除调试代码以精简库体积,以及修复分布式HCCL TraceBuffer在多线程环境下潜在的锁竞争问题。
修改方案描述
- 构建与示例:修改
build_libtorch_npu.py脚本,简化了分布式头文件的匹配模式,并新增了对third_party/acl/inc/和third_party/hccl/inc/目录下头文件的复制支持。同时,在examples/libtorch_hccl/目录下新增了完整的HCCL AllReduce示例代码(C++程序、CMake文件、文档和运行脚本)。 - 代码清理与优化:移除了
getMstxHcclMsg函数外冗余的#ifndef BUILD_LIBTORCH条件编译指令,统一了函数逻辑。在另一处代码中,通过#ifndef BUILD_LIBTORCH宏包裹DumpPipe调试结构体的定义,使其在构建LIBTORCH库时不参与编译,以精简依赖和体积,并修正了事件处理相关的头文件引用路径。 - 并发安全修复:调整了
HCCLTraceBuffer::record方法中互斥锁(mutex_)的获取时机,将其移至收集堆栈跟踪信息的操作之后,从而减少锁持有时间,消除潜在的数据竞争风险,提升并发性能。


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#10336 运行失败
| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | 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#10365 运行失败
| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | 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
此处折叠了12条事件消息 查看更多
3月13日 添加了label:ci-pipeline-passed
ascend-robot
3月13日 评论:
3月13日 评论:
流水线 PR-pipeline_pytorch#10429 (重试第5次)已完成
| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | 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 | ✅ | >>> |


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: huangyunlong2022, liwei386.


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