Pull Request已成功合入, 合并人@ascend-robot
(感谢 chz34 的贡献)变更摘要
此 PR 将项目中所有显式指定的 C++ 编译标准从 -std=c++17 统一升级为 -std=c++20,涉及示例扩展模块的构建脚本、Inductor NPU 编译器后端、自定义算子编译器及其单元测试等 8 个文件,变更均为编译标志字符串的版本号替换。
主要改动
- 示例模块
setup.py编译标志升级:examples/_kernel_extension_aclgraph/pybind/setup.py和torch_library/setup.py中的AscendBuildExtension将 g++ 编译参数-std=c++17替换为-std=c++20。 - Inductor NPU 编译器后端升级:
experimental/_inductor_npu_ext下的revert_ascir.py(AscCompilerStub类的三处 g++ 命令)与_compiler.py(_build_cpp、compile_wrapper、compile_tiling_wrapper函数)均将-std=c++17改为-std=c++20。 - 自定义算子编译器升级:
python/torchair/_ge_concrete_graph/custom_op_compiler.py中build_gcc_command函数将编译标志从-std=c++17改为-std=c++20。 - 单元测试同步更新:
tests/st/torchair_customop_compiler_st.py中TestBuildGccCommand的断言字符串同步从-std=c++17更新为-std=c++20,保持测试与实现一致。


CLA Signature Guide
@c_34 , thanks for your pull request.
The following commit(s) have not signed Contributor License Agreement (CLA).
| Commit | Reason |
|---|---|
| 387f115e build: 升级C++编译标准至c... | the email is not signed for CLA! please check if it is correct and the same as your signed email. |
If you need to sign CLA, you can click here to sign the CLA.
If you need to check if the email is set up correctly, you can click here to do it in the FAQs.
After signing the CLA or updating the email, you must comment /check-cla to check the CLA status again.


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/torchair | ✅ fu-hao-huawei, XDaoHong (2/2) | ✅ fu-hao-huawei (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
c_34, thanks for your pull request. All authors of the commits have signed the CLA. 👍


ascend docs pipeline is running...


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


| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build_x86 | ✅ | >>> |
| Build_ARM | ✅ | >>> | |
| 开发者测试 | smoke | ✅ | >>> |
| 流水线 | PR-pipeline_torchair_smoke | ✅ | >>> |
- smoke : 运行流水线


smoke


ascend docs pipeline is running...


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


| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build_x86 | ✅ | >>> |
| Build_ARM | ✅ | >>> | |
| 开发者测试 | smoke | ✅ | >>> |
| 流水线 | PR-pipeline_torchair_smoke | ✅ | >>> |
- smoke : 运行流水线


compile


ascend docs pipeline is running...


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


| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build_x86 | ✅ | >>> |
| Build_ARM | ✅ | >>> | |
| 恶意代码检查 | Antipoison | ✅ | >>> |
| 编码安全与规范检查 | CodeCheck | ✅ | >>> |
| CodeCheck_pre-commit | ✅ | >>> | |
| 开源片段检查 | SCA | ✅ | >>> |
| 流水线 | PR-pipeline_torchair | ✅ | >>> |
- compile : 运行流水线
- retry : 重试流水线所有失败子任务
- retry <任务名> : 仅重试指定失败子任务
- stop : 停止流水线


/approve


/lgtm


【MR评价】评价分数:3,
评价意见:
编码规范遵守度:无编码规范问题;
代码设计:不涉及代码设计;
DT质量:不涉及;


背景
新版 PyTorch 头文件强制要求 C++20,torchair 仍以 C++17 编译时,构建 torch_npu 目标报错:
ATen/ATen.h:5: #error C++20 or later compatible compiler is required to use ATen.
torch/all.h:5: #error C++20 or later compatible compiler is required to use PyTorch.
torch_npu_stub.cpp 经 GetCANNInfo.h 引入 torch 头,因编译标准为 C++17 触发上述 #error。
改动