已合并
修复Gru算子执行报错问题 #9449
chenyifeng创建于 9 天前
修复Gru算子执行报错问题 #9449
已合并
chenyifeng创建于 9 天前
chenyifeng成员
9 天前

描述

修复GRU算子执行报错507015的问题,通过对其baseN,解决UB越界报错。

关联的Issue

https://gitcode.com/cann/ops-nn/issues/5403

测试

本地自验证200case没问题,问题case验证通过

文档更新

类型标签

AI/Agent生成声明

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 chenyifeng 的贡献)
Cchenyifeng成员
9 天前 创建了 pull request,commit 80d162fa
atomgit-bot
atomgit-bot
9 天前 评论:

变更摘要

本 PR 修复 Gru 算子在 rnn/gru/op_host/gru_tiling.cppGruTilingOp::GetVectorTiling() 中计算 gruParams_.baseN 时的对齐问题,并同步整改相关代码。原逻辑直接比较 singleCoreNpartUb 取较小值,未考虑按数据类型换算的块大小对齐,可能引发算子执行报错;修改后引入按 BLOCK_SIZE / gruParams_.dataType 计算的 calBlockSize,对 partUb 向下对齐、对 singleCoreN 通过 Ops::Base::CeilDiv 向上对齐后再取较小值,保证分块结果满足对齐约束。

主要改动

  • 新增按数据类型换算的块大小:新增 calBlockSize = BLOCK_SIZE / gruParams_.dataType,使对齐粒度随 dataType(如 fp16/fp32)变化,而非固定使用 32。
  • partUb 向下对齐:将 partUbcalBlockSize 向下取整对齐(partUb / calBlockSize * calBlockSize),避免分块后出现非对齐边界。
  • singleCoreN 向上对齐后参与比较:用 Ops::Base::CeilDiv(gruParams_.singleCoreN, calBlockSize) * calBlockSize 得到对齐后的 singleCoreNAlign,再与 partUb 取较小值赋给 gruParams_.baseN,修复原逻辑中未对齐导致的执行报错。
likedislike
atomgit-bot
atomgit-bot
9 天前 评论:

代码审查

✅ 未发现问题

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

CLA Signature Pass

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

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

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) 刘闯 (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)
likedislike
CANN-robotCANN-robot成员
9 天前 将zengjuan,chaotang233,kevin_huang1234,crystalhu,yangyang016,fanqirui,su-yueming,chenqi317,wang-xing001,liubo75,tangweiwei2,pingchuantang,qianzehong,liuchuangdev设为评审人
CANN-robotCANN-robot成员
9 天前 将kevin_huang1234,su-yueming,wang-xing001,pingchuantang,qianzehong,liuchuangdev设为审查人
Cchenyifeng成员
6 天前 修改标题为 “修复Gru算子执行报错问题”,原标题为“修复Gru算子执行报错问题以及整改cleancode”
chenyifeng成员
6 天前 评论:

compile

likedislike
Cchenyifeng成员
6 天前 update merge request[project id: 7665709, iid: 9449, commit_id: 616cf5a69c1c1cefc8fce0cd1e8e0adf62797809] virtual merging success
CANN-robotCANN-robot成员
6 天前 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
6 天前 评论:

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

任务名称状态日志下载链接
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-31 15:24:36]    CI执行结束

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

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

任务名称状态日志下载链接
antipoison ✅ SUCCESS >>>>>
codecheck_checkpr ✅ SUCCESS
codecheck_precommit ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
StaticCheck_md ✅ SUCCESS

[2026-08-31 15:12:45]    CI执行结束

likedislike
CANN-robotCANN-robot成员
6 天前 添加了label:api-check-pass
CANN-robotCANN-robot成员
6 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
6 天前 添加了label:ci-pipeline-passed
Cchenyifeng成员
6 天前 修改了pull request 的描述
liuchuangdev成员
6 天前 评论:

/approve

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

/lgtm
/approve

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