已合并
fix cleancode include:assign,mem_set,split_v,tensor_move,adds,power #5264
csz创建于 8月31日
fix cleancode include:assign,mem_set,split_v,tensor_move,adds,power #5264
已合并
csz创建于 8月31日
 csz
csz
8月31日

描述

cleancode整改 涉及assign,mem_set,split_v,tensor_move,adds,power算子
主要整改内容:去除保留标识符;修改难以理解的字面常量;删除不用的代码段;合理安排空行;避免使用reinterpret_cast;不向全局命名空间中导入符号

关联的Issue

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

测试

冒烟通过
白盒用例验证通过

文档更新

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 csz 的贡献)
 csz csz
8月31日 创建了 pull request,commit 139736d4
atomgit-bot
atomgit-bot
8月31日 评论:

变更摘要

该 PR 为 mem_set 算子在 arch35 平台上的 tiling 处理代码做清理重构(PR 标题为 "fix cleancode"),仅修改 conversion/mem_set/op_host/arch35/mem_set_tiling_arch35.cpp。核心思路是将 MemSetTilingClass::PostTiling() 中散落的魔法数字(1~256 的 tiling 计数)提取为具名常量,并用这些常量替换 validNums 列表及 switch 分支中的字面量,使代码可读性和可维护性提升。

主要改动

  • 新增 tiling 计数常量定义: 在文件头部新增 TILING_COUNT_1 至 TILING_COUNT_256 共 21 个 constexpr int 常量,覆盖 {1, 2, ..., 16, 32, 64, 128, 192, 256} 全部取值,用于替代后续代码中的魔法数字。
  • 重构 validNums 列表: PostTiling() 中的 validNums 向量由字面量列表改为引用上述具名常量,且将单行展开为多行排列,消除重复的字面量写法。
  • 重构 switch 分支调用: PostTiling() 内根据 targetNum 的 switch 语句中,所有 case 分支及其 PostDo<Count>() 模板调用(如 PostDo<TILING_COUNT_1>())统一改为使用具名常量。
  • 修正分支值与模板参数不一致问题: 原代码中 case 196 调用 PostDo<196>(),但 validNums 列表实际包含的是 192;本次改为 case TILING_COUNT_192 并调用 PostDo<TILING_COUNT_192>(),使分支值与 validNums 保持一致,修复了该取值路径下 switch 可能无法命中分支的问题。
likedislike
不准确?
atomgit-bot
atomgit-bot
8月31日 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
CANN-robotCANN-robot成员
8月31日 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
8月31日 评论:

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/split_v ✅ 汤平川, 宋恺 (2/2) ✅ 汤平川 (1/1)
conversion/tensor_move ✅ 汤平川, 宋恺 (2/2) ✅ 汤平川 (1/1)
repo-cann/ops-math ✅ 汤平川, 宋恺 (2/2) ✅ 汤平川 (1/1)

💡 Tip:

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

CLA Signature Pass

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

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

/lgtm

likedislike
CANN-robotCANN-robot成员
27 天前 添加了label:lgtm
CANN-robotCANN-robot成员
27 天前 关闭了关联的issue
CANN-robotCANN-robot成员
27 天前 合入了pull request