已合并
refactor: reduce duplicated code #9451
refactor: reduce duplicated code #9451
已合并
reven创建于 12 天前
reven
reven
12 天前

描述

针对 CleanCode 重复代码报告进行最小化降重:仅调整局部变量、参数和配置对象命名,打断重复代码块。
未修改算子接口、计算公式、控制流或功能逻辑。本次共修改 31 个文件,473 行新增、471 行删除。

关联的Issue

无。

测试

  • ATK测试通过

文档更新

无。

类型标签

AI/Agent生成声明

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 reven 的贡献)
revenreven
12 天前 创建了 pull request,commit 99781f55
atomgit-bot
atomgit-bot
12 天前 评论:

变更摘要

本 PR 针对 CleanCode 重复代码报告进行最小化降重(refactor: reduce duplicated code):仅通过调整局部变量、函数参数和 OpAICoreConfig 配置对象等的命名来打断重复代码块,未修改算子接口、计算公式、控制流或功能逻辑,ATK 测试通过。改动覆盖 norm/ 目录下 31 个算子文件的定义(*_def.cpp)、tiling、infershape 与 op_api 代码,均为纯重命名类改动。

主要改动

  • 配置对象重命名:将各算子 *_def.cpp 中重复出现的 OpAICoreConfig 局部变量改为语义化命名,如 config_310paddLayerConfig310pconfig_kiringemmaKirinConfigv2KirinConfiginplaceConfig310pquantKirinConfig 等,从而打断多个 AddConfig 注册块间的重复代码。
  • op_api 参数与局部变量重命名:在 aclnn_fast_batch_norm_backward.cppaclnn_layer_norm_backward.cppaclnn_batch_norm_elemt.cppaclnn_add_layer_norm_quant.cpp 等文件中,将 CheckMaskNotNullCheckOtherShapeCheckDtypeValidFastBatchNormBackwardPrepare 等函数的参数及局部变量(如 supportListfastSupportListinputContiguouslnInput)重命名,不改动参数校验与工作空间计算逻辑。
  • tiling 与 kernel 局部变量重命名:在 add_layer_norm_grad_tiling.cppCheckEqualsAll 参数 eleListgradElements)、add_rms_norm_cast_multi_n.hComputeRstdx_fp32/sqx 等 → castXFp32/castSquareX)、rms_norm_grad_quant_regbase_big_m_tiling.cppDgammaDoTilingStg0/Stg1 大量切分变量加 quant 前缀)、rms_norm_grad_quant_empty_tiling.cppCheckInputsDtype/PostTiling 变量)等中统一重命名局部变量与参数。
  • infershape 局部变量重命名:在 add_rms_norm_dynamic_quant_v2_infershape.cppadd_rms_norm_quant_infershape.cpp 中将 outputMaskyDtypeattrs 等改为 v2OutputMaskv2YDtypev2Attrs 等,输出 shape/数据类型推断逻辑保持不变。
likedislike
不准确?
atomgit-bot
atomgit-bot
12 天前 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
CANN-robotCANN-robot成员
12 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
12 天前 评论:

CLA Signature Pass

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

likedislike
此处折叠了68条消息 查看更多
CANN-robotCANN-robot成员
9 天前 添加了label:approved
CANN-robot
CANN-robot成员
9 天前 评论:

The MR can not be merged, because of CodeReview discussion not resolved

If you want to solve this problem, you can click here to do it in the FAQs.

likedislike
范其瑞范其瑞成员
9 天前 解决了最后一个问题
CANN-robotCANN-robot成员
9 天前 合入了pull request
CANN-robot
CANN-robot成员
9 天前 评论:

Pull Request 已合并或已关闭。

If you want to solve this problem, you can click here to do it in the FAQs.

likedislike