Pull Request已成功合入, 合并人@CANN-robot
(感谢 JacsonPile 的贡献)变更摘要
本 PR 修复 AutoFuse BroadcastReduceEliminationPass 消除 Broadcast/Tile + Reduce 模式后替换生成的 Reshape 节点结构不完整、输出 shape 描述不一致的问题。原实现手工创建 Reshape OpDesc,仅连接数据输入并通过 shape 属性记录目标 shape,输出描述由输入描述复制而来、只更新 GeShape,导致 OriginShape 与 symbolic shape 可能仍保留原输入 rank,触发后续 Concat 符号 shape 推导报 input_3_dim_num(2) != first_input_dim_num(3)。本次改为按 Reshape 算子原型创建 data + shape 双输入,目标 shape 由 DT_INT64 Const 节点提供并接入第二个输入,同时将输出的 GeShape、OriginShape 与 SymbolicDescAttr.origin_symbol_shape 同步为同一目标 shape,并补充相应 UT 校验。
主要改动
- Reshape 双输入结构:
CreateReshapeNode按原型通过AddInputDesc("x", ...)与AddInputDesc("shape", ...)创建数据与 shape 两个输入,目标 shape 由CreateConstOpZeroCopy生成的DT_INT64Const 节点提供,并经GraphUtils::AddEdge连接到 Reshape 第二个数据输入。 - 输出 shape 描述同步: 输出描述同时设置
GeShape与OriginShape,并将SymbolicDescAttr的symbolic_tensor.MutableOriginSymbolShape()按目标 shape 各维度构造为Symbol(dim)表达式,保证静态与符号描述的 rank 一致。 - 移除 shape 属性写法: 删除
kAttrNameShape常量及AttrUtils::SetListInt设置shape属性的逻辑,目标 shape 改由输入 Const 节点承载,并新增kOpTypeReshape常量与attr_group_symbolic_desc.h头文件依赖。 - UT 校验增强: 扩展
BroadcastReduceMax_EliminateWithSqueeze用例,断言 Reshape 双输入、shape Const 的DT_INT64类型与取值、GeShape/OriginShape/symbolic shape 三类描述的一致性,以及data -> Reshape -> relu数据边连接,并补充NodeUtils等直接头文件依赖。


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.
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 |
|---|---|---|
| repo-cann/ge | ✅ 张德鹏, 盛楠, wangxiaotian995 (3/2) | ✅ 张德鹏 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
JacsonPile, thanks for your pull request. All authors of the commits have signed the CLA. 👍


compile


流水线任务触发成功
任务链接 [b5c812619c48486aa4dcf0b5dbaa990f][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_ARM_compiler | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_ARM_executor | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_ARM_dflow | ✅ SUCCESS | >>>>> | >>>>> |
| API_Check | ✅ SUCCESS | >>>>> | |
| PreSmoke_A900_npupool | ✅ SUCCESS | >>>>> |
[2026-08-20 12:45:01] CI执行结束


流水线任务触发成功
任务链接 [d053cb33e61040fab896b9f600fbfc1d][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_X86_compiler | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_executor | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_dflow | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test_dflow | ✅ SUCCESS | ||
| UT_Test_ge_common | ✅ SUCCESS | ||
| UT_Test_parser | ✅ SUCCESS | ||
| UT_Test_python | ✅ SUCCESS | >>>>> | |
| UT_Test_rt | ✅ SUCCESS | ||
| UT_Test_acl | ✅ SUCCESS | ||
| UT_Test_autofuse | ✅ SUCCESS | ||
| UT_Test_executor | ✅ SUCCESS | ||
| UT_Test_autofuse_ascendc_api | ✅ SUCCESS | ||
| ST_Test_dflow | ✅ SUCCESS | ||
| ST_Test_ge_common | ✅ SUCCESS | ||
| ST_Test_parser | ✅ SUCCESS | ||
| ST_Test_python | ✅ SUCCESS | >>>>> | |
| ST_Test_rt | ✅ SUCCESS | ||
| ST_Test_autofuse | ✅ SUCCESS | ||
| ST_Test_executor | ✅ SUCCESS | ||
| ST_Test_hetero | ✅ SUCCESS | ||
| ST_Test_autofuse_ascendc_api | ✅ SUCCESS | ||
| ST_Test_autofuse_e2e | ✅ SUCCESS | ||
| UT_Test_fe | ✅ SUCCESS | ||
| UT_Test_tefusion | ✅ SUCCESS | ||
| ST_Test_fe | ✅ SUCCESS | ||
| ST_Test_tefusion | ✅ SUCCESS | ||
| ST_Test_ge_common_atc | ✅ SUCCESS | ||
| UT_Test_Report_graphengine | ✅ SUCCESS | >>>>> | |
| UT_Test_Report_ge_executor_c | ✅ SUCCESS | >>>>> | |
| UT_Test_Report_ge_autofuse | ✅ SUCCESS | >>>>> | |
| ST_Test_Report_graphengine | ✅ SUCCESS | >>>>> | |
| ST_Test_Report_ge_executor_c | ✅ SUCCESS | >>>>> | |
| ST_Test_Report_ge_autofuse | ✅ SUCCESS | >>>>> | |
| UT_Test_Report_fe | ✅ SUCCESS | >>>>> | |
| ST_Test_Report_fe | ✅ SUCCESS | >>>>> |
[2026-08-20 12:52:42] CI执行结束


流水线任务触发成功
任务链接 [259aed83fc3c42b0aa564e4eb6a0b4ba][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck_Pr | ✅ SUCCESS | ||
| antipoison | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| codecheck_dt | ❌ FAILED | >>>>> | |
| codecheck_precommit | ✅ SUCCESS | >>>>> | |
| StaticCheck_codespell | ✅ SUCCESS | ||
| StaticCheck_link_validity | ✅ SUCCESS | ||
| StaticCheck_resource_existence | ✅ SUCCESS | ||
| StaticCheck_tag_closed | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS |


compile


流水线任务触发成功
任务链接 [695a274d51564e26944973b0d571bac2][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_ARM_compiler | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_ARM_executor | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_ARM_dflow | ✅ SUCCESS | >>>>> | >>>>> |
| API_Check | ✅ SUCCESS | >>>>> | |
| PreSmoke_A900_npupool | ✅ SUCCESS | >>>>> |
[2026-08-20 13:09:04] CI执行结束


流水线任务触发成功
任务链接 [490f7f58c2164a8689a85241e45ecfd2][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_X86_compiler | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_executor | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_dflow | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test_dflow | ✅ SUCCESS | ||
| UT_Test_ge_common | ✅ SUCCESS | ||
| UT_Test_parser | ✅ SUCCESS | ||
| UT_Test_python | ✅ SUCCESS | >>>>> | |
| UT_Test_rt | ✅ SUCCESS | ||
| UT_Test_acl | ✅ SUCCESS | ||
| UT_Test_autofuse | ✅ SUCCESS | ||
| UT_Test_executor | ✅ SUCCESS | ||
| UT_Test_autofuse_ascendc_api | ✅ SUCCESS | ||
| ST_Test_dflow | ✅ SUCCESS | ||
| ST_Test_ge_common | ✅ SUCCESS | ||
| ST_Test_parser | ✅ SUCCESS | ||
| ST_Test_python | ✅ SUCCESS | >>>>> | |
| ST_Test_rt | ✅ SUCCESS | ||
| ST_Test_autofuse | ✅ SUCCESS | ||
| ST_Test_executor | ✅ SUCCESS | ||
| ST_Test_hetero | ✅ SUCCESS | ||
| ST_Test_autofuse_ascendc_api | ✅ SUCCESS | ||
| ST_Test_autofuse_e2e | ✅ SUCCESS | ||
| UT_Test_fe | ✅ SUCCESS | ||
| UT_Test_tefusion | ✅ SUCCESS | ||
| ST_Test_fe | ✅ SUCCESS | ||
| ST_Test_tefusion | ✅ SUCCESS | ||
| ST_Test_ge_common_atc | ✅ SUCCESS | ||
| UT_Test_Report_graphengine | ✅ SUCCESS | >>>>> | |
| UT_Test_Report_ge_executor_c | ✅ SUCCESS | >>>>> | |
| UT_Test_Report_ge_autofuse | ✅ SUCCESS | >>>>> | |
| ST_Test_Report_graphengine | ✅ SUCCESS | >>>>> | |
| ST_Test_Report_ge_executor_c | ✅ SUCCESS | >>>>> | |
| ST_Test_Report_ge_autofuse | ✅ SUCCESS | >>>>> | |
| UT_Test_Report_fe | ✅ SUCCESS | >>>>> | |
| ST_Test_Report_fe | ✅ SUCCESS | >>>>> |
[2026-08-20 13:16:23] CI执行结束


流水线任务触发成功
任务链接 [8b6bb4a123f94cb18443aacb5f418bc9][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck_Pr | ✅ SUCCESS | ||
| antipoison | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| codecheck_dt | ✅ SUCCESS | >>>>> | |
| codecheck_precommit | ✅ SUCCESS | >>>>> | |
| StaticCheck_codespell | ✅ SUCCESS | ||
| StaticCheck_link_validity | ✅ SUCCESS | ||
| StaticCheck_resource_existence | ✅ SUCCESS | ||
| StaticCheck_tag_closed | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS |
[2026-08-20 13:07:04] CI执行结束


@shengnan666 @wangxiaotian995 帮忙review一下代码


/lgtm


Pull Request
描述
修复 AutoFuse
BroadcastReduceEliminationPass消除Broadcast/Tile + Reduce模式后,替换生成的 Reshape 节点结构不完整、输出 shape 描述不一致的问题。原实现手工创建 Reshape
OpDesc,只连接数据输入,并通过shape属性记录目标 shape;同时,Reshape 输出描述由输入描述复制而来,仅更新了GeShape,可能继续保留原输入的OriginShape和 symbolic shape。以复现用例为例,静态 shape 已变为[256, 10],但 origin/symbolic shape 仍可能是[256, 1, 10],导致后续 Concat 符号 shape 推导发现输入 rank 不一致并报错:本次变更包括:
data + shape两个输入,其中目标 shape 由DT_INT64Const 节点提供,并连接到 Reshape 的第二个输入。GeShape、OriginShape和SymbolicDescAttr.origin_symbol_shape同步为同一个目标 shape,避免静态描述与符号描述的 rank 不一致。NodeUtils所需的直接头文件依赖。变更类型
请选择本次引入的变更类型:
关联的Issue
暂无关联 Issue。
如何测试
autofusion_ut,重点运行BroadcastReduceMax_EliminateWithSqueeze,确认:DT_INT64Const,内容等于目标 shape;GeShape、OriginShape和 symbolic shape 一致;data -> Reshape -> relu。当前验证结果:
aclmdlExecute: ret=0,两个输出与 CPU golden 比对通过。核对清单
其他信息
compiler/graph/optimize/autofuse/autofuse/pattern_fusion/broadcast_reduce_elimination_pass.cpptests/autofuse/ut/autofuse/broadcast_reduce_elimination_pass_unittest.cpp