Merged
fix(ffn_worker_batching): 修复原型未并入合并产物并补 OPS_PROTO_DEF 隔离宏 #10634
fix(ffn_worker_batching): 修复原型未并入合并产物并补 OPS_PROTO_DEF 隔离宏 #10634
Merged
zl_hwAdd on Aug 25
zl_hw
Aug 25

描述

改动原因

ffn/ffn_worker_batching/op_graph/ffn_worker_batching_proto.h 存在两个问题:

  1. REG_OP 未加隔离宏。该原型会被 scripts/util/merge_proto.py 合并进 ops_proto_transformer.h/.cpp 再编成内置 op_proto 库;与 canndev 侧同名注册源同处一个编译单元时会重复定义。仓库既有范式是在 REG_OP 外层加 OPS_PROTO_DEF_<OPTYPE> 条件编译。
  2. REG_OP (FfnWorkerBatching) 多了一个空格,导致该原型根本没进合并产物。merge_proto.py 的匹配式为 ^\s*REG_OP\((?P<opname>.+?)\),要求 REG_OP 后紧跟左括号。实测以 master 版本跑合并,产物中 REG_OP 数为 0 —— FfnWorkerBatching 的 GE IR 一直没有被并入 ops_proto_transformer.h。这条不修的话,隔离宏加了也是空转。

改动方法

  • REG_OP (FfnWorkerBatching) → REG_OP(FfnWorkerBatching),去掉多余空格。
  • REG_OP 外层补 #ifndef/#define OPS_PROTO_DEF_FFNWORKERBATCHING … #endif,位置严格贴在 REG_OP 前、OP_END_FACTORY_REG 后一行。
  • 该文件原为 tab 缩进,整文件 clang-format 不通过。pre-commit 的 clang-format 钩子按整文件格式化(非仅改动行),一旦改动此文件即会被拦,故按 .clang-format 一并规整为 4 空格缩进。48/44 的差异绝大部分来自这次缩进归一。

变更范围:1 个文件,+48 −44。不改动 IR 的输入/输出/属性/dtype 定义,无功能与支持面变化。

关联的Issue

关联 Issue #4590

测试

  1. 合并产物验证(python3 scripts/util/merge_proto.py):

    版本 产物中 REG_OP 数 产物中隔离宏数
    master 0 0
    本 PR 1 1

    修复后 FfnWorkerBatching 的原型与隔离宏都能正确带入 ops_proto_transformer.h。

  2. 宏名配对验证:与发布包 cann-9.2.0/opp/built-in/op_graph/inc/*.h 比对,未发现同名算子的既有隔离宏,无宏名冲突。

  3. 格式与合规门禁:按 .pre-commit-config.yaml 逐钩子本地复现 —— clang-format 18.1.8 --style=file --dry-run -Werror 整文件通过、OAT 许可头合规、trailing-whitespace / end-of-file-fixer / check-merge-conflict / detect-private-key / check-added-large-files 全部通过。

文档更新

无。本 PR 不涉及文档变更。

类型标签

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for zl_hw's contribution.)
Zzl_hw
Aug 25 Created pull request, commit c8beb717
atomgit-bot
atomgit-bot
Aug 25 Comments:

变更摘要

本 PR 针对 ffn_worker_batching 模块的原型头文件进行修复,为算子 FfnWorkerBatching 的 REG_OP 原型定义添加 OPS_PROTO_DEF_FFNWORKERBATCHING 隔离宏,以宏保护的方式包裹算子注册定义,避免在多处包含该头文件时发生重复定义。

主要改动

  • 添加 OPS_PROTO_DEF_FFNWORKERBATCHING 隔离宏:在 ffn/ffn_worker_batching/op_graph/ffn_worker_batching_proto.h 中,使用 #ifndef/#define/#endif 包裹 REG_OP(FfnWorkerBatching) 的完整定义(含各 .INPUT、.OUTPUT、.ATTR 及 .OP_END_FACTORY_REG 调用),确保该原型仅在首次包含时注册
  • 保持算子定义内容不变:schedule_context、y、group_list 等输入输出及 expert_num、max_out_shape 等属性声明均原样保留,仅调整了代码缩进格式,不影响接口语义
likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
Aug 25 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
Aug 25 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
*/*/op_graph/*_proto.h ✅ 王永光, 马兵 (2/2) ✅ 王永光 (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

zl_hw, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robotCANN-robotCollaborators
Aug 25 Set monologue815,jiang-lirui,Allan_Yu,tang-lei01,liudan12,mabing1118,wangyongguang as approver
CANN-robotCANN-robotCollaborators
Aug 25 Set tang-lei01,wangyongguang as approver
zl_hw
Aug 25 Comments:

compile

likedislike
Zzl_hw
Aug 25 Pre merge succeeded (commit_id: 582ceff101e0c75f64ce0ce312ea41eff68fe212)
CANN-robotCANN-robotCollaborators
Aug 25 Added label: ci-pipeline-running
CANN-robot
CANN-robotCollaborators
Aug 25 Comments:

流水线任务触发成功
任务链接 [d6ec04ad6d8640be9e9f792b9f2467a8][流水线指导]

任务名称状态日志下载链接
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Pre ✅ SUCCESS >>>>>
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910b ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910c ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_950 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental_950 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental_950_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_classify ✅ SUCCESS >>>>>
Compile_Ascend_X86_mobile_station_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station ✅ SUCCESS >>>>> >>>>>

[2026-08-25 21:18:09]    CI执行结束

likedislike
CANN-robot
CANN-robotCollaborators
Aug 25 Comments:

流水线任务触发成功
任务链接 [ec50f404461846e7903034c35220854b][流水线指导]

任务名称状态日志下载链接
codecheck ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
codecheck_style ✅ SUCCESS >>>>>
StaticCheck_codespell ✅ SUCCESS
StaticCheck_link_validity ✅ SUCCESS
StaticCheck_resource_existence ✅ SUCCESS
StaticCheck_tag_closed ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
codecheck_checkpr ✅ SUCCESS
codecheck_precommit ❌ FAILED >>>>> >>>>>
likedislike
Zzl_hw
Aug 25 Pre merge succeeded (commit_id: 8b5e0e5e74af5beaba62df9a5ee344b5f70b58d6)
Zzl_hw
Aug 25 Force-pushed 1 commits:928af4ab-fix(ffn_worker_batching): 原型头补 OPS_PROTO_DEF 隔离宏
Zzl_hw
Aug 25 Pre merge succeeded (commit_id: e392199337b9a8e84b141c75a823170ab3a55e23)
CANN-robotCANN-robotCollaborators
Aug 25 Removed label: cann-cla/yes
CANN-robotCANN-robotCollaborators
Aug 25 Added label: cann-cla/yes
zl_hw
Aug 25 Comments:

compile

likedislike
Zzl_hw
Aug 25 Pre merge succeeded (commit_id: 46402f88894cd64b3f3cab5df1209391d8c8ff32)
CANN-robotCANN-robotCollaborators
Aug 25 Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Aug 25 Added label: ci-pipeline-failed
CANN-robotCANN-robotCollaborators
Aug 25 Removed label: ci-pipeline-failed
CANN-robotCANN-robotCollaborators
Aug 25 Added label: ci-pipeline-running
CANN-robot
CANN-robotCollaborators
Aug 25 Comments:

流水线任务触发成功
任务链接 [37cbd96f9fef40da9b3623b677ad1cbc][流水线指导]

任务名称状态日志下载链接
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Pre ✅ SUCCESS >>>>>
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_experimental_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910b ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910c ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_950 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental_950 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_experimental_950 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental_950_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_experimental_950_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_classify ✅ SUCCESS >>>>>
Compile_Ascend_X86_mobile_station_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station_9030_ubuntu24 ✅ SUCCESS >>>>> >>>>>
UT_Test ✅ SUCCESS
PreSmoke_A900 ✅ SUCCESS >>>>>
API_Check ✅ SUCCESS >>>>>
PreSmoke_ATK_Test_A2 ✅ SUCCESS >>>>>
UT_Test_report_lcov ⚠️ WARNING >>>>>

[2026-08-25 21:44:12]    CI执行结束

likedislike
CANN-robot
CANN-robotCollaborators
Aug 25 Comments:

流水线任务触发成功
任务链接 [978f9a28a4ee45908bc92dd7a79f45bb][流水线指导]

任务名称状态日志下载链接
codecheck ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
codecheck_style ✅ SUCCESS >>>>>
StaticCheck_codespell ✅ SUCCESS
StaticCheck_link_validity ✅ SUCCESS
StaticCheck_resource_existence ✅ SUCCESS
StaticCheck_tag_closed ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
codecheck_checkpr ✅ SUCCESS
codecheck_precommit ✅ SUCCESS >>>>>

[2026-08-25 21:24:26]    CI执行结束

likedislike
CANN-robotCANN-robotCollaborators
Aug 25 Added label: api-check-pass
CANN-robotCANN-robotCollaborators
Aug 25 Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Aug 25 Added label: ci-pipeline-passed
TangPCTangPCCollaborators
Aug 26 Change title to "fix(ffn_worker_batching): 修复原型未并入合并产物并补 OPS_PROTO_DEF 隔离宏", originally titled "fix(ffn_worker_batching): 原型头补 OPS_PROTO_DEF 隔离宏".
TangPCTangPCCollaborators
Aug 26 Modify description of pull request
wangyongguangCollaborators
Aug 26 Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
Aug 26 Added label: approved
songkai111Collaborators
Aug 26 Comments:

/lgtm

likedislike
CANN-robot
CANN-robotCollaborators
Aug 26 Comments:

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

likedislike
mabingCollaborators
Aug 26 Comments:

/lgtm

likedislike
CANN-robot
CANN-robotCollaborators
Aug 26 Comments:

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

likedislike
CANN-robotCANN-robotCollaborators
Aug 26 Added label: lgtm
CANN-robotCANN-robotCollaborators
Aug 26 Closed associated issue
CANN-robotCANN-robotCollaborators
Aug 26 Merged pull request