Pull Request已成功合入, 合并人@CANN-robot
(感谢 yangyongqiang 的贡献)变更摘要
本次 PR 为 develop 分支向 master 的同步合并,主要包含三个方面的工作:废弃 exec_order 执行序字段并清理相关代码、增强融合图展开器 (FusedGraphUnfolder) 的轴映射能力以支持更复杂的算子融合场景、以及新增两个 AscendC API (Hypot 和 LogNdtr)。
主要改动
-
废弃
exec_order调度字段: 在af_ir.proto中为SchedInfoDef.exec_order添加deprecated = true标记,从AscGraph::CreateContiguousData接口中移除exec_order的自动生成逻辑,改为通过新的index参数显式传入;同时删除SortByExecOrder()、CheckExecOrderValid()等方法及所有调用处,序列化/反序列化代码也移除了exec_order的读写。 -
CreateContiguousData接口签名变更: 新增size_t index参数,用于直接设置 Data 节点的ir_attr索引,替换原先由CodeGenUtils::GenNextExecId自动生成的exec_order;所有测试文件中的调用点均已同步更新以适配新签名。 -
融合图展开器轴映射重构: 在
FusedGraphUnfolder中新增完整的局部/图级轴映射基础设施,包括BuildLocalAxisMapping(基于受限 DFS 的张量维度保序映射搜索)、BuildGraphAxisMapping(通过中间图组合映射)、MergeGraphAxisMapping(多边映射约束合并)等静态方法;将原有的SelectCommonLoopAxis拆分为CloneAscGraphs、FindConcatContext、CollectPreConcatMappings、ApplyPreConcatMappings四个步骤,支持 Concat 前驱子图的精确轴对齐而非简单合并;新增ApplyMappedLoopAxis和RewriteTensorAxis处理带插入轴的图级映射。 -
新增
Hypot和LogNdtrAPI: 在autofuse/v35/ascendc/api_regbase/下新增hypot.h,实现数值稳定的hypot(x,y) = m * sqrt(1 + (n/m)^2)算法并处理 NaN/Inf/零值边界条件;新增log_ndtr.h,实现log_ndtr的对数正态分布函数,包含左尾 (erfcx) 和右尾 (erf+log1p) 两条计算路径及特殊值处理。 -
Transpose 性能优化: 在
transpose.h的TransposeOneOuterDimExtendImpl、TransposeTwoOuterDimExtendImpl、TransposeThreeOuterDimExtendImpl三个函数中,将LoadAlign(idx_reg, ...)从内层循环提升到外层循环,消除冗余的索引加载开销。


代码审查
I've completed the thorough review of all 46 files. Let me provide the closing summary.
审查总结
本次 PR 共审查 46 个文件,发现 2 个问题:
| 优先级 | 数量 | 说明 |
|---|---|---|
| P2 | 1 | CreateSizeVar → af::Symbol 替换可能导致序列化场景下 size variable 丢失 |
| P3 | 1 | log_ndtr.h 头文件全局 using namespace AscendC(可选改进,既存惯例) |
逐文件审查结果
| 文件 | 结果 |
|---|---|
.gitignore |
无问题(添加 oat_reports/ 忽略规则) |
autofuse/ascir/meta/ascir_utils.cpp |
无问题(删除注释行) |
autofuse/graph_metadef/graph/ascendc_ir/core/ascendc_ir.cc |
无问题(exec_order 字段废弃,CreateContiguousData 接口重构,删除 SortByExecOrder/CheckExecOrderValid) |
autofuse/graph_metadef/graph/ascendc_ir/core/ascendc_ir_impl.h |
无问题 |
autofuse/graph_metadef/graph/ascendc_ir/generator/generator.cc |
无问题(删除 exec_order 生成代码) |
autofuse/graph_metadef/graph/ascendc_ir/utils/ascendc_ir_dump_utils.cc |
无问题(修正拼写 TRANPOSE→TRANSPOSE,删除 exec_order dump) |
autofuse/graph_metadef/proto/af_ir.proto |
无问题(exec_order 标记 deprecated,注释拼写修正) |
autofuse/inc/graph_metadef/graph/ascendc_ir/ascendc_ir_core/ascendc_ir.h |
无问题 |
autofuse/inc/graph_metadef/graph/ascendc_ir/ascendc_ir_core/ascendc_ir_def.h |
无问题(exec_order 注释标记废弃) |
autofuse/optimize/fused_graph/fused_graph_unfolder.cpp |
无问题(新增 BFS 轴映射算法、SelectCommonLoopAxis 重构,逻辑正确) |
autofuse/optimize/fused_graph/fused_graph_unfolder.h |
无问题(新增枚举、结构体和静态方法声明) |
autofuse/tests/st/ascir/code_dumper/code_dumper_unittest.cc |
无问题(删除 exec_order 赋值) |
autofuse/tests/st/att/testcase/scenario/add_layer_norm/test_add_layer_norm.cpp |
无问题(删除 exec_order 参数和变量) |
autofuse/tests/st/att/testcase/scenario/concat/test_concat.cpp |
无问题(CreateContiguousData 增加 index 参数) |
autofuse/tests/st/att/testcase/scenario/e2e_brc_buf/att_test_brc_buf.cpp |
无问题 |
autofuse/tests/st/att/testcase/source_mirror/gen_model_info_content/stub_graph.cpp |
无问题(大规模删除 exec_order 赋值) |
autofuse/tests/st/att/testcase/source_mirror/gen_model_info_content/test_api_tiling_gen.cpp |
无问题 |
autofuse/tests/st/att/testcase/source_mirror/gen_model_info_content/test_auto_fuse.cpp |
无问题 |
autofuse/tests/st/att/testcase/source_mirror/gen_model_info_content/test_gen_model_info.cpp |
无问题 |
autofuse/tests/st/att/testcase/source_mirror/gen_model_info_content/test_schedule.cpp |
无问题(末尾新增换行符) |
autofuse/tests/st/att/utils/graph_construct_utils.cpp |
无问题 |
autofuse/tests/st/codegen/ascir_tool/testcase/reduce_sum_arar_4dim_not_align/input_ascir.py |
无问题(引号风格统一,删除注释掉的 exec_order,修复尾部换行) |
autofuse/tests/st/optimize/optimize_st.cpp |
无问题(BuildConcatAscGraph 新增 same_data 参数,逻辑正确) |
autofuse/tests/ut/ascir/code_dumper_unittest.cc |
无问题 |
autofuse/tests/ut/att/testcase/ascir/test_ascir_graph.cpp |
无问题 |
autofuse/tests/ut/att/testcase/ascir/test_ascir_ops.cpp |
无问题(删除 ExecOrderIncreaseOk 测试) |
autofuse/tests/ut/att/testcase/gen_model_info/core/test_brc_buf_graph.cpp |
无问题 |
autofuse/tests/ut/att/testcase/gen_model_info/core/test_concat.cpp |
无问题 |
autofuse/tests/ut/att/testcase/gen_model_info/core/test_fa_ascir_graph.cpp |
无问题 |
autofuse/tests/ut/att/testcase/gen_model_info/core/test_gen_model_info.cpp |
无问题 |
autofuse/tests/ut/att/testcase/gen_model_info/expr_gen/test_pipe_perf_expr.cpp |
无问题 |
autofuse/tests/ut/att/testcase/gen_model_info/parser/test_ascend_graph_parser.cpp |
无问题 |
autofuse/tests/ut/att/testcase/gen_model_info/reuse_group_utils/test_equivalent_graph_recongnizer.cpp |
无问题 |
autofuse/tests/ut/att/utils/graph_construct_utils.cpp |
无问题 |
autofuse/tests/ut/optimize/test_fusedgraph_unfolder.cpp |
⚠️ P2:CreateSizeVar → Symbol 替换风险 |
autofuse/tests/v35/st/att/concat/test_concat.cpp |
无问题 |
autofuse/tests/v35/ut/ascendc/api_regbase/CMakeLists.txt |
无问题(新增 test_log_ndtr.cpp、test_hypot.cpp) |
autofuse/tests/v35/ut/ascendc/api_regbase/test_hypot.cpp |
无问题(新增 hypot 算子测试) |
autofuse/tests/v35/ut/ascendc/api_regbase/test_log_ndtr.cpp |
无问题(新增 log_ndtr 算子测试) |
autofuse/tests/v35/ut/att/gen_model_info/api_perf_register/test_pipe_perf_expr_v2.cpp |
无问题 |
autofuse/v35/ascendc/api_regbase/CMakeLists.txt |
无问题(新增 log_ndtr.h、hypot.h) |
autofuse/v35/ascendc/api_regbase/hypot.h |
无问题(hypot 算子实现,算法正确,边界处理完备) |
autofuse/v35/ascendc/api_regbase/log_ndtr.h |
P3 建议:头文件 using namespace AscendC(既存惯例) |
autofuse/v35/ascendc/api_regbase/transpose.h |
无问题(LoadAlign 从内层循环提升到外层,性能优化,语义等价) |
docs/en/precommit_guide.md |
无问题(OAT 使用指南文档) |
docs/zh/precommit_guide.md |
无问题(OAT 使用指南文档) |
整体风险评估
低风险。本次 PR 的核心变更是:
- 废弃
exec_order字段:删除相关生成、序列化、校验和 dump 代码,同步更新所有测试用例,影响面可控且无残留引用 fused_graph_unfolder重构:新增基于 BFS 的轴映射推导算法,代码质量高、断言充分、有配套单元测试- 新增 Ascend C 算子(hypot、log_ndtr):数值算法正确,边界条件处理恰当(NaN/Inf/零值/溢出),测试覆盖随机+边界场景
CreateContiguousDataAPI 变更:所有调用方已在本次 diff 中同步更新,无遗漏
唯一的 P2 问题是测试辅助代码中 CreateSizeVar → Symbol 的替换,存在序列化场景下的理论风险,建议确认或恢复。
⚠️ 已识别出整体风险,但无法提取行内评论,请参考整体评估。


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


compile


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


流水线任务触发成功
任务链接 [fb3a310d3b73497e82eeace3fe8a0870][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| 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 | >>>>> |
[2026-07-15 19:00:39] CI执行结束


流水线任务触发成功
任务链接 [2c7d71c3d23f44a8b39fca7f3beadf31][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| API_Check | ⚠️ WARNING | >>>>> | |
| PreSmoke_A900_npupool | ✅ SUCCESS | >>>>> |
[2026-07-15 18:52:07] CI执行结束


/lgtm


/lgtm


流水线任务触发成功
任务链接 [67ddf7228cd54a248a28c7a394831c6c][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| 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 | >>>>> |
[2026-07-16 15:31:48] CI执行结束


流水线任务触发成功
任务链接 [f73d69a4a4534e029a91a1e078f1206f][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| API_Check | ⚠️ WARNING | >>>>> | |
| PreSmoke_A900_npupool | ✅ SUCCESS | >>>>> |
[2026-07-16 15:26:19] CI执行结束


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


/approve


Pull Request
描述
sync develop to master 0715
变更类型
请选择本次引入的变更类型:
关联的Issue
如何测试
描述测试此变更的步骤和前提条件:
1.
2.
核对清单
其他信息
在此添加任何其他关于本次 PR 的说明。