Pull Request已成功合入, 合并人@CANN-robot
(感谢 sikaiwei 的贡献)变更摘要
此 PR 为 MaxPool3DGrad 算子的 SIMT Tiling 实现新增了 CALCULATED 填充模式的支持。在 MaxPool3DGradSimtTiling::GetShapeAttrsInfo() 方法中,补丁添加了一个 else if 分支,当 padModeStr 为 "CALCULATED" 时,从属性中读取 PADDING_POS 列表并直接提取深度、高度和宽度方向的 padding 值。
主要改动
- 新增 CALCULATED 填充模式分支:在
max_pool3d_grad_simt_tiling.cpp的GetShapeAttrsInfo()中,为padModeStr == "CALCULATED"情况增加了else if分支,使得该模式下的 padding 计算逻辑得以生效。 - 直接读取 padding 属性值:新增分支中通过
attrs->GetListInt(PADDING_POS)->GetData()获取 padding 列表,并将padsD、padsH、padsW分别赋值为列表的第 0、2、4 个元素,从而绕过原本的自动计算逻辑。


代码审查
审查总结
已审查文件:
pooling/max_pool3d_grad/op_host/arch35/max_pool3d_grad_simt_tiling.cpp— 发现 3 个问题
问题统计:
| 优先级 | 数量 | 说明 |
|---|---|---|
| P0 | 1 | 编译错误:attrs 应为 runtimeAttrs |
| P1 | 1 | 运行时崩溃风险:GetListInt 返回值缺少空指针检查 |
| P2 | 1 | 越界读取风险:未校验 pads 向量长度 |
整体风险评估: 此变更为 MaxPool3DGrad 新增 CALCULATED padding 模式支持,核心逻辑(索引选取、padding 赋值)正确,但存在一个编译级错误(变量名拼写错误)导致代码无法编译通过,以及缺少与同仓库内参考实现一致的空指针检查和长度校验,存在运行时崩溃/越界风险。建议在修复 P0 编译错误的同时补全防御性检查。
| 类型 | 数量 |
|---|---|
| 🔴 阻塞 | 2 |
| 🟡 建议 | 0 |
⛔ 需要修改


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
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 |
|---|---|---|
| */*/README.md | ✅ 陈娇, 刘波 (2/2) | ✅ 陈娇 (1/1) |
| pooling | ✅ 刘波, 刘闯 (2/2) | ✅ 刘闯 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
sikaiwei, thanks for your pull request. All authors of the commits have signed the CLA. 👍


Pull Request 已合并或已关闭。
If you want to solve this problem, you can click here to do it in the FAQs.


描述
MaxPool3DGrad算子新增支持CALCULATED功能
关联的Issue
https://gitcode.com/cann/ops-nn/issues/4788
测试
白盒用例、冒烟等均已通过
文档更新
类型标签
AI/Agent生成声明