Pull Request has been successfully merged by CANN-robot.
(Thank you for HuangRZzzz's contribution.)变更摘要
本 PR 修复了在执行 bash build.sh -u --opkernel --ops=add_example 时,examples 下的 kernel UT 用例未被注册、没有任何用例运行的问题。核心原因是 cmake/func.cmake 中 add_category_subdirectory() 在算子循环之外单独加载 examples 时,宏作用域内的 OP_DIR 与 OP_NAME 仍保留循环最后一次的算子目录,导致 AddOpTestCase 复用了错误目录,并在 --ops 过滤时提前 return(),用例注册因此被静默跳过;同时在 add_example 的 UT 配置中补齐了缺失的 SOC 版本注册,使 A2/A3/950 的用例都能被正确构建与执行。
主要改动
- 清理残留的算子目录变量:在
add_category_subdirectory()中add_subdirectory(examples)之前新增unset(OP_DIR)与unset(OP_NAME),避免examples继承算子循环最后一轮的目录与名称而误过滤用例。 - 恢复
AddOpTestCase用例注册:变量清理后,examples下的AddOpTestCase不再错误匹配--ops过滤条件,kernel UT 能够正常注册并生成可执行用例。 - 补齐
add_exampleUT 的 SOC 注册:examples/add_example/tests/ut/op_kernel/CMakeLists.txt增加Ascend910_9391(A3,需与 tikicpulib 目标名大小写一致)与ascend950pr_9599(950)两个 SOC 版本,与add_example_def.cpp中的AddConfig及 README 声明的 A2/A3/950 支持范围对齐。
🧩 本次 Review 已使用自定义 Skill:




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.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| cmake | ✅ 刘波, 杨阳 (2/2) | ✅ 刘波, 杨阳 (2/1) |
| repo-cann/ops-nn | ✅ 刘波, 杨阳 (2/2) | ✅ 刘波, 杨阳 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
HuangRZzzz, thanks for your pull request. All authors of the commits have signed the CLA. 👍


compile


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


compile


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


您好,pr合入已准备就绪,请尽快联系committer进行检视,谢谢!
@chaotang233 @yangyang016 @sxb154714 @LinPX @fanqirui @liubo75 @pingchuantang @zengjuan


/lgtm
/approve
by agent


/lgtm
/approve


描述
修复
bash build.sh -u --opkernel --ops=add_example无任何 UT 用例运行的问题(#8321):cmake/func.cmake:add_category_subdirectory()中 examples 在算子循环外通过add_subdirectory(examples)加载时,宏作用域内OP_DIR/OP_NAME仍残留循环最后一次的算子目录,导致 examples 下AddOpTestCase误用该目录、在--ops过滤时提前return(),用例注册被静默跳过(所有 SOC 均受影响)。在add_subdirectory(examples)前unset(OP_DIR)/unset(OP_NAME)。examples/add_example/tests/ut/op_kernel/CMakeLists.txt:注册补齐Ascend910_9391(A3,注意 tikicpulib 目标名大小写)与ascend950pr_9599(950),与add_example_def.cpp的AddConfig、README 声明的 A2/A3/950 支持范围一致。关联的Issue
https://gitcode.com/cann/ops-nn/issues/8321
测试
bash build.sh -u --opkernel --ops=add_example --soc=ascend910_93 -j40→fastOpTestSocVersions为空、无 UT 可执行文件、无用例执行(CANN 9.2.0 / aarch64 / master b5949092)。--soc=ascend910_93→fastOpTestSocVersions=Ascend910_9391,[ PASSED ] 1 test;--soc=ascend910b→ascend910B1,PASS;--soc=ascend950→ascend950pr_9599,PASS。文档更新
无。
类型标签
AI/Agent生成声明