已关闭
[Bug-Report|缺陷反馈]: fused_matmul算子ADD/MUL路径steamk模板n方向非对齐问题 #3282
xiaotianxiang创建于  6月10日关闭于  6月12日
xiaotianxiang
xiaotianxiang
6月10日 创建

Thanks for sending an issue! Please fill in the following template to help quickly solve your problem.

Describe the current behavior / 问题描述 (Mandatory / 必填)

fused_matmul算子ADD/MUL路径steamk模板当N方向数据32字节非对齐时,会出现NPU Fail

Environment / 环境信息 (Mandatory / 必填)

Ascend 910_95(V310)/A5

Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)

fused_matmul算子op_ytpe=ADD/MUL跑steamk模板且N方向数据32字节非对齐的shape

Describe the expected behavior / 预期结果 (Mandatory / 必填)

算子正常执行且精度pass

ScreenShot_20260610172200.PNG

Special notes for this issue/备注 (Optional / 选填)

FIXPIPE 路径:

  • curAlignedNInAiv = CeilAlign(curNL1InAiv, 16) = 256
  • workspace 中每行占 256 个元素,其中 255 个有效,1 个是 padding 垃圾
  • 搬到 UB 后保持这个布局,行间距 256 elements = 512 bytes (half) → 32B 对齐
  • burstLen = CeilAlign(mBurst * 256, 16) = mBurst * 256

非 FIXPIPE 路径:

  • curAlignedNInAiv = curNL1InAiv = 255
  • workspace 中行紧密排列,行间距就是 255,行间没有 padding
  • 搬到 UB 是一个 flat 块,burstLen = CeilAlign(mBurst * 255, 16)
  • 只有整块末尾有 CeilAlign 产生的少量 padding(如 mBurst=1 时 burstLen=256,尾部 1 个元素是垃圾)

FIXPIPE 情况下,如果把 x3 也按 curAlignedNInAiv=256 的行间距搬入 UB(DataCopyPad 自动 padding 每行到 32B 正好达成), Y 和 x3 的 UB 布局完全一致:

Y in UB: [row0: 255有效+1垃圾][row1: 255有效+1垃圾]...
x3 in UB: [row0: 255有效+1垃圾][row1: 255有效+1垃圾]...

此时可以直接 flat Add 整个 burstLen,padding 位置虽然产生垃圾,但写回 GM 时只写 curNL1InAiv=255 个有效元素,垃圾被截断丢弃。

非 FIXPIPE 情况下,Y 行间距 255,x3 auto-padding 后行间距 256,布局不匹配。

likedislike
oscillatedoscillated成员
6月10日 将 TLE_xtx 设为负责人
xiaotianxiangxiaotianxiang
6月11日 修改了issue 的描述
xiaotianxiangxiaotianxiang
6月11日 修改了issue 的描述
CANN-robotCANN-robot成员
6月12日 关闭了 issue
CANN-robotCANN-robot成员
6月12日 添加了label:resolved