已合并
修复自定义算子包安装失败问题 #9026
chenyifan创建于 7月22日
修复自定义算子包安装失败问题 #9026
已合并
Pull Request已成功合入, 合并人@CANN-robot
(感谢 chenyifan 的贡献)atomgit-bot
7月22日 评论:
7月22日 评论:
变更摘要
此 PR 通过引入 ENABLE_BUILT_IN 条件编译宏,修复自定义算子包中 all_gather_matmul、matmul_reduce_scatter 等算子因无法动态获取 rankSize 而导致安装失败的问题。核心思路是将内置包与自定义算子包对 rankSize 的获取行为隔离开:内置包在 rankSize <= 0 时继续通过 CommGetInstSizeByGroup 动态获取,而自定义算子包则直接返回失败,要求用户显式传入有效的 rankSize。
主要改动
- 新增
ENABLE_BUILT_IN条件编译宏:在cmake/obj_func.cmake中,当ENABLE_BUILT_IN启用时向 tiling 目标注入ENABLE_BUILT_IN=1编译定义;在mc2_common_infershape.h中,将mc2_hcom_topo_info.h的引入也置于#if defined(ENABLE_BUILT_IN)保护之下,确保自定义算子包不会包含该头文件。 - 重构
CommonParamCheck并新增ResolveRankSize函数:在mc2_common_infershape.cpp中将CommonParamCheck拆分为多个辅助函数(CheckMatrixInputShapes、ResolveRankSize、FillMatmulDims、CheckKDimMatch)。其中ResolveRankSize通过#if defined(ENABLE_BUILT_IN)分支:内置包调用CommGetInstSizeByGroup动态获取 rank 数量,自定义算子包则打印错误并返回GRAPH_FAILED。 - 回退除兜底方案外的其他逻辑:原
CommonParamCheck中当rankSize <= 0时无条件尝试动态获取的逻辑被移除,改为由ResolveRankSize根据编译宏决定行为,确保自定义算子包场景下不会走入不可用的 HCCL 调用路径。 - 单元测试中
rank_size属性值调整:在all_gather_matmul_v2、matmul_reduce_scatter、matmul_reduce_scatter_v2的 infer shape 单元测试中,将rank_size从0(依赖动态获取)改为显式值8,以匹配自定义算子包需显式传参的新约束。


7月22日 添加了label:cann-cla/yes
CANN-robot
7月22日 评论:
7月22日 评论:
CANN-robot
7月22日 评论:
7月22日 评论:
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
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| ** | ✅ gcw_kUomxQ2l, 刘丹 (2/2) | ✅ gcw_kUomxQ2l (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)


7月22日 将monologue815,jiang-lirui,Allan_Yu,liudan12,jiangtao_rts,gitcode-chenjiao,hanxiaolong,mabing1118,gcw_kUomxQ2l,Andy-lb设为评审人
7月22日 将monologue815,jiang-lirui,Allan_Yu,liudan12,jiangtao_rts,gitcode-chenjiao,hanxiaolong,mabing1118,gcw_kUomxQ2l,Andy-lb设为评审人
7月22日 将jiangtao_rts,gitcode-chenjiao,hanxiaolong,gcw_kUomxQ2l,Andy-lb设为审查人
chenyifan
7月22日 评论:
7月22日 评论:
compile


7月22日 update merge request[project id: 7673863, iid: 9026, commit_id: f03cbadedccd34bc3c9f4dbb5279b8fd53469160] virtual merging success
7月22日 update merge request[project id: 7673863, iid: 9026, commit_id: f03cbadedccd34bc3c9f4dbb5279b8fd53469160] virtual merging success
7月22日 添加了label:ci-pipeline-running
CANN-robot
7月22日 评论:
7月22日 评论:
流水线任务触发成功
任务链接 [c6b0694728844674bd7bb42eac3c3452][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| 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_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_mobile_station | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test | ✅ SUCCESS | ||
| PreSmoke_A900 | ✅ SUCCESS | >>>>> | |
| PreSmoke_ATK_Test_A2 | ✅ SUCCESS | >>>>> |
[2026-07-22 15:06:06] CI执行结束


CANN-robot
7月22日 评论:
7月22日 评论:
流水线任务触发成功
任务链接 [1c3a8fc381714283abf2647faaadf894][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_style | ✅ SUCCESS | >>>>> | |
| StaticCheck_codespell_check | ✅ SUCCESS | ||
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_checkpr | ✅ SUCCESS | ||
| codecheck_precommit | ⚠️ WARNING | >>>>> | >>>>> |
[2026-07-22 14:45:55] CI执行结束


7月22日 删除了label:ci-pipeline-running
7月22日 添加了label:ci-pipeline-passed
liulun0308
7月23日 评论:
7月23日 评论:
/approve


7月23日 添加了label:approved
7月24日 添加了label:lgtm
7月24日 合入了pull request
描述
关联的Issue
测试
文档更新
类型标签