Pull Request已成功合入, 合并人@CANN-robot
(感谢 liu-wei 的贡献)compile


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 |
|---|---|---|
| */*/README.md | ✅ 杜慧萍, 陈娇, 周奇龙 (3/2) | ✅ 杜慧萍, 陈娇 (2/1) |
| ** | ✅ 陈娇, gcw_kUomxQ2l, 周奇龙 (3/2) | ✅ 陈娇, gcw_kUomxQ2l (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
liu-wei, thanks for your pull request. All authors of the commits have signed the CLA. 👍


流水线任务触发成功
任务链接 [82d6c323f3874fbba8d07adf4b0a7a76][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_A5 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A5 | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Pre | ✅ SUCCESS | >>>>> | |
| Compile_X86_monitor_910b | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910c | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_950 | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test | ❌ FAILED | ||
| PreSmoke_A900 | ✅ SUCCESS | >>>>> | |
| PreSmoke_ATK_Test_A2 | ✅ SUCCESS | >>>>> |


流水线任务触发成功
任务链接 [b643d045609e4479a35b738734678288][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_checkpr | ✅ SUCCESS | ||
| StaticCheck_codespell_check | ✅ SUCCESS | ||
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_codestyle | ✅ SUCCESS | >>>>> | |
| codecheck_precommit | ✅ SUCCESS | >>>>> | >>>>> |
[2026-07-02 15:46:49] CI执行结束


变更摘要
本次重构将示例项目中的环境变量与 CMake 变量从 NPU_ARCH 重命名为 NPU_SOC_VERSION,并在 setup.py 中保留了对旧变量 NPU_ARCH 的向后兼容支持,同时输出弃用提示。这一改动主要影响 fast kernel 启动示例的构建配置流程。
主要改动
- CMake 宏变量重命名:在
func.cmake的recursive_add_subdirectory宏中,将${NPU_ARCH}替换为${NPU_SOC_VERSION},使子目录查找逻辑使用新变量名。 - 构建脚本变量优先级调整:在
setup.py中,优先读取环境变量NPU_SOC_VERSION;若未设置则回退到已弃用的NPU_ARCH,并在检测到NPU_ARCH时输出"NPU_ARCH is deprecated, please use NPU_SOC_VERSION."的日志提示。 - CMake 传参更新:
setup.py中调用 CMake 配置时,将-DNPU_ARCH=参数改为-DNPU_SOC_VERSION=,确保与新变量名保持一致。


compile


流水线任务触发成功
任务链接 [3dc3428644154758863d1e5436aef559][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_A5 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A5 | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Pre | ✅ SUCCESS | >>>>> | |
| Compile_X86_monitor_910b | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910c | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_harmony-infer-chs-cv | ✅ SUCCESS | >>>>> | |
| UT_Test | ✅ SUCCESS | ||
| PreSmoke_A900 | ✅ SUCCESS | >>>>> | |
| PreSmoke_ATK_Test_A2 | ✅ SUCCESS | >>>>> |
[2026-07-07 09:37:56] CI执行结束


流水线任务触发成功
任务链接 [908a21e9e1534cf1b511e804a692b8a9][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_checkpr | ✅ SUCCESS | ||
| StaticCheck_codespell_check | ✅ SUCCESS | ||
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_codestyle | ✅ SUCCESS | >>>>> | |
| codecheck_precommit | ✅ SUCCESS | >>>>> | >>>>> |
[2026-07-07 09:21:48] CI执行结束


/lgtm
/approve


The following users do not have permission to comment /lgtm or /approve on any module in this PR:
ZhaiPeiChao


The following users do not have permission to comment /lgtm or /approve on any module in this PR:
ZhaiPeiChao


/approve


The following users do not have permission to comment /lgtm or /approve on any module in this PR:
ZhaiPeiChao


The following users do not have permission to comment /lgtm or /approve on any module in this PR:
ZhaiPeiChao


The following users do not have permission to comment /lgtm or /approve on any module in this PR:
ZhaiPeiChao


The following users do not have permission to comment /lgtm or /approve on any module in this PR:
ZhaiPeiChao


The following users do not have permission to comment /lgtm or /approve on any module in this PR:
王林木, ZhaiPeiChao


/approve


The following users do not have permission to comment /lgtm or /approve on any module in this PR:
王林木, ZhaiPeiChao


描述
examples/fast_kernel_launch_example/里有两处需要改造,合并到同一个重构 PR:改动 A:
NPU_ARCH重命名为NPU_SOC_VERSIONPyTorch 官方
torch_npu的同名环境变量NPU_ARCH在新版本里被复用为昇腾 SOC 版本号,原本"扩展模块编译目标架构"的语义已发生迁移。继续使用旧名容易在用户 shell / CI 环境里跟torch_npu的同名变量直接撞车。统一改成NPU_SOC_VERSION更贴合"芯片型号"的语义。向后兼容策略:
NPU_ARCH仍可读取,仅打印 deprecation 日志NPU_SOC_VERSION时优先使用,识别不到再回退到NPU_ARCH改动 B:README 文档同步 + sample code polish
NPU_SOC_VERSION三种芯片档位说明(Atlas A2 →ascend910b、Atlas A3 →ascend910_93、Ascend 950PR/950DT →ascend950)NPU_ARCH文档标注为 deprecated 但仍兼容blockDim变量名改为numBlocks(语义更直接),→,跟中文文档风格统一变更清单
CMakeLists.txt(+10/-2)NPU_ARCH的 cache 读取逻辑替换为NPU_SOC_VERSION+ fallback(NPU_ARCH仍能识别,fallback 到ascend910b)cmake/func.cmake(+2/-2)recursive_add_subdirectory宏变量引用从NPU_ARCH改成NPU_SOC_VERSIONsetup.py(+8/-4)CMakeBuildCommand的环境变量读取迁移,并加 deprecation 日志-DNPU_ARCH=...改为-DNPU_SOC_VERSION=...README.md(+8/-6)NPU_SOC_VERSIONenv 文档 + 三种芯片档位映射关联的Issue
测试
新变量生效:
cd examples/fast_kernel_launch_example export NPU_SOC_VERSION=ascend910_93 python3 -m build --wheel -n ls dist/*.whl # 期望:构建成功,cp tag 跟当前 python 版本一致旧变量兼容 + deprecation 日志:
unset NPU_SOC_VERSION export NPU_ARCH=ascend910b python3 -m build --wheel -n # 期望:构建成功,setup.py 日志里看到 "NPU_ARCH is deprecated, please use NPU_SOC_VERSION."多 Python 版本验证(cp39 / cp310 / cp311):
for py in 3.9 3.10 3.11; do python$py -m venv venv-$py && source venv-$py/bin/activate python3 -m build --wheel -n ls dist/*.whl # cp tag 应与 python$py --version 一致 deactivate done回退验证:
ascend910bNPU_SOC_VERSION优先文档更新
本 PR 本身就是 README 文档改动的一部分。其他无。
类型标签