Merged
fix(aicpu): 补充5处成员函数const修饰(G.CNS.03残留) #5897
fix(aicpu): 补充5处成员函数const修饰(G.CNS.03残留) #5897
Merged
liu-weiAdd on Sep 21
liu-wei
liu-weiCollaborators
Sep 21

描述

修复 5 条 G.CNS.03 告警(不修改成员变量的成员函数应使用 const 修饰),共 8 个文件 +10/-10,声明与定义同步修改:

告警 文件 修复
G.CNS.03 ×1 strided_slice_v2_aicpu.h/.cpp CheckParam 补充 const(4 个被调成员均已为 const)
G.CNS.03 ×2 trans_data_aicpu.h/.cpp DealData/PaddingTwo 补充 const(依赖均为已 const 成员或自由函数)
G.CNS.03 ×1 real_div_aicpu.h/.cpp RealDivSameTypeCompute 补充 const(依赖 RealDivCompute 已 const)
G.CNS.03 ×1 mul_aicpu.h/.cpp MulSameTypeCompute 补充 const(依赖 MulCompute 已 const)

未包含项

  • trans_data 的 DispatchDealData G.CNS.04 ×3:维持 PR #5856 的误报结论(aicpu::PtrToPtr<void, T> 无 const 重载,且 output_data_temp 确实被写入,不可 const);
  • strided_slice 的 G.EXP.27 ×4:由 #3267 另行跟进。

验证

  • 二进制级对比(父提交 b7b3d0278 vs 本提交 b51424f97,同编译参数 g++ -O2 -std=c++14):4 个改动 TU 的全部非符号节(共 4598 节,含 trans_data 中 3 个 DealData 模板实例化节与 1 个字符串常量节的 _ZN→_ZNK 重命名配对比对)逐字节相同;
  • 符号差异仅为 5 处 const 化函数的修饰名变化(_ZN→_ZNK,含 _GLOBAL__sub_I 辅助符号名内嵌变化),未定义符号集合一致——零功能影响;
  • CI 流水线待跑。

关联的Issue

https://gitcode.com/cann/ops-math/issues/3272

类型

🧹 代码清理

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for liu-wei's contribution.)
liu-weiliu-weiCollaborators
Sep 21 Created pull request, commit 05df2228
liu-weiliu-weiCollaborators
Sep 21 Associated issue: [Requirement|需求建议]: 清理 strided_slice AICPU 有符号数位运算告警(G.EXP.27 ×4)
atomgit-bot
atomgit-bot
Sep 21 Comments:

变更摘要

本 PR 属于代码清理类型,针对 G.CNS.03 告警的残留项,为 5 处不修改成员变量的成员函数补充 const 修饰,涉及 conversion/strided_slice_v2、conversion/trans_data、math/mul、math/real_div 四个 AICPU 算子模块。每处修改均同步更新头文件声明与 .cpp 定义,以保证签名一致。根据 PR 描述,被修饰函数的依赖成员均已为 const 或为自由函数,二进制对比结果显示除符号修饰名由 _ZN 变为 _ZNK 外无其他差异,属于零功能影响的接口规范化。

主要改动

  • StridedSliceV2CpuKernel::CheckParam 增加 const: 在 strided_slice_v2_aicpu.h 声明与 strided_slice_v2_aicpu.cpp 定义中同步为该私有成员函数补充 const 修饰。
  • TransDataCpuKernel::DealData 模板函数增加 const: 在 trans_data_aicpu.h 声明与 trans_data_aicpu.cpp 定义中同步为模板成员函数 DealData 补充 const。
  • TransDataCpuKernel::PaddingTwo 增加 const: 同步修改 trans_data_aicpu.h 声明与 trans_data_aicpu.cpp 定义,为该成员函数补充 const。
  • MulCpuKernel::MulSameTypeCompute 增加 const: 在 mul_aicpu.h 声明与 mul_aicpu.cpp 定义中同步补充 const。
  • RealDivKernel::RealDivSameTypeCompute 增加 const: 在 real_div_aicpu.h 声明与 real_div_aicpu.cpp 定义中同步补充 const。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
Sep 21 Comments:

代码审查

✅ 未发现问题

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
Sep 21 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
Sep 21 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
conversion/trans_data ✅ 王瑞, yue-ma (2/2) ✅ 王瑞, yue-ma (2/1)
math/mul ✅ 王瑞, yue-ma (2/2) ✅ 王瑞, yue-ma (2/1)
math/real_div ✅ 王瑞, yue-ma (2/2) ✅ 王瑞, yue-ma (2/1)
repo-cann/ops-math ✅ yue-ma, 王瑞 (2/2) ✅ yue-ma, 王瑞 (2/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
CANN-robotCANN-robotCollaborators
Sep 21 Set FelixTang7,yue-ma,zhou-qilong,wangrui_,rxtfeng,loov1,zhangzijie,jia0liang,zl_hw,songkai111,chenxingyu18,pingchuantang,llimwang,gubaocheng,andong_hw,xuejinghui,zhanw_coding as approver
CANN-robotCANN-robotCollaborators
Sep 21 Set FelixTang7,yue-ma,zhou-qilong,wangrui_,rxtfeng,loov1,zhangzijie,jia0liang,zl_hw,songkai111,chenxingyu18,pingchuantang,llimwang,gubaocheng,andong_hw,xuejinghui,zhanw_coding as approver
liu-weiliu-weiCollaborators
Sep 21 Modify description of pull request
liu-wei
liu-weiCollaborators
Sep 21 Comments:

compile

likedislike
liu-weiliu-weiCollaborators
Sep 21 Pre merge succeeded (commit_id: 5327625e33498660cea05b52aa8926ed0e8b514b)
CANN-robot
CANN-robotCollaborators
Sep 21 Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
Sep 21 Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 21 Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 21 Added label: ci-pipeline-passed
RuiWang_Collaborators
Sep 21 Comments:

/lgtm
/approve

likedislike
CANN-robotCANN-robotCollaborators
Sep 21 Added label: approved
yue-maCollaborators
Sep 21 Comments:

/lgtm
/approve

likedislike
CANN-robotCANN-robotCollaborators
Sep 21 Added label: lgtm
CANN-robotCANN-robotCollaborators
Sep 21 Merged pull request