Merged
fix(operation): Clamp GM accumulation K view shape to remaining K [9.2.0] #6447
fix(operation): Clamp GM accumulation K view shape to remaining K [9.2.0] #6447
Merged
li_qingyanAdd on Sep 17
li_qingyan
li_qingyanCollaborators
Sep 17

同步自 master 分支(基线 upstream/9.2.0,涉及文件两分支无差异,干净落位)。

问题

GM 累加(splitK)路径 ComputeGmAccumulationKernel 中,当 K 不是 L1 tile 整数倍时,K 尾块 A/B tensor 的 View shape 仍声明整块 kL1Size,超出实际剩余 K 数据(仅 validShape 裁剪),块尺寸与真实数据范围不匹配,存在越界读取/构图语义错误风险。

方案

新增 kViewShape = min(kSize2D - kL1Size * kIdx, kL1Size),A/B tensor View shape 由 kL1Size 改为 kViewShape(transA/transB 4 处布局同步);partialKValidShape 裁剪上限同步改为 kViewShape。

总计 1 个文件,+6/-5。

校验

UT:DynamicMatmulUTest.mm_A_B_ND_KSplit_bf16(GM 累加路径)单跑通过;Matmul 相关 UT 套件结果与未改动基线一致(既有用例间污染失败非本改动引入)。

Related Issue: #3364

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for li_qingyan's contribution.)
li_qingyanli_qingyanCollaborators
Sep 17 Created pull request, commit 9128ad2e
li_qingyanli_qingyanCollaborators
Sep 17 Associated issue: [Bug|缺陷]: GM累加路径K尾块View的shape未按剩余K裁剪,块尺寸超出实际数据范围
atomgit-bot
atomgit-bot
Sep 17 Comments:

变更摘要

本 PR 针对 GM 累加(splitK)路径的 ComputeGmAccumulationKernel 函数,修复 K 不是 L1 tile 整数倍时尾块 A/B tensor 的 View shape 声明与实际剩余 K 数据不匹配的问题。改动引入 kViewShape,将尾块 View 的 K 维由整块 kL1Size 收敛为实际剩余 K,并同步调整 partialKValidShape 的裁剪上限,避免块尺寸超出真实数据范围。

主要改动

  • 新增 kViewShape 计算: 通过 min(kSize2D - kL1Size * kIdx, kL1Size) 得到每个 K 迭代块的实际有效 K 长度,使尾块不再声明整块 kL1Size。
  • A tensor View shape 调整: transA 与非 transA 两种布局下,View 的 K 维由 kL1Size 改为 kViewShape,与真实剩余 K 数据范围一致。
  • B tensor View shape 调整: transB 与非 transB 两种布局下,View 的 K 维由 kL1Size 改为 kViewShape,与 A tensor 侧同步。
  • partialKValidShape 裁剪上限同步: 由 Min(SymbolicScalar(kL1Size)) 改为 Min(SymbolicScalar(kViewShape)),使 validShape 裁剪上限与新的 View shape 保持一致。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
Sep 17 Comments:

代码审查

✅ 未发现问题

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
Sep 17 Added label: stat/needs-squash
CANN-robotCANN-robotCollaborators
Sep 17 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
Sep 17 Comments:

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
framework/src/interface/operation ✅ shi-dingkun, dai-zhentao (2/2) ✅ dai-zhentao (1/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
CANN-robotCANN-robotCollaborators
Sep 17 Set xinweiliu,cam_bxh,dai-zhentao,lululu40888,shi-dingkun,gguuaanngg,codehjp423,gaoxiang618,wangzheng97,DCGDDD,syfeng,jason_yuan_ye,foundea,ym-HW,hw_zhangzhiqi,yinjie27_,congqiannan,zhangyuebing,tsungl4,gaoxingwang,zhiweiyuan,caodongdong,make_pto,zhoubotcam,linjiashu,wangbing110,WenboCodes as approver
CANN-robotCANN-robotCollaborators
Sep 17 Set xinweiliu,cam_bxh,dai-zhentao,lululu40888,shi-dingkun,gguuaanngg,codehjp423,gaoxiang618,wangzheng97,DCGDDD,syfeng,jason_yuan_ye,foundea,ym-HW,hw_zhangzhiqi,yinjie27_,congqiannan,zhangyuebing,tsungl4,gaoxingwang,zhiweiyuan,caodongdong,make_pto,zhoubotcam,linjiashu,wangbing110,WenboCodes as approver
li_qingyanli_qingyanCollaborators
Sep 17 Pre merge succeeded (commit_id: 29d349f6e84b6896b8d5a2044003ac4c9f92e5f8)
li_qingyanli_qingyanCollaborators
Sep 17 Pre merge succeeded (commit_id: f097912ff614a4298e7596fca15e61bb47c651ec)
CANN-robotCANN-robotCollaborators
Sep 17 Removed label: cann-cla/yes
CANN-robotCANN-robotCollaborators
Sep 17 Removed label: stat/needs-squash
CANN-robot
CANN-robotCollaborators
Sep 17 Comments:

Notification

This pull request has been changed(code update) or closed, so removes the following label(s): stat/needs-squash.

likedislike
CANN-robotCANN-robotCollaborators
Sep 17 Added label: cann-cla/yes
CANN-robotCANN-robotCollaborators
Sep 17 Removed approver lululu40888,codehjp423,gaoxiang618,wangzheng97,DCGDDD,syfeng,jason_yuan_ye,foundea,ym-HW,hw_zhangzhiqi,congqiannan,zhangyuebing,gaoxingwang,zhiweiyuan,caodongdong,zhoubotcam,wangbing110,WenboCodes
li_qingyanli_qingyanCollaborators
Sep 17 Modify description of pull request
li_qingyan
li_qingyanCollaborators
Sep 18 Comments:

compile

likedislike
li_qingyanli_qingyanCollaborators
Sep 18 Pre merge succeeded (commit_id: c0d443a68a5cd6359fa658e010098ecc76a39849)
CANN-robot
CANN-robotCollaborators
Sep 18 Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
Sep 18 Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 18 Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 18 Added label: ci-pipeline-passed
shi-dingkun
shi-dingkunCollaborators
Sep 18 Comments:

/lgtm

likedislike
li_qingyanli_qingyanCollaborators
Sep 18 Modify description of pull request
dai-zhentao
dai-zhentaoCollaborators
Sep 18 Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
Sep 18 Added label: lgtmapproved
CANN-robotCANN-robotCollaborators
Sep 18 Merged pull request