已合并
fix(build): 跳过仅有信息库无 op_kernel 的算子的 kernel 编译 #4900
songkai111创建于 15 天前
fix(build): 跳过仅有信息库无 op_kernel 的算子的 kernel 编译 #4900
已合并
Pull Request已成功合入, 合并人@CANN-robot
(感谢 songkai111 的贡献)15 天前 创建了 pull request,commit ec3062e6
atomgit-bot
15 天前 评论:
15 天前 评论:
变更摘要
该 PR 旨在修复构建流程:对于仅有信息库(op info)定义、没有 op_kernel 目录实现(如 bitcast)的算子,跳过其 kernel 二进制编译,避免生成无效的 kernel 编译产物(如 dynamic/Null.py)导致编译失败,并与 get_op_type_and_validate 中关于 op_kernel 目录的判断保持一致。改动同时覆盖 CMake 编译脚本、kernel 二进制清单生成脚本,并顺带补充了格式列表中的一项。
主要改动
- CMake 编译链路跳过无 kernel 算子(
cmake/gen_ops_info.cmake):在gen_ops_info_and_python遍历COMPILED_OP_DIRS时,若${OP_DIR}/op_kernel目录不存在,则打印 INFO 日志并continue()跳过该算子的 kernel 二进制编译。 - kernel 编译清单过滤空实现算子(
scripts/kernel/binary_script/gen_opcinfo_from_opinfo.py):在get_res_from_file中,当op_file为None或取值"null"/"none"时,打印 INFO 日志并continue跳过,避免将仅有信息库定义的算子写入 kernel 二进制编译清单。 - 补充 format 列表项(
scripts/util/parse_ini_to_json.py):在FORMAT_LIST中新增"FRACTAL_NZ_C0_8",使格式枚举与新增格式保持一致。


atomgit-bot
15 天前 评论:
15 天前 评论:
15 天前 添加了label:cann-cla/yes
CANN-robot
15 天前 评论:
15 天前 评论:
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 |
|---|---|---|
| repo-cann/ops-math | ✅ 张磊, 周奇龙 (2/2) | ✅ 张磊, 周奇龙 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
songkai111, thanks for your pull request. All authors of the commits have signed the CLA. 👍


此处折叠了45条消息 查看更多
14 天前 添加了label:approved
13 天前 添加了label:lgtm
13 天前 关闭了关联的issue
13 天前 合入了pull request
描述
--pkg出包模式下编译仅定义算子信息库、没有 kernel 实现的算子(如bitcast)时,kernel 编译链路会报错。本次修改在 kernel 二进制编译阶段跳过这类算子,并补充缺失的算子信息格式支持:改动原因
cmake/gen_ops_info.cmake按 SoC 编译算子的循环中,对不存在op_kernel目录的算子执行find ${OP_DIR}/op_kernel会报"目录不存在"。scripts/util/parse_ini_to_json.py的FORMAT_LIST缺少FRACTAL_NZ_C0_8(CANN 原生支持的ACL_FORMAT_FRACTAL_NZ_C0_8),使用该格式的算子 ops-info 校验不通过。scripts/kernel/binary_script/gen_opcinfo_from_opinfo.py对opFile.value=Null(仅有信息库、无 kernel 实现)的算子会残留dynamic/Null.py条目导致编译失败。改动方法
op_kernel目录的算子直接continue跳过 kernel 二进制编译,与get_op_type_and_validate中已有的op_kernel目录判断保持一致,避免find ${OP_DIR}/op_kernel报目录不存在,并与 cann/ops-nn 仓的既有行为对齐。FORMAT_LIST补充FRACTAL_NZ_C0_8;同时按 ruff 格式重排文件(修复 pre-commit trailing-whitespace/ruff)。opFile.value=Null/None表示算子无 kernel 实现,不再写入 kernel 编译 csv,避免残留dynamic/Null.py条目;同时按 ruff 格式重排(修复 pre-commit ruff)。关联的Issue
测试
本机 CANN 9.1.0 验证:
文档更新
无
类型标签