Pull Request已成功合入, 合并人@CANN-robot
(感谢 shengnan 的贡献)变更摘要
本次 PR 将节点插入逻辑从通用框架层 GraphUtils 重构到 AscendC IR 专用工具类 AscGraphUtils 中,目的是收编 Autofuse 场景下的节点插入行为。新的 AscGraphUtils::InsertNodeAfter 和 AscGraphUtils::InsertNodeBefore 仅维护数据边,不再处理控制边;属性继承方面,从参考节点继承 AscNodeAttr::sched(调度信息),并从源 tensor 继承 AscTensorAttr 的 axis/repeats/strides 字段。所有调用方(共 6 处)从原先手动断边-加边-拷贝属性的模式统一切换为调用新接口,同时补充了对应的单元测试。
主要改动
- 将
InsertNodeAfter/InsertNodeBefore从GraphUtils迁移至AscGraphUtils:graph_utils.cc中移除了原有的两个方法及其辅助函数InheritAttr和相关常量,asc_graph_utils.cc中新增了简化版本,仅维护数据边并继承 Autofuse 特有的AscNodeAttr::sched和AscTensorAttr(axis/repeats/strides)。 - 新增
InheritAutofuseAttr辅助函数:从源 tensor 描述复制axis、repeats、strides到插入节点的输出 tensor 描述,替代原先通过InheritAttr继承白名单字符串属性的机制。 buf_que_allocator.cpp调用方简化:ShortenVecinLifetime和ShortenVecoutLifetime中将多步手动断边-加边-设 sched 的操作替换为AscGraphUtils::InsertNodeAfter单次调用。dtype_consistency.cpp/improve_precision.cpp/cast_optimization_pass.cpp/concat_inputs_unification_pass.cpp/base_alignment_strategy.cpp调用方统一:原先分散的手动RemoveEdge+AddEdge+手动属性拷贝模式统一为调用AscGraphUtils::InsertNodeBefore或InsertNodeAfter,删除了冗余的属性逐字段拷贝代码。- 新增单元测试
test_asc_graph_utils.cpp和test_buf_que_allocator.cpp补充用例:覆盖InsertNodeBefore继承 consumer 调度和 producer tensor 属性、InsertNodeAfter继承 producer 属性、多 consumer 场景、指定输入输出 index、跨图节点拒绝等场景,以及ShortenVecoutLifetime插入 ub2ub 节点的集成验证。


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


流水线任务触发成功
任务链接 [f2174851d96d424eb8de8d2978e39556][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_checkpr | ✅ SUCCESS | ||
| pre_comment | ✅ SUCCESS | >>>>> | |
| codecheck_codestyle | ⚠️ WARNING | >>>>> | |
| codecheck_precommit | ✅ SUCCESS | >>>>> |
[2026-08-07 15:30:15] CI执行结束


流水线任务触发成功
任务链接 [b6f72a37cdeb48bab3c6a40667078792][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| UT_Test_Python_superkernel | ✅ SUCCESS | >>>>> | |
| ST_Test_Python_superkernel | ✅ SUCCESS | >>>>> | |
| UT_Test_superkernel | ✅ SUCCESS | >>>>> | |
| UT_Test_autofuse_framework | ✅ SUCCESS | >>>>> | |
| ST_Test_autofuse_framework | ✅ SUCCESS | >>>>> | |
| UT_Test_autofuse_ascendc_api | ✅ SUCCESS | >>>>> | |
| ST_Test_autofuse_ascendc_api | ✅ SUCCESS | >>>>> | |
| ST_Test_autofuse_e2e | ✅ SUCCESS | >>>>> | |
| pre_comment | ✅ SUCCESS | >>>>> | |
| UT_Test_Report | ✅ SUCCESS | >>>>> | |
| ST_Test_Report | ✅ SUCCESS | >>>>> |
[2026-08-07 15:49:52] CI执行结束


/lgtm


/lgtm


Pull Request
描述
使用InsertNode收编节点插入行为
变更类型
请选择本次引入的变更类型:
关联的Issue
如何测试
描述测试此变更的步骤和前提条件:
1.
2.
核对清单
其他信息
在此添加任何其他关于本次 PR 的说明。