已合并
adaptivemaxpool3dgradxA5上性能问题修复 #6799
adaptivemaxpool3dgradxA5上性能问题修复 #6799
已合并
胡一航创建于 6月30日
胡一航成员
6月30日

描述

adaptivemaxpool3dgradxA5上性能问题修复,对于输出点小的case也尽可能的使用更多的核

关联的Issue

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

测试

atk

文档更新

类型标签

AI/Agent生成声明

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 胡一航 的贡献)
胡一航成员
6月30日 创建了 pull request,commit de5e4786
胡一航成员
6月30日 关联了issue:[Bug-Report|缺陷反馈]: aclnnAdaptiveMaxPool3dBackward算子存在用例A5性能劣化于A2/A3
CANN-robotCANN-robot成员
6月30日 添加了label:stat/needs-squash
CANN-robotCANN-robot成员
6月30日 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
6月30日 评论:

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
pooling 刘闯, 范其瑞 (2/2) 刘闯 (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

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

likedislike
胡一航成员
6月30日 评论:

compile

likedislike
胡一航成员
6月30日 update merge request[project id: 7665709, iid: 6799, commit_id: 743235f32163fa389a788cc1226de1c6c889ccbe] virtual merging success
CANN-robotCANN-robot成员
6月30日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
6月30日 评论:

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

任务名称状态日志下载链接
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-06-30 19:18:20]    CI执行结束

likedislike
atomgit-bot
atomgit-bot
6月30日 评论:

变更摘要

此PR修复了 AdaptiveMaxPool3dGrad 算子在 Ascend A5 平台上的性能问题。主要改动是优化 AdaptiveMaxPool3dGradTilingSimt::PostTiling() 中的 blockNum 计算逻辑:移除了对线程数的硬编码上限 MAX_THREAD_NUM(1024),使得输出数据量较小的场景也能充分利用更多计算核,从而提升性能。

主要改动

  • 移除 MAX_THREAD_NUM 常量:删除了 static constexpr int64_t MAX_THREAD_NUM = 1024,不再将线程数硬性限制在1024以内,避免小规模输出任务无法充分利用硬件资源。
  • 重构 blockNum 计算逻辑:将原来 threads = min(outDataCount, MAX_THREAD_NUM)CeilDiv 的方式,改为 blockNum = (outDataCount == 0) ? 1 : min(outDataCount, coreNum_),使小输出点的case尽可能使用与输出数据量相等的 block 数(以 coreNum_ 为上限)。
  • 调整 blockNum 钳位顺序:将 std::maxstd::min 的调用顺序对调——先以 coreNum_ 为上限截断,再以 1 为下限截断,确保边界语义一致。
likedislike
CANN-robot
CANN-robot成员
6月30日 评论:

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

任务名称状态日志下载链接
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-06-30 19:13:46]    CI执行结束

likedislike
CANN-robotCANN-robot成员
6月30日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
6月30日 添加了label:ci-pipeline-passed
atomgit-bot
atomgit-bot
6月30日 评论:

代码审查

结束总结

优先级 数量
P0 0
P1 0
P2 0
P3 1

已审查文件pooling/adaptive_max_pool3d_grad/op_host/adaptive_max_pool3d_grad_simt_tiling.cpp — 发现1个P3级别的冗余操作(非确定性分支中 blockNum 已由第53行限制在 coreNum_ 以内,第55行重复进行了相同的上限约束)。

整体风险评估:该变更风险较低。核心变更是将非确定性分支中 blockNum 的计算方式从 CeilDiv(outDataCount, min(outDataCount, 1024)) 改为 min(outDataCount, coreNum_),并正确处理了 outDataCount == 0 的边界情况(旧代码在输入为0时 CeilDiv(0, 0) 会触发除零)。min/max 约束顺序的互换在语义上是等价的(coreNum_ ≥ 1 由基类保证)。该变更符合PR描述中"对输出点小的用例尽可能使用更多核心"的性能优化目标。

⚠️ 已识别出整体风险,但无法提取行内评论,请参考整体评估。

likedislike
FelixTang7成员
6月30日 评论:

/lgtm
/approve

likedislike
CANN-robot
CANN-robot成员
6月30日 评论:

The following users do not have permission to comment /lgtm or /approve on any module in this PR:
唐燕峰

likedislike
CANN-robot
CANN-robot成员
6月30日 评论:

The following users do not have permission to comment /lgtm or /approve on any module in this PR:
唐燕峰

likedislike
范其瑞
范其瑞成员
6月30日 评论:

/lgtm
/approve

likedislike
CANN-robot
CANN-robot成员
6月30日 评论:

The following users do not have permission to comment /lgtm or /approve on any module in this PR:
唐燕峰

likedislike
CANN-robot
CANN-robot成员
6月30日 评论:

The following users do not have permission to comment /lgtm or /approve on any module in this PR:
唐燕峰

likedislike
liuchuangdev成员
6月30日 评论:

/approve

likedislike
CANN-robot
CANN-robot成员
6月30日 评论:

The following users do not have permission to comment /lgtm or /approve on any module in this PR:
唐燕峰

likedislike
CANN-robotCANN-robot成员
6月30日 添加了label:lgtmapproved
CANN-robotCANN-robot成员
6月30日 合入了pull request