Merged
fix: 1.越界问题;2.Clean Code;3. memset二级指针场景不展开 #838
ren-botaoAdd on Sep 10
fix: 1.越界问题;2.Clean Code;3. memset二级指针场景不展开 #838
Merged
Merged fromren-botao/opbaseclean_code_20260910intocann/opbasemaster
Pull Request has been successfully merged by CANN-robot.
(Thank you for ren-botao's contribution.)atomgit-bot
Sep 10 Comments:
Sep 10 Comments:
变更摘要
该 PR 主要包含两类改动:一是修复 KernelGraphUtils::Link 中的索引越界判断逻辑;二是优化 aclnn 调试开关(维测代码)的实现方式,将 g_aclnnDebugEnabled 全局变量及其初始化逻辑收敛到 op_dfx.cpp 内部,并利用 __attribute__((constructor)) 在程序加载阶段自动完成开关初始化,从而移除原先依赖 std::call_once 的惰性初始化及在 op_executor.cpp 中的显式调用。
主要改动
- 越界判断修复:在
src/nnopbase/composite_op/mem_mgr/kernel_graph_utils.cpp的KernelGraphUtils::Link中,将from与to的合法性判断由>(大于)改为>=(大于等于),使索引等于容器大小时也能被判定为越界并返回ACLNN_ERR_INNER,避免后续at()访问越界。 - 调试开关初始化方式重构:在
op_dfx.cpp中将g_aclnnDebugEnabled移入匿名命名空间,并把InitAclnnDebugSwitch改为__attribute__((constructor))构造函数(加载即执行),移除std::once_flag与std::call_once机制。 - 接口收敛:在
op_dfx_internal.h中移除g_aclnnDebugEnabled的extern声明、InitAclnnDebugSwitch声明及内联的IsAclnnDebugEnabled,仅保留bool IsAclnnDebugEnabled()接口声明,并在op_dfx.cpp中提供其实现。 - 移除冗余调用:在
op_executor.cpp的InitL2Phase1Context中删除对InitAclnnDebugSwitch()的显式调用,改由构造函数自动初始化。


Incorrect?
atomgit-bot
Sep 10 Comments:
Sep 10 Comments:
Sep 10 Added label: cann-cla/yes
CANN-robot
Sep 10 Comments:
Sep 10 Comments:
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/opbase | ✅ 汤平川, 张磊 (2/2) | ✅ 汤平川, 张磊 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
ren-botao, thanks for your pull request. All authors of the commits have signed the CLA. 👍


Sep 10 Set pengjiahao96,zhou-qilong,wangrui_,rxtfeng,loov1,jia0liang,zl_hw,songkai111,pingchuantang,llimwang,gubaocheng as approver
Sep 10 Set pengjiahao96,zhou-qilong,wangrui_,rxtfeng,loov1,jia0liang,zl_hw,songkai111,pingchuantang,llimwang,gubaocheng as approver
23 event messages are collapsed here。 See more
Sep 12 Added label: cann-cla/yes
ren-botao
Sep 12 Comments:
Sep 12 Comments:
/ai review


ren-botao
Sep 12 Comments:
Sep 12 Comments:
/ai summary


ren-botao
Sep 14 Comments:
Sep 14 Comments:
compile


Sep 14 Pre merge succeeded (commit_id: 3a26e437832d6b7c9522563b42f65306b3ecbe1f)
CANN-robot
Sep 14 Comments:
Sep 14 Comments:
| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


Sep 14 Added label: ci-pipeline-running
Sep 14 Removed label: ci-pipeline-running
Sep 14 Added label: ci-pipeline-passed
Sep 14 Modify description of pull request
TangPC
Sep 14 Comments:
Sep 14 Comments:
/lgtm
/approve


Sep 14 Added label: approved
zl_hw
Sep 14 Comments:
Sep 14 Comments:
/lgtm
/approve


Sep 14 Added label: lgtm
Sep 14 Closed associated issue
Sep 14 Merged pull request
描述
关联的Issue
测试
添加ut用例看护
二级冒烟
文档更新
类型标签