已合并
【质量加固】style: autofuse 仅补齐10处 const 规范 #1787
【质量加固】style: autofuse 仅补齐10处 const 规范 #1787
已合并
QWH456123创建于 4 天前
QWH456123
4 天前

Pull Request

描述

对应 Issue #238「质量加固」。
本 PR 仅做 const 相关规范修复,共 10 处;不改参数名、不改非 const 相关逻辑;仅 autofuse/,无 CI / super_kernel 变更。

变更类型

关联的Issue

Issue 地址:https://gitcode.com/cann/graph-autofusion/issues/238

修改清单(10处,均为 const)

# 规则 改动
1 规则1 NameGenerator::GetNameMapping()const
2 规则1 TilingData::GenConstGenResultReplace()const
3 规则1 TilingData::GenTingDataField()const
4 规则1 GetNameOfGenTilingDataFieldConstDefFunc()const
5 规则1 GetNameOfGenTilingDataFieldConstDefFuncSimple()const
6 规则1 GetNameOfGenTilingDataFieldConstValueFuncSimple()const
7 规则3 IrAttrHandleMap 改为 const,查找改用 .at()
8 规则3 GetOutputName 循环改为 const auto &
9 规则3 binary_api_tmp_call.cppx1_idx/x2_idxconst
10 规则3 pad_api_call.cppaxis_numconst

刻意未改(降风险)

  • 不做规则4参数名重命名
  • 不修改 const AscNode & 一类易触发 outputs 非 const 接口的改动

如何测试

  1. 代码检视确认无行为变更
  2. PR 评论区触发 compile

核对清单

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 QWH456123 的贡献)
QQWH456123
4 天前 创建了 pull request,commit 21ed4ca1
QQWH456123
4 天前 关联了issue:【质量加固】AutoFusion定向“质量加固”社区有奖任务
atomgit-bot
atomgit-bot
4 天前 评论:

变更摘要

本 PR 对应质量加固 Issue #238,仅在 autofuse/ 目录内做 const 相关代码规范修复,共 10 处:为 NameGeneratorTilingData 的多个成员函数补充 const 限定(同步修改 .h 声明与 .cpp 实现),将 IrAttrHandleMap 改为 const 容器并将查找方式由 operator[] 改为 .at(),同时把多处循环迭代变量与局部变量补充 const。PR 明确不涉及参数名重命名、非 const 相关逻辑及 CI / super_kernel 变更,不引入行为变化。

主要改动

  • 成员函数补充 const 限定: TilingData::GenConstGenResultReplace()GenTingDataField()GetNameOfGenTilingDataFieldConstDefFunc()GetNameOfGenTilingDataFieldConstDefFuncSimple()GetNameOfGenTilingDataFieldConstValueFuncSimple()NameGenerator::GetNameMapping() 均加上 const,并在 codegen_tiling_data.hascend_graph_code_dumper.h 中同步更新声明。
  • IrAttrHandleMap 改为 const 并改用 .at(): 在 ascend_graph_code_dumper.cpp 中将该 map 声明为 const,属性处理函数调用由 IrAttrHandleMap[attr_def.asc_ir_type] 改为 IrAttrHandleMap.at(...)
  • 循环迭代改为 const auto &: GetOutputName 遍历 ir_output_2_ranges 以及 GenConstGenResultReplace()GenTingDataField()GetNameOfGenTilingDataFieldConstDefFunc() 遍历容器时,迭代变量由值拷贝改为 const auto &,避免不必要的拷贝。
  • 局部变量补充 const: binary_api_tmp_call.cpp 中的 x1_idx/x2_idxpad_api_call.cpp 中的 axis_num 均声明为 const 局部变量。
likedislike
atomgit-bot
atomgit-bot
4 天前 评论:

代码审查

✅ 未发现问题

likedislike
QWH456123
4 天前 评论:

compile

likedislike
QWH456123
4 天前 评论:

/check-cla

likedislike
QQWH456123
4 天前 update merge request[project id: 8005834, iid: 1787, commit_id: c2e3ce4225f5555d0c34e32b060e839e9a939381] virtual merging success
CANN-robotCANN-robot成员
4 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
4 天前 评论:

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/graph-autofusion 张德鹏, niuyuhu, xchu42 (3/2) 张德鹏 (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

QWH456123, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robotCANN-robot成员
4 天前 将niuyuhu,yangyongqiang0606,liyuewei,xchu42,zhang_shengjie,depeng1994,wqtshg_wt,peiyang,shengnan666,XuebinYang,sjtulxh,zhanj,zhujingjing,xuyafei,wangxiaotian995设为评审人
CANN-robotCANN-robot成员
4 天前 将niuyuhu,yangyongqiang0606,liyuewei,xchu42,zhang_shengjie,depeng1994,wqtshg_wt,peiyang,shengnan666,XuebinYang,sjtulxh,zhanj,zhujingjing,xuyafei,wangxiaotian995设为审查人
CANN-robotCANN-robot成员
4 天前 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
4 天前 评论:

流水线任务触发成功
任务链接 [3223cf50dc9e4219928692e06baf1392][流水线指导]

任务名称状态日志下载链接
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-20 14:29:35]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
4 天前 评论:

流水线任务触发成功
任务链接 [23ea2a346e32484eb76828bd67d62209][流水线指导]

任务名称状态日志下载链接
codecheck ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
codecheck_checkpr ✅ SUCCESS
pre_comment ✅ SUCCESS >>>>>
codecheck_codestyle ✅ SUCCESS >>>>>
codecheck_precommit ✅ SUCCESS >>>>>

[2026-08-20 14:15:38]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
4 天前 评论:

流水线任务触发成功
任务链接 [1454020af70a449a990a06c46d7057cb][流水线指导]

任务名称状态日志下载链接
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
pre_comment ✅ SUCCESS >>>>>
PreSmoke_A900_npupool ✅ SUCCESS >>>>>

[2026-08-20 14:21:27]    CI执行结束

likedislike
CANN-robotCANN-robot成员
4 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
4 天前 添加了label:ci-pipeline-passed
QWH456123
4 天前 评论:
likedislike
QWH456123
4 天前 评论:
likedislike
QWH456123
4 天前 评论:
likedislike
QWH456123
4 天前 评论:
likedislike
牛玉虎
牛玉虎成员
4 天前 评论:

/lgtm

likedislike
牛玉虎牛玉虎成员
4 天前 通过了评审
牛玉虎牛玉虎成员
4 天前 通过审查
QWH456123
4 天前 评论:
likedislike
QWH456123
4 天前 评论:
likedislike
QWH456123
4 天前 评论:
likedislike
QWH456123
4 天前 评论:
likedislike
QWH456123
4 天前 评论:
likedislike
xchu42
xchu42成员
4 天前 评论:

/lgtm

likedislike
CANN-robotCANN-robot成员
4 天前 添加了label:lgtm
张德鹏成员
4 天前 评论:

/approve

likedislike
CANN-robotCANN-robot成员
4 天前 添加了label:approved
CANN-robotCANN-robot成员
4 天前 合入了pull request