已合并
【bugfix】清理cleancode问题 #3968
majiajian_hw创建于 7月10日
【bugfix】清理cleancode问题 #3968
已合并
majiajian_hw创建于 7月10日
majiajian_hw成员
7月10日

描述

修复cleancode问题:魔鬼数字、不合理cast。

关联的Issue

测试

已完成

文档更新

NA

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 majiajian_hw 的贡献)
Mmajiajian_hw成员
7月10日 创建了 pull request,commit 4bfdae05
atomgit-bot
atomgit-bot
7月10日 评论:

变更摘要

此 PR 是一个代码清理修复,移除了 random/dsa_random_normal/op_host/op_api/aclnn_normal.cpp 中两处对 executor->AllocScalar() 调用时多余的 reinterpret_cast<void*> 强制转换,以消除代码静态检查(cleancode)问题。

主要改动

  • 移除 normalDavidPath 中的冗余 reinterpret_cast:在调用 executor->AllocScalar(&alg, DataType::DT_INT32) 时,去除了 alg 变量前的 reinterpret_cast<void*>(&alg) 显式转换,简化代码。
  • 移除 normalTensorDavidPath 中的冗余 reinterpret_cast:同样地,将 executor->AllocScalar(reinterpret_cast<void*>(&alg), DataType::DT_INT32) 简化为 executor->AllocScalar(&alg, DataType::DT_INT32),消除了不必要的类型转换。
likedislike
atomgit-bot
atomgit-bot
7月10日 评论:

代码审查

✅ 未发现问题

likedislike
CANN-robotCANN-robot成员
7月10日 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
7月10日 评论:

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


PR Approval Progress

Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
conversion/npu_format_cast 张磊, wangrui_ (2/2) 张磊 (1/1)
repo-cann/ops-math 张磊, wangrui_ (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

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

likedislike
majiajian_hw成员
7月10日 评论:

compile

likedislike
Mmajiajian_hw成员
7月10日 update merge request[project id: 7649531, iid: 3968, commit_id: 4a3b4a822b236504187a73f099ec8ccf35b79f06] virtual merging success
CANN-robotCANN-robot成员
7月10日 将zhou-qilong,wangrui_,rxtfeng,loov1,zhangzijie,jia0liang,songkai111,llimwang,gubaocheng,andong_hw,zhanw_coding设为评审人
CANN-robotCANN-robot成员
7月10日 将zhou-qilong,wangrui_,rxtfeng,loov1,zhangzijie,jia0liang,songkai111,llimwang,gubaocheng,andong_hw,zhanw_coding设为审查人
CANN-robotCANN-robot成员
7月10日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
7月10日 评论:

流水线任务触发成功
任务链接 [1ed3867efce4492ca7d98d8e65c46591][流水线指导]

任务名称状态日志下载链接
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_A5_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_harmony-infer ✅ SUCCESS >>>>>
Compile_Ascend_ARM_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_experimental_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_A5_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910b ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910c ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_950 ✅ SUCCESS >>>>> >>>>>
UT_Test ✅ SUCCESS
UT_Test_experimental ✅ SUCCESS
UT_Test_kernel ✅ SUCCESS
PreSmoke_A900 ✅ SUCCESS >>>>>
API_Check ✅ SUCCESS >>>>>
PreSmoke_ATK_Test_A2 ✅ SUCCESS >>>>>
Compile_harmony-infer-chs-math ✅ SUCCESS >>>>>

[2026-07-10 09:46:29]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
7月10日 评论:

流水线任务触发成功
任务链接 [251a01ffb6b74154aba64ad3a7ce4716][流水线指导]

任务名称状态日志下载链接
codecheck ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
codecheck_Pr ✅ SUCCESS
StaticCheck_codespell_check ✅ SUCCESS
StaticCheck_link_validity_check ✅ SUCCESS
StaticCheck_resource_existence_check ✅ SUCCESS
StaticCheck_tag_closed_check ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
codecheck_codestyle ✅ SUCCESS >>>>>
codecheck_precommit ✅ SUCCESS >>>>>

[2026-07-10 09:35:20]    CI执行结束

likedislike
CANN-robotCANN-robot成员
7月10日 添加了label:api-check-pass
此处折叠了6条事件消息 查看更多
CANN-robotCANN-robot成员
7月10日 删除了label:ci-pipeline-passed
CANN-robot
CANN-robot成员
7月10日 评论:

Notification

This pull request has been changed(code update) or closed, so removes the following label(s): ci-pipeline-passed.

likedislike
CANN-robotCANN-robot成员
7月10日 将FelixTang7,zhangyuxiang0119设为评审人
CANN-robotCANN-robot成员
7月10日 将FelixTang7,zhangyuxiang0119设为审查人
majiajian_hw成员
7月10日 评论:

compile

likedislike
Mmajiajian_hw成员
7月10日 update merge request[project id: 7649531, iid: 3968, commit_id: 81f508c18dff5f78a3b5375985c23b026fca1846] virtual merging success
CANN-robotCANN-robot成员
7月10日 删除了label:api-check-pass
CANN-robotCANN-robot成员
7月10日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
7月10日 评论:

流水线任务触发成功
任务链接 [8d1f92bbc7c34cbb8b7ade5954f5d4b3][流水线指导]

任务名称状态日志下载链接
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_A5_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_harmony-infer ✅ SUCCESS >>>>>
Compile_Ascend_ARM_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_experimental_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_A5_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910b ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910c ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_950 ✅ SUCCESS >>>>> >>>>>
UT_Test ✅ SUCCESS
UT_Test_experimental ✅ SUCCESS
UT_Test_kernel ✅ SUCCESS
PreSmoke_A900 ✅ SUCCESS >>>>>
API_Check ✅ SUCCESS >>>>>
PreSmoke_ATK_Test_A2 ✅ SUCCESS >>>>>
Compile_harmony-infer-chs-math ✅ SUCCESS >>>>>

[2026-07-10 10:08:58]    CI执行结束

likedislike
Mmajiajian_hw成员
7月10日 修改了pull request 的描述
CANN-robot
CANN-robot成员
7月10日 评论:

流水线任务触发成功
任务链接 [b061f96090284c50b273576cf64f574b][流水线指导]

任务名称状态日志下载链接
codecheck ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
codecheck_Pr ✅ SUCCESS
StaticCheck_codespell_check ✅ SUCCESS
StaticCheck_link_validity_check ✅ SUCCESS
StaticCheck_resource_existence_check ✅ SUCCESS
StaticCheck_tag_closed_check ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
codecheck_codestyle ✅ SUCCESS >>>>>
codecheck_precommit ✅ SUCCESS >>>>>

[2026-07-10 10:06:36]    CI执行结束

likedislike
CANN-robotCANN-robot成员
7月10日 添加了label:api-check-pass
CANN-robotCANN-robot成员
7月10日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
7月10日 添加了label:ci-pipeline-passed
RuiWang_成员
7月10日 评论:

/lgtm

likedislike
zl_hw成员
7月10日 评论:

/lgtm
/approve

likedislike
CANN-robotCANN-robot成员
7月10日 添加了label:lgtmapproved
CANN-robotCANN-robot成员
7月10日 合入了pull request