Pull Request已成功合入, 合并人@CANN-robot
(感谢 qoosong 的贡献)变更摘要
本 PR 响应 #517「质量加固」社区活动,为 ge 仓中不修改成员变量的成员函数补充 const 修饰,共修复 10 个文件、15 处缺失 const 的成员函数,使代码符合规则 1(成员函数 const 修饰)的编码规范。所有改动均为添加 const 限定符及将互斥量声明为 mutable,不改变运行时行为,可通过编译期验证。
主要改动
- 为纯读取型 Getter 添加
const修饰:BufferFusionPassBase::GetName()、SkipCtxRecord::GetCtxNum()、FusionRuleJsonNode::GetName()、FusionRuleJsonAnchor::GetSrcNode()/GetName()、Analyzer::IsEnableNetAnalyzeDebug()等仅返回成员变量或读取环境变量的函数改为const成员函数。 - 为转调链上的查询函数添加
const修饰:DataInputer::Size()与DavinciModel::GetDataInputerSize()改为const,以转调已是const的queue_.Size()与data_inputer_.Size()。 - 为带锁的只读访问函数添加
const并声明mutable互斥量:GlobalDumper::GetHandleSize()、BlockingQueue::GetRemainItems()/IsFull()/Size()、FusionRuleParserUtils::GetEngineName()在加const的同时,将其内部mutex_/parse_mutex_声明为mutable,以支持 const 成员函数内部加锁,与既有 PR #4597 的处理方式保持一致。 - 为原子状态读取函数添加
const修饰:GlobalProfilingWrapper::GetRecordCount()与IsEnabled()改为const,仅通过global_profiler_->GetCount()及enable_flags_.load()进行只读访问。


Hi @qoosong, welcome to submitting your first PR to ge!
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.


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


CLA检查未通过,详情可参考这里


流水线任务触发成功
任务链接 [d9849d49e4414876bcb84d97200672fd][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| 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-28 01:36:50] CI执行结束


流水线任务触发成功
任务链接 [9de97404f83b4b88b1b7bd2735d5fe53][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_X86_compiler_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_executor_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_dflow_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_ARM_compiler_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_ARM_executor_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_ARM_dflow_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_ARM_compiler | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_ARM_executor | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_ARM_dflow | ✅ SUCCESS | >>>>> | >>>>> |
| API_Check | ✅ SUCCESS | >>>>> | |
| PreSmoke_A900_npupool | ✅ SUCCESS | >>>>> |
[2026-08-28 01:32:31] CI执行结束


流水线任务触发成功
任务链接 [4412798fcba24a828920be2259ae0f63][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| 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-28 01:19:24] CI执行结束


/lgtm


描述
响应 #517 "质量加固" 社区活动,修复 ge 仓中不符合规则1(成员函数 const 修饰)的代码问题。
不会修改成员变量的成员函数应使用 const 修饰。本次共修复 15 处成员函数缺少 const 修饰的问题,涉及 10 个文件,与既有 PR(#4597/#4594/#4497/#4572/#4496)无重复或冲突。
涉及文件及修复点:
inc/graph_metadef/register/graph_optimizer/buffer_fusion/buffer_fusion_pass_base.hBufferFusionPassBase::GetName()inc/graph_metadef/register/ffts_node_converter_registry.hSkipCtxRecord::GetCtxNum()inc/framework/runtime/subscriber/global_profiler.hGlobalProfilingWrapper::GetRecordCount()inc/framework/runtime/subscriber/global_profiler.hGlobalProfilingWrapper::IsEnabled()inc/framework/runtime/subscriber/global_dumper.hGlobalDumper::GetHandleSize()inc/graph_metadef/common/blocking_queue.hBlockingQueue::GetRemainItems()/IsFull()/Size()runtime/v1/graph/load/model_manager/data_inputer.hDataInputer::Size()runtime/v1/graph/load/model_manager/davinci_model.hDavinciModel::GetDataInputerSize()compiler/analyzer/analyzer.hAnalyzer::IsEnableNetAnalyzeDebug()compiler/engines/nn_engine/fusion/.../fusion_rule_parser_utils.hFusionRuleParserUtils::GetEngineName()compiler/engines/nn_engine/fusion/.../fusion_rule_json_pattern.hFusionRuleJsonNode::GetName()/FusionRuleJsonAnchor::GetSrcNode()/FusionRuleJsonAnchor::GetName()对于需要加锁的只读访问(
GlobalDumper::GetHandleSize、BlockingQueue::IsFull/Size/GetRemainItems、FusionRuleParserUtils::GetEngineName),将互斥量声明为mutable,以支持 const 成员函数内部的加锁,与既有 PR #4597 中NodeDoneManager::Cond/DeployPlan的处理方式一致。变更类型
关联的Issue
#517
如何测试
核对清单