Pull Request已成功合入, 合并人@CANN-robot
(感谢 高维健 的贡献)变更摘要
该 PR 修复了 Conv:WeightUbTrans 中 NDDMA 数据传输的维度配置错误。原实现使用 2 维 NDDMA(NDDMA_DIMS_NO_TRANS)进行权重 UB 转置的搬运,导致循环层级和步长设置不正确。此变更将 NDDMA 维度切换为 3 维(NDDMA_DIMS),重新组织了三层循环的参数分配(Loop0 负责卷积核空间维度 kernelHxkernelW,Loop1 负责 K 维分步,Loop2 负责 N 维分步),并相应调整了 currentUbKStep 的计算方式以匹配新的循环语义。
主要改动
- 移除
NDDMA_DIMS_NO_TRANS常量,统一使用NDDMA_DIMS(3维):在conv_util.h中删除了NDDMA_DIMS_NO_TRANS = 2常量,确保 NDDMA 调用统一使用 3 维配置。 - 重构 NDDMA 循环参数为三层结构:在
conv2d_v2_instr_weight_ub_trans_impl.h中,将原来的两层 NDDMA 循环扩展为三层——Loop0 遍历kernelHxkernelW,Loop1 遍历currentUbKStep,Loop2 遍历currentUbNStep,MultiCopyParams和DataCopy模板参数从NDDMA_DIMS_NO_TRANS改为NDDMA_DIMS。 - 在
LoadGM2UBAlign中补偿currentUbKStep:新增currentUbKStep *= kernelHxkernelW,使对齐搬运的步长与新的循环维度语义保持一致。 - 修正
currentUbKStep的计算:在conv2d_v2_weight_ub_trans_impl.h中,将尾块和正常路径下的currentUbKStep计算改为除以kernelHxkernelW,并同步调整currentKLoopRpSize的对齐计算。


代码审查
审查总结
| 优先级 | 数量 | 说明 |
|---|---|---|
| P0 | 0 | — |
| P1 | 0 | — |
| P2 | 0 | — |
| P3 | 2 | 注释不匹配 + 缺少可除尽断言 |
各文件审查结果:
conv/common/op_kernel/arch35/conv_util.h:无问题。仅删除了NDDMA_DIMS_NO_TRANS = 2常量,全仓无残留引用,清理干净。conv/conv2d_v2/op_kernel/arch35/conv2d_v2_instr_weight_ub_trans_impl.h:1 个 P3 问题(第 58-61 行注释与实际NDDMA_LOOP*_INDEX不匹配)。NDDMA 从 2D 切换到 3D 的逻辑推导正确:Loop0 承担kernelHxkernelW维度(静态参数仅首轮设置),Loop1/Loop2 承担 K/N 维度(每轮动态更新),LoadGM2UBAlign中的*=kernelHxkernelW乘回操作安全且正确。conv/conv2d_v2/op_kernel/arch35/conv2d_v2_weight_ub_trans_impl.h:1 个 P3 问题(第 252-256 行除法缺少可除尽断言)。currentUbKStep的新语义(除以kernelHxkernelW)与currentKLoopRpSize的AlignB对齐公式经数学验证与旧代码等价的总体数据传输量,k0对齐策略比旧代码更精确地匹配下游TransND2NZ的处理粒度。
整体风险评估:低风险。 核心逻辑正确,NDDMA 维度扩展的一致性好。两个 P3 问题均属于可改进项,不影响正确性。
⚠️ 已识别出整体风险,但无法提取行内评论,请参考整体评估。


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 |
|---|---|---|
| conv | ✅ 王慈孟, 唐玮玮 (2/2) | ✅ 王慈孟 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)


compile


流水线任务触发成功
任务链接 [b465c655b0f04b998dc79dd8d848e030][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| 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 | >>>>> | |
| 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_harmony-infer-chs-nn | ✅ SUCCESS | ||
| UT_Test_report_lcov | ✅ SUCCESS | >>>>> |
[2026-07-13 17:56:29] CI执行结束


流水线任务触发成功
任务链接 [e1f0b827b4b740c8af1e03429bd48e18][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_checkpr | ✅ SUCCESS | ||
| StaticCheck_codespell | ✅ SUCCESS | ||
| StaticCheck_link_validity | ✅ SUCCESS | ||
| StaticCheck_resource_existence | ✅ SUCCESS | ||
| StaticCheck_tag_closed | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_style | ✅ SUCCESS | >>>>> | |
| codecheck_precommit | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> |
[2026-07-13 17:22:46] CI执行结束


/reject


| Time | Name | Result | Link |
|---|---|---|---|
| 2026-07-13 18:02:20 | Trigger_SC | :white_check_mark: SUCCESS | 20260713_180617486 |


| Time | Name | Result | Link |
|---|---|---|---|
| 2026-07-13 18:07:26 | Trigger_RDV | :white_check_mark: SUCCESS | 20260713_181123778 |


| Time | Name | Result | Link | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2026-07-14 14:54:43 | commit | 2026-07-13T17:16:05+08:00 | a533c48a | ||||||||||||||||||||||||||||||||||||
| Compile_Result | :x: NOT_RUN | ||||||||||||||||||||||||||||||||||||||
| SC_Result | :white_check_mark: SUCCESS | >>> | |||||||||||||||||||||||||||||||||||||
| RDV_Result:ALL | :x: RUNNING | >>> | |||||||||||||||||||||||||||||||||||||
|


/lgtm
/approve


/lgtm
/approve


compile


流水线任务触发成功
任务链接 [0460a99ca2ca435985b10ae61cae56c5][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| 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 | >>>>> | |
| 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_harmony-infer-chs-nn | ✅ SUCCESS | ||
| UT_Test_harmony-infer-chs-nn-1 | ✅ SUCCESS | ||
| UT_Test_report_lcov | ✅ SUCCESS | >>>>> |
[2026-07-20 15:09:24] CI执行结束


流水线任务触发成功
任务链接 [bf237cb2385e4469bf6b29c551234942][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_checkpr | ✅ SUCCESS | ||
| StaticCheck_codespell | ✅ SUCCESS | ||
| StaticCheck_link_validity | ✅ SUCCESS | ||
| StaticCheck_resource_existence | ✅ SUCCESS | ||
| StaticCheck_tag_closed | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_style | ✅ SUCCESS | >>>>> | |
| codecheck_precommit | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> |
[2026-07-20 14:31:40] CI执行结束


/lgtm
/approve


描述
卷积正向WieghtUbTrans模板在k轴尾块Ci不满足C0对齐时需要配置loopRpSize补0,补齐大小为Ci补 * kh * kw,若kh*kw较大,会超出loopRpSize的支持范围:[0-255],三数值溢出不符合预期,导致部分内存未初始化,偶现精度失败nan。
关联的Issue
#4168
测试
针对相关问题,修复后多次压测,已稳定通过
文档更新
类型标签
AI/Agent生成声明