Pull Request has been successfully merged by CANN-robot.
(Thank you for zl_hw's contribution.)变更摘要
本 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等属性声明均原样保留,仅调整了代码缩进格式,不影响接口语义


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
/approveor/lgtm- Commenting
/approveimplies 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. 👍


流水线任务触发成功
任务链接 [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执行结束


流水线任务触发成功
任务链接 [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 | >>>>> | >>>>> |


流水线任务触发成功
任务链接 [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执行结束


流水线任务触发成功
任务链接 [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执行结束


/approve


/lgtm


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


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


描述
改动原因
ffn/ffn_worker_batching/op_graph/ffn_worker_batching_proto.h存在两个问题:REG_OP未加隔离宏。该原型会被scripts/util/merge_proto.py合并进ops_proto_transformer.h/.cpp再编成内置 op_proto 库;与 canndev 侧同名注册源同处一个编译单元时会重复定义。仓库既有范式是在REG_OP外层加OPS_PROTO_DEF_<OPTYPE>条件编译。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后一行。clang-format不通过。pre-commit 的 clang-format 钩子按整文件格式化(非仅改动行),一旦改动此文件即会被拦,故按.clang-format一并规整为 4 空格缩进。48/44 的差异绝大部分来自这次缩进归一。变更范围:1 个文件,+48 −44。不改动 IR 的输入/输出/属性/dtype 定义,无功能与支持面变化。
关联的Issue
关联 Issue #4590
测试
合并产物验证(
python3 scripts/util/merge_proto.py):修复后 FfnWorkerBatching 的原型与隔离宏都能正确带入
ops_proto_transformer.h。宏名配对验证:与发布包
cann-9.2.0/opp/built-in/op_graph/inc/*.h比对,未发现同名算子的既有隔离宏,无宏名冲突。格式与合规门禁:按
.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 不涉及文档变更。
类型标签