已合并
fix: 修复 GRU 与 GRU 反向算子 aclnn 接口的编码规范告警 #9180
fix: 修复 GRU 与 GRU 反向算子 aclnn 接口的编码规范告警 #9180
已合并
Nice try创建于 15 天前
Nice try
Nice try成员
15 天前

描述

修复 GRU 算子(rnn/gru/op_api/aclnn_gru.cpp)与 GRU 反向算子(rnn/gru_grad/op_api/aclnn_gru_backward.cpp)aclNN 接口的编码规范(cleancode)告警:

  1. CheckNotNull、CheckDimsSize 中未使用的 hx 参数,以及无调用点的 GruDataGetWorkspaceSize 函数添加 [[maybe_unused]] 标记,消除未使用告警;
  2. CheckShape 中 dScale(uint64_t)与 numLayers、hiddenSize(int64_t)的混合符号运算显式 static_cast 为 int64_t,消除符号转换告警;
  3. 修复 aclnn_gru_backward.cpp ValidateShape 中日志格式符错误(%u 改为 %zu,GetDimNum 返回 64 位无符号值),并移除多余的 static_cast 消除符号比较告警。

关联的Issue

关联 Issue https://gitcode.com/cann/ops-nn/issues/5129

测试

通过编码规范(cleancode)检查。

文档更新

无。

类型标签

AI/Agent生成声明

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 Nice try 的贡献)
Nice tryNice try成员
15 天前 创建了 pull request,commit 3b20997e
atomgit-bot
atomgit-bot
15 天前 评论:

变更摘要

本 PR 主要针对 GRU 算子的 aclnn_gru.cppaclnn_gru_backward.cpp 进行代码规范(cleancode)修复,不涉及业务逻辑改动:通过 [[maybe_unused]] 标注未使用的参数/函数消除编译告警,通过显式 static_cast<int64_t> 统一形状计算中的类型转换,并修正日志输出中的格式说明符使其与实参类型匹配。

主要改动

  • 未使用参数标注: 在 aclnn_gru.cppCheckNotNullCheckDimsSize 中对未实际使用的 hx 参数添加 [[maybe_unused]] 修饰,并将 GruDataGetWorkspaceSize 函数声明为 [[maybe_unused]],用于消除编译告警
  • 形状计算显式类型转换: 在 CheckShape 中,将 expHxShapeexpOutputShapeexpHyShape 内涉及 dScaleuint64_t)的运算显式转换为 static_cast<int64_t>,使类型一致
  • 维度比较与日志格式修正: 在 aclnn_gru_backward.cppValidateShape 中移除多余的 static_cast<int64_t> 比较,并将 OP_LOGE 中描述维度的格式说明符由 %u 改为 %zu,与 GetDimNum() 的实际返回类型匹配
likedislike
不准确?
atomgit-bot
atomgit-bot
15 天前 评论:

代码审查

✅ 未发现问题

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

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
rnn 汤平川, 钱泽洪 (2/2) 汤平川, 钱泽洪 (2/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)
likedislike
CANN-robot
CANN-robot成员
15 天前 评论:

CLA Signature Pass

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

likedislike
CANN-robotCANN-robot成员
15 天前 将zengjuan,chaotang233,kevin_huang1234,crystalhu,yangyang016,fanqirui,su-yueming,chenqi317,wang-xing001,liubo75,tangweiwei2,pingchuantang,qianzehong,liuchuangdev设为评审人
CANN-robotCANN-robot成员
15 天前 将kevin_huang1234,su-yueming,wang-xing001,pingchuantang,qianzehong,liuchuangdev设为审查人
Nice tryNice try成员
15 天前 修改标题为 “fix: 修复 GRU 与 GRU 反向算子 aclnn 接口的编码规范告警”,原标题为“fix cleancode problem”
Nice tryNice try成员
15 天前 修改了pull request 的描述
Nice try
Nice try成员
15 天前 评论:

compile

likedislike
Nice tryNice try成员
15 天前 update merge request[project id: 7665709, iid: 9180, commit_id: e53311aee94fa85bcaffb4be56e3728e1178785e] virtual merging success
CANN-robotCANN-robot成员
15 天前 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
15 天前 评论:

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

任务名称状态日志下载链接
Compile_Ascend_X86_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_950 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_950 ✅ SUCCESS >>>>> >>>>>
Compile_Pre ✅ SUCCESS >>>>>
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_950_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_experimental_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_950_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910b ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910c ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_950 ✅ SUCCESS >>>>> >>>>>
Compile_classify ✅ SUCCESS >>>>>
Compile_Ascend_X86_mobile_station_9030_ubuntu24 ✅ SUCCESS >>>>> >>>>>
UT_Test_ophost ✅ SUCCESS
UT_Test_opapi ✅ SUCCESS
UT_Test_kernel ✅ SUCCESS
UT_Test_opgraph ✅ SUCCESS
PreSmoke_A900 ✅ SUCCESS >>>>>
API_Check ✅ SUCCESS >>>>>
PreSmoke_ATK_Test_A2 ✅ SUCCESS >>>>>
UT_Test_report_lcov ⚠️ WARNING >>>>>

[2026-08-25 16:16:41]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
15 天前 评论:

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

任务名称状态日志下载链接
antipoison ✅ SUCCESS >>>>>
codecheck_checkpr ✅ SUCCESS
StaticCheck_codespell ✅ SUCCESS
StaticCheck_link_validity ✅ SUCCESS
StaticCheck_resource_existence ✅ SUCCESS
StaticCheck_tag_closed ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
codecheck_precommit ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>

[2026-08-25 16:06:55]    CI执行结束

likedislike
CANN-robotCANN-robot成员
15 天前 添加了label:api-check-pass
CANN-robotCANN-robot成员
15 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
15 天前 添加了label:ci-pipeline-passed
qianzehong成员
15 天前 评论:

/approve

likedislike
CANN-robotCANN-robot成员
15 天前 添加了label:approved
TangPC
TangPC成员
15 天前 评论:

/lgtm
/approve

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