Merged
fix(cmake): opkernel 单独构建跳过 GenerateEsPackage 与 add_es_library_and_whl #15126
gaoypAdd on 7 days ago
fix(cmake): opkernel 单独构建跳过 GenerateEsPackage 与 add_es_library_and_whl #15126
Merged
gaoypAdd on 7 days ago
Merged fromDeleted :masterintocann/ops-transformermaster
gaoyp
gaoyp
7 days ago

描述

fix(cmake): opkernel 单独构建跳过 GenerateEsPackage 与 add_es_library_and_whl

关联的Issue

测试

文档更新

类型标签

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for gaoyp's contribution.)
gaoypgaoyp
7 days ago Created pull request, commit f0d4f577
atomgit-bot
atomgit-bot
7 days ago Comments:

变更摘要

本 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:

likedislike
Incorrect?
CANN-robot
CANN-robotCollaborators
7 days ago Comments:

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.

likedislike
CANN-robotCANN-robotCollaborators
7 days ago Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
7 days ago Comments:

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 /approve or /lgtm
  • Commenting /approve implies 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. 👍

likedislike
CANN-robotCANN-robotCollaborators
7 days ago Set monologue815,jiang-lirui,Allan_Yu,wang-minbo,xtqh,liudan12,gaoxiang618,mabing1118,zzzzzzyf_ as approver
CANN-robotCANN-robotCollaborators
7 days ago Set monologue815,jiang-lirui,Allan_Yu,wang-minbo,xtqh,liudan12,gaoxiang618,mabing1118,zzzzzzyf_ as approver
gaoyp
gaoyp
7 days ago Comments:

/compile

likedislike
gaoypgaoyp
7 days ago Pre merge succeeded (commit_id: ff2274e9ab54dc80be47dcac7696a0d4756896b4)
CANN-robot
CANN-robotCollaborators
7 days ago Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
7 days ago Added label: ci-pipeline-running
8 event messages are collapsed here。 See more
CANN-robotCANN-robotCollaborators
7 days ago Removed label: ci-pipeline-passed
CANN-robot
CANN-robotCollaborators
7 days ago Comments:

Notification

This pull request has been changed(code update) or closed, so removes the following label(s): ci-pipeline-passed.

likedislike
gaoypgaoyp
6 days ago Pre merge succeeded (commit_id: 4dd64df73bc5f7d8b67443298732b05b82c94e37)
gaoypgaoyp
6 days ago Pushed 1 commits:3d10b9c9-fix(cmake): prepare.sh 嵌套构建透传 ENABLE_OP_KERNEL
gaoypgaoyp
6 days ago Pre merge succeeded (commit_id: 758bb140a007afa8ad6abb168406adf1e43ba030)
CANN-robotCANN-robotCollaborators
6 days ago Removed label: cann-cla/yes
CANN-robotCANN-robotCollaborators
6 days ago Added label: cann-cla/yes
wang-minboCollaborators
6 days ago Comments:

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

likedislike
gaoyp
gaoyp
6 days ago Comments:

/compile

likedislike
gaoypgaoyp
6 days ago Pre merge succeeded (commit_id: 300938438664b8d63e3942ab1439b2603ce0520b)
CANN-robot
CANN-robotCollaborators
6 days ago Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
6 days ago Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
6 days ago Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
6 days ago Added label: ci-pipeline-passed
gaoyp
gaoyp
6 days ago Comments:

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

likedislike
jiang-liruiCollaborators
6 days ago Comments:

/approve
/lgtm

likedislike
CANN-robotCANN-robotCollaborators
6 days ago Added label: approved
gaoypgaoyp
6 days ago Associated issue: [Bug-Report|缺陷反馈]: --opkernel模式下会编译无关的es相关内容
wang-minboCollaborators
6 days ago Comments:

/lgtm
/approve

likedislike
CANN-robotCANN-robotCollaborators
6 days ago Added label: lgtm
CANN-robotCANN-robotCollaborators
6 days ago Closed associated issue
CANN-robotCANN-robotCollaborators
6 days ago Merged pull request