Pull Request已成功合入, 合并人@CANN-robot
(感谢 nextyale 的贡献)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 |
|---|---|---|
| ** | ✅ 刘波, gcw_kUomxQ2l (2/2) | ✅ gcw_kUomxQ2l (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
nextyale, thanks for your pull request. All authors of the commits have signed the CLA. 👍


流水线任务触发成功
任务链接 [ef84d2736c1f4a82909b022ab9ffcf47][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| 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_X86_monitor_910b | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910c | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_harmony-infer-chs-nn | ✅ SUCCESS | >>>>> | |
| UT_Test_ophost | ✅ SUCCESS | ||
| UT_Test_opapi | ✅ SUCCESS | ||
| UT_Test_kernel | ✅ SUCCESS | ||
| UT_Test_opgraph | ✅ SUCCESS | ||
| PreSmoke_A900 | ✅ SUCCESS | >>>>> | |
| PreSmoke_ATK_Test_A2 | ✅ SUCCESS | >>>>> |
[2026-07-03 15:09:36] CI执行结束


流水线任务触发成功
任务链接 [b464d78175aa44e2861d0a145d6a9d31][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_checkpr | ✅ SUCCESS | ||
| StaticCheck_codespell_check | ✅ SUCCESS | ||
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_style | ✅ SUCCESS | >>>>> | |
| codecheck_precommit | ⚠️ WARNING | >>>>> | >>>>> |
| SCA | ✅ SUCCESS | >>>>> |
[2026-07-03 15:04:39] CI执行结束


变更摘要
本次 PR 对 RNNGrad 类中一个超大函数进行了重构,将其内部逻辑拆分为多个职责单一的内联辅助函数。核心思路是将 UB 缓冲区初始化、数据拷贝输入、类型转换和数据拷贝输出分别提取为独立的 __aicore__ inline 方法,然后通过一个组合函数 ProcessConcatXhTask 串联调用,从而提升代码可读性和可维护性。该重构不涉及任何功能或行为变更。
主要改动
- 提取
InitConcatXhUb方法:将原函数中 UB 缓冲区指针(xUb、hUb、xFp32Ub、hFp32Ub、outXUb、outHUb)的初始化逻辑抽取为独立方法,在循环开始前调用一次完成设置。 - 提取
CopyInConcatXh方法:将 x 和 h 输入数据从 Global Memory 拷贝到 UB 的逻辑(含DataCopyExtParams构造、srcHGm条件选择及两次DataCopyPad)封装为独立方法,覆盖前向/后向及初始隐藏状态三种场景。 - 提取
CastConcatXh方法:将非float类型下的Cast类型转换逻辑(含MTE2ToVSync/VToMTE3Sync同步)与float类型下的直接同步路径统一封装为CastConcatXh。 - 提取
CopyOutConcatXh方法:将拼接后的 x 和 h 数据从 UB 写回 Global Memory 的输出逻辑(含DataCopyOutXParams/DataCopyOutHParams构造及两次DataCopyPad与同步)封装为CopyOutConcatXh。 - 新增
ProcessConcatXhTask组合方法:按顺序调用CopyInConcatXh→CastConcatXh→CopyOutConcatXh,作为单次 Task 处理的入口,原函数中的双层循环体简化为对该方法的调用。


代码审查
审查总结
已审查文件:
rnn/single_layer_lstm_grad/op_kernel/single_layer_lstm_grad.h— 发现 1 个问题(P3)
问题统计:
| 优先级 | 数量 |
|---|---|
| P0 | 0 |
| P1 | 0 |
| P2 | 0 |
| P3 | 1 |
整体风险判断:低风险。 本次变更是对 ProcessConcatXh() 超大函数的纯重构:将内联代码提取为 5 个 __aicore__ inline 辅助函数(InitConcatXhUb、CopyInConcatXh、CastConcatXh、CopyOutConcatXh、ProcessConcatXhTask)。逻辑语义、数据流管线和 GM 偏移计算均与原代码一致,无行为变更。唯一的问题是重构过程中丢失了一条关于 uint16_t 溢出保护的 TODO 注释,属于文档记录的退化,不影响运行时正确性。
⚠️ 已识别出整体风险,但无法提取行内评论,请参考整体评估。


流水线任务触发成功
任务链接 [f995ce112a1143a0a6006342e82613c1][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| 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_X86_monitor_910b | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910c | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_harmony-infer-chs-nn | ✅ SUCCESS | >>>>> | |
| UT_Test_ophost | ✅ SUCCESS | ||
| UT_Test_opapi | ✅ SUCCESS | ||
| UT_Test_kernel | ✅ SUCCESS | ||
| UT_Test_opgraph | ✅ SUCCESS | ||
| PreSmoke_A900 | ✅ SUCCESS | >>>>> | |
| PreSmoke_ATK_Test_A2 | ✅ SUCCESS | >>>>> |
[2026-07-03 16:04:55] CI执行结束


流水线任务触发成功
任务链接 [a5110ddf6f664264b7fd72be88a8862d][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_checkpr | ✅ SUCCESS | ||
| StaticCheck_codespell_check | ✅ SUCCESS | ||
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_style | ✅ SUCCESS | >>>>> | |
| codecheck_precommit | ⚠️ WARNING | >>>>> | >>>>> |
| SCA | ✅ SUCCESS | >>>>> |
[2026-07-03 16:00:56] CI执行结束


/approve


描述
关联的Issue
测试
文档更新
类型标签
AI/Agent生成声明