Closed
[Bug|缺陷]: GM累加路径K尾块View的shape未按剩余K裁剪,块尺寸超出实际数据范围 #3364
li_qingyanAdd on Sep 17Closed at Sep 18
Sep 17 Associated pull request
Sep 17 Associated pull request
Sep 17 Modify description of issue
Sep 17 Modify description of issue
shi-dingkun
Sep 18 Comments:
Sep 18 Comments:
/assgin li_qingyan


Sep 18 changed custom state from 进行中 to 已完成
Sep 18 Close issue
Sep 18 Added label: resolved
对应修改:PR #6446(master)/ PR #6447(9.2.0)(fix(operation): Clamp GM accumulation K view shape to remaining K)
Background(背景信息) (Mandatory / 必填)
Matmul 在
enableSplitK且 validK concrete 时走 GM 累加路径(ComputeGmAccumulationKernel,cube_operation_impl.cpp),按 L1 tile(kL1TileShape)循环切 K。当 K 不是 L1 tile 的整数倍时,K 尾块(最后一个 kIdx)实际剩余数据kSize2D - kL1Size * kIdx小于整块kL1Size,但该尾块 A/B tensor 的View声明的 shape 仍为整块尺寸kL1Size(仅 validShape 做了 0~kL1Size 裁剪):Origin(信息来源) (Mandatory / 必填)
matmul GM 累加路径代码检视发现:
ComputeGmAccumulationKernel中 K 尾块View(aTensor2D, {kL1Size, mSize2D}, ...)(及 trans 布局共 4 处)shape 未随尾块收缩。Fix(修复方案)
kViewShape = min(kSize2D - kL1Size * kIdx, kL1Size),A/B tensor 的 View shape 由kL1Size改为kViewShape(transA/transB 4 处布局同步);partialKValidShape裁剪上限由kL1Size改为kViewShape,保证 validShape 不超过块尺寸。Verification(验证方式)
UT:GM 累加路径用例
DynamicMatmulUTest.mm_A_B_ND_KSplit_bf16单跑通过;Matmul 相关 UT 套件(MatmulOperationTest/DynamicMatmulUTest/TensorOpsMatmulTest)与未改动基线结果一致(既有用例间状态污染失败非本改动引入)。