Pull Request has been successfully merged by CANN-robot.
(Thank you for gaoyp's contribution.)变更摘要
本 PR 为构建系统引入 ENABLE_OP_KERNEL 开关,使 --opkernel 单独构建二进制 kernel 的场景不再依赖 ES 包生成流程。build.sh 中新增该变量并在满足「OP_KERNEL 为真、且非打包、非测试」条件时置为 TRUE,再通过 -DENABLE_OP_KERNEL= 透传给 CMake;CMake 侧在依赖查找、add_es_library 与 add_es_library_and_whl 调用及 ES 相关目标链接处增加条件判断,在该开关打开时跳过这些步骤。
主要改动
- 新增
ENABLE_OP_KERNEL构建开关:build.sh初始化ENABLE_OP_KERNEL=FALSE,并在仅--opkernel单独构建(非ENABLE_BUILD_PKG、非ENABLE_TEST)时置为TRUE,其余场景保持FALSE。 - CMake 参数透传:
assemble_cmake_args中新增-DENABLE_OP_KERNEL=${ENABLE_OP_KERNEL},将构建开关传递给 CMake 工程。 - 跳过
GenerateEsPackage查找:cmake/dependencies.cmake在BUILD_WITH_INSTALLED_DEPENDENCY_CANN_PKG分支下用if(NOT ENABLE_OP_KERNEL)包裹find_package(GenerateEsPackage MODULE QUIET)及其FATAL_ERROR检查,开关打开时不再强制要求该包存在。 - 跳过
add_es_library调用:cmake/custom_build.cmake中定制 proto 的add_es_library(... es_transformer_cust ...)整段被if(NOT ENABLE_OP_KERNEL)包裹,单独构建 kernel 时不再生成对应 ES 库与安装规则。 - 跳过
add_es_library_and_whl与 ES graph 链接:cmake/symbol.cmake中gen_es_transformer_lib_builtin的add_es_library_and_whl调用及gen_opgraph_symbol内基于${GRAPH_PLUGIN_NAME}_obj的 ES graph 链接逻辑均被if(NOT ENABLE_OP_KERNEL)包裹,避免单独构建时触发未就绪的 ES 目标。
🧩 本次 Review 已使用自定义 Skill:


Hi @gao19871128, welcome to submitting your first PR to CANN!
PR Merge Steps
1. CLA Signing
If the current PR label includes cann-cla/yes, it means you have signed the CLA and can proceed to the next step. If the label includes cann-cla/no, please sign the CLA first. If you have any questions, please refer to the FAQ.
2. CI Check
Please comment /compile to trigger the CI pipeline check. If the CI run is successful, the PR will be tagged with ci-pipeline-passed and you can proceed to the next step. If the CI run fails, the PR will be tagged with ci-pipeline-failed, please check the CI logs to fix the issues in the PR. If you have any questions, please refer to the FAQ.
3. Code Review
After CI passes, please refer to the PR Approval Progress and proactively @ the committers in the table to review the code. After approval, committers will comment /lgtm and /approve. Once the lgtm and approved labels are successfully added, the PR will be merged automatically.


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 |
|---|---|---|
| CMakeLists.txt | ✅ 蒋礼锐, wang-minbo (2/2) | ✅ 蒋礼锐, wang-minbo (2/1) |
| build.sh | ✅ 蒋礼锐, wang-minbo (2/2) | ✅ 蒋礼锐, wang-minbo (2/1) |
| cmake | ✅ 蒋礼锐, wang-minbo (2/2) | ✅ 蒋礼锐, wang-minbo (2/1) |
| common | ✅ 蒋礼锐, wang-minbo (2/2) | ✅ 蒋礼锐, wang-minbo (2/1) |
| version.cmake | ✅ 蒋礼锐, wang-minbo (2/2) | ✅ 蒋礼锐, wang-minbo (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
gao19871128, thanks for your pull request. All authors of the commits have signed the CLA. 👍


/compile


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


未打上 ci-pipeline-passed 标签,请流水线通过后再提交评审


/compile


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


@xtqh @Allan_Yu @gaoxiang618 @mabing1118 @monologue815 @zzzzzzyf_ @liudan12 @jiang-lirui @wang-minbo
PR流水线通过,验证已ok,请检视代码,打上/lgtm和@approved标签,谢谢


/approve
/lgtm


/lgtm
/approve


描述
fix(cmake): opkernel 单独构建跳过 GenerateEsPackage 与 add_es_library_and_whl
关联的Issue
测试
文档更新
类型标签