已合并
【质量加固】style: add const qualifiers in ascendc graph dumper #1810
【质量加固】style: add const qualifiers in ascendc graph dumper #1810
已合并
mclll创建于 7 天前
mclll
7 天前

Pull Request

描述

本 PR 按 #238 质量加固要求,在 autofuse/ascir/meta/ascendc_graph_txt_dumper.cpp 中为 10 个初始化后不再修改的局部变量添加 const 修饰,减少误修改风险。

变更类型

关联的Issue

#238

如何测试

  1. 本地执行 git diff --check,通过。
  2. 通过网页复制提交后的源码,确认 10 处 const 修改均已生效。

核对清单

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

变更摘要

本 PR 是 #238 质量加固要求的一部分,在 autofuse/ascir/meta/ascendc_graph_txt_dumper.cpp 中为 10 个初始化后不再修改的局部变量添加 const 修饰(均为 autoconst auto),以降低误修改风险。改动仅涉及代码风格,不改变任何运行逻辑,并通过了 git diff --check 校验。

主要改动

  • GetDtypeInfo 中只读迭代器加 constkDtypeInfoMap.find(dtype) 的返回值由 auto it 改为 const auto it,该迭代器仅用于查找与读取,不参与后续写入。
  • GetTensorTypeStr 中类型与形状相关局部变量加 constattr.dtype 改为 const auto dtype;形状循环中的 attr.axis[i]attr.repeats[i] 分别改为 const auto axis_idconst auto repeat,两处 axis_id_to_name.find(axis_id) 的迭代器也改为 const auto it,均为只读查询使用。
  • BuildDumpContext 中节点类型加 constnode->GetType() 的返回值由 auto node_type 改为 const auto node_type,仅用于与 NodeType::kData 等常量比较。
  • CollectInputNames 中锚点与节点名加 constnode->GetInDataAnchor(...)in_anchor->GetPeerOutAnchor()peer_out_anchor->GetOwnerNode()->GetName() 的返回值分别改为 const auto in_anchorconst auto peer_out_anchorconst auto peer_name,这些变量仅用于判空、读取索引与节点名称。
likedislike
atomgit-bot
atomgit-bot
7 天前 评论:

代码审查

✅ 未发现问题

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

Hi @mclll, welcome to submitting your first PR to graph-autofusion!

PR Merge Steps

1. CLA Signing

If the current PR label includes cann-cla/yes, it means you have signed the CLA and can proceed to the next step. If the label includes cann-cla/no, please sign the CLA first. If you have any questions, please refer to the FAQ.

2. CI Check

Please comment /compile to trigger the CI pipeline check. If the CI run is successful, the PR will be tagged with ci-pipeline-passed and you can proceed to the next step. If the CI run fails, the PR will be tagged with ci-pipeline-failed, please check the CI logs to fix the issues in the PR. If you have any questions, please refer to the FAQ.

3. Code Review

After CI passes, please refer to the PR Approval Progress and proactively @ the committers in the table to review the code. After approval, committers will comment /lgtm and /approve. Once the lgtm and approved labels are successfully added, the PR will be merged automatically.

likedislike
CANN-robotCANN-robot成员
7 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
7 天前 评论:

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.
You can self-configure the PR merge rules for this repository. For more details, please refer to 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 xuyafei, 张德鹏, xchu42 (3/2) 张德鹏 (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)
likedislike
CANN-robot
CANN-robot成员
7 天前 评论:

CLA Signature Pass

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

likedislike
CANN-robotCANN-robot成员
7 天前 将niuyuhu,yangyongqiang0606,liyuewei,xchu42,zhang_shengjie,depeng1994,wqtshg_wt,peiyang,shengnan666,XuebinYang,sjtulxh,zhanj,zhujingjing,xuyafei,wangxiaotian995设为评审人
CANN-robotCANN-robot成员
7 天前 将niuyuhu,yangyongqiang0606,liyuewei,xchu42,zhang_shengjie,depeng1994,wqtshg_wt,peiyang,shengnan666,XuebinYang,sjtulxh,zhanj,zhujingjing,xuyafei,wangxiaotian995设为审查人
mclll
7 天前 评论:

compile

likedislike
Mmclll
7 天前 update merge request[project id: 8005834, iid: 1810, commit_id: 290ed0887ea4170a85be7ed840d4e049e74e30af] virtual merging success
CANN-robotCANN-robot成员
7 天前 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
7 天前 评论:

流水线任务触发成功
任务链接 [18651b091bb64a06aca13cb2f60532ec][流水线指导]

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

[2026-08-24 12:33:21]    CI执行结束

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

流水线任务触发成功
任务链接 [65bd4de76c0745388f731832ed48a3cf][流水线指导]

任务名称状态日志下载链接
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 ❌ FAILED >>>>>
ST_Test_autofuse_e2e ✅ SUCCESS >>>>>
pre_comment ✅ SUCCESS >>>>>
likedislike
CANN-robot
CANN-robot成员
7 天前 评论:

流水线任务触发成功
任务链接 [5b71dffc41854109b640911a3dd9523f][流水线指导]

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

[2026-08-24 12:39:28]    CI执行结束

likedislike
CANN-robotCANN-robot成员
7 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
7 天前 添加了label:ci-pipeline-failed
mclll
7 天前 评论:

compile

likedislike
CANN-robotCANN-robot成员
7 天前 删除了label:ci-pipeline-failed
CANN-robotCANN-robot成员
7 天前 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
7 天前 评论:

流水线任务触发成功
任务链接 [5ea48bea44ee439f9bcb1b6055a9723c][流水线指导]

任务名称状态日志下载链接
UT_Test_Python_superkernel ✅ SUCCESS >>>>>
ST_Test_Python_superkernel ✅ SUCCESS >>>>>
UT_Test_superkernel ✅ SUCCESS >>>>>
UT_Test_autofuse_framework ✅ SUCCESS >>>>>
ST_Test_autofuse_framework ❌ FAILED >>>>>
UT_Test_autofuse_ascendc_api ✅ SUCCESS >>>>>
ST_Test_autofuse_ascendc_api ❌ FAILED >>>>>
ST_Test_autofuse_e2e ✅ SUCCESS >>>>>
pre_comment ✅ SUCCESS >>>>>
likedislike
CANN-robot
CANN-robot成员
7 天前 评论:

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

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

[2026-08-24 13:13:38]    CI执行结束

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

流水线任务触发成功
任务链接 [32038a0671f54c868a6daf7f3c719240][流水线指导]

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

[2026-08-24 13:19:10]    CI执行结束

likedislike
CANN-robotCANN-robot成员
7 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
7 天前 添加了label:ci-pipeline-failed
mclll
7 天前 评论:

compile

likedislike
Mmclll
7 天前 update merge request[project id: 8005834, iid: 1810, commit_id: 5b6f6193d029cd40540700d2bdc1126386361076] virtual merging success
CANN-robotCANN-robot成员
7 天前 删除了label:ci-pipeline-failed
CANN-robotCANN-robot成员
7 天前 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
7 天前 评论:

流水线任务触发成功
任务链接 [9dcac7eec5d94632ae0017cc47928ded][流水线指导]

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

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

流水线任务触发成功
任务链接 [9a6d36b533674c5397557f35a9f0a77e][流水线指导]

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

[2026-08-24 14:35:53]    CI执行结束

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

流水线任务触发成功
任务链接 [6fbf658ca20d4e53b81499f4b72720db][流水线指导]

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

[2026-08-24 14:41:36]    CI执行结束

likedislike
CANN-robotCANN-robot成员
7 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
7 天前 添加了label:ci-pipeline-passed
xchu42
xchu42成员
7 天前 评论:

/lgtm

likedislike
xuyafei成员
7 天前 评论:

/lgtm

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

/approve

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