已开启
refactor: reduce duplicated code #9451
refactor: reduce duplicated code #9451
已开启
reven创建于 2 天前
reven
reven
2 天前

描述

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

关联的Issue

无。

测试

  • ATK测试通过

文档更新

无。

类型标签

AI/Agent生成声明

likedislike
合并受阻
revenreven
2 天前 创建了 pull request,commit 99781f55
atomgit-bot
atomgit-bot
2 天前 评论:

变更摘要

本 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
2 天前 评论:

代码审查

✅ 未发现问题

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

CLA Signature Pass

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

likedislike
此处折叠了62条消息 查看更多
CANN-robotCANN-robot成员
1 小时前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
1 小时前 添加了label:ci-pipeline-passed
TangPC
TangPC成员
1 小时前 评论:

/lgtm
/approve

likedislike
唐超成员
49 分钟前 评论:

/lgtm
/approve

likedislike
CANN-robotCANN-robot成员
49 分钟前 添加了label:lgtm