已合并
fix cleancode include:assign,mem_set,split_v,tensor_move,adds,power #5264
csz创建于 14 天前
fix cleancode include:assign,mem_set,split_v,tensor_move,adds,power #5264
已合并
Pull Request已成功合入, 合并人@CANN-robot
(感谢 csz 的贡献)atomgit-bot
14 天前 评论:
14 天前 评论:
变更摘要
该 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可能无法命中分支的问题。


不准确?
atomgit-bot
14 天前 评论:
14 天前 评论:
14 天前 添加了label:cann-cla/yes
CANN-robot
14 天前 评论:
14 天前 评论:
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
/approveor/lgtm- Commenting
/approveimplies 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. 👍


此处折叠了63条消息 查看更多
11 天前 添加了label:approved
songkai111
11 天前 评论:
11 天前 评论:
/lgtm


11 天前 添加了label:lgtm
11 天前 关闭了关联的issue
11 天前 合入了pull request
描述
cleancode整改 涉及assign,mem_set,split_v,tensor_move,adds,power算子
主要整改内容:去除保留标识符;修改难以理解的字面常量;删除不用的代码段;合理安排空行;避免使用reinterpret_cast;不向全局命名空间中导入符号
关联的Issue
https://gitcode.com/cann/ops-math/issues/3006
测试
冒烟通过
白盒用例验证通过
文档更新
类型标签