已关闭
[Bug-Report|缺陷反馈]: swiglu_mx_quant_with_dual_axis tiling scale2Ub 估算与 kernel 实际 UB 分配不一致 #7580
chenfeng创建于  4 天前关闭于  3 天前
chenfeng
chenfeng成员
4 天前 创建

Describe the current behavior / 问题描述

swiglu_mx_quant_with_dual_axis(arch35)存在两处问题:

1. tiling 侧 scale2Ub 估算低估 256B(UB 容量校验存在失效风险)

  • tiling 侧 ComputeTilingParams()(op_host/arch35/swiglu_mx_quant_with_dual_axis_tiling_arch35.cpp)恒按 scale2Ub = blockW * DIGIT_THREE * DB 估算(blockW=DIGIT_256、DB=2,即恒 1536B),未区分 scaleAlg 分支。
  • kernel 侧 Init()(op_kernel/arch35/swiglu_mx_quant_with_dual_axis_regbase.h)在 scaleAlg != TPL_SCALE_ALG_0(cuBLAS 路径)时 mxScaleQueue2_ 单 buffer 取 CUBLAS_SCALE2_BUFFER_BYTES,被 static_assert(... == 896U) 钉死为 896B;InitBuffer(mxScaleQueue2_, DB_BUFFER, ...) 双 buffer 实际占用 1792B。
  • 估算 1536B < 实际 1792B,低估 256B,allNeedUb 容量检查存在失效风险。

2. aclnn 文档输出「非连续Tensor」约束标注错误
docs/aclnnSwigluMxQuantWithDualAxis.md 中 y1Out/mxscale1Out/y2Out/mxscale2Out 的「非连续Tensor」列标为 √,与实际不符(输出不支持非连续 Tensor,与 dynamic_mx_quant_with_dual_axis 口径不一致),应为 ×。

Environment Information / 环境信息

  • 昇腾硬件型号:arch35 / DAV_3510(依据:算子实现位于 op_host/arch35、op_kernel/arch35,kernel 注释含 "DAV_3510 BrcbCommonImpl")
  • CANN 版本:不涉及特定版本(host tiling 估算逻辑与文档口径问题,代码检视发现,非运行时触发)
  • Python 版本:不涉及

Steps to reproduce the issue / 重现步骤

  1. 查看 tiling 侧 ComputeTilingParams() 的 scale2Ub = blockW * DIGIT_THREE * DB(未区分 scaleAlg)。
  2. 查看 kernel 侧 CUBLAS_SCALE2_BUFFER_BYTES 定义与 static_assert(... == 896U)、Init() 中 scaleAlg != TPL_SCALE_ALG_0 分支及 InitBuffer(mxScaleQueue2_, DB_BUFFER, ...)。
  3. 对照:cuBLAS 路径 kernel 实际占用 896B×2=1792B,tiling 估算恒为 256×3×2=1536B,相差 256B。

Describe the expected behavior / 预期结果

  • tiling 侧 scale2Ub 按 scaleAlg 分支与 kernel 对齐:cuBLAS 路径按 CUBLAS_SCALE2_BUFFER_BYTES * DB 估算,OCP 路径维持原值。
  • aclnn 文档 4 个输出「非连续Tensor」列更正为 ×。

无运行时日志(代码检视发现)。关键位置:tiling 侧 ComputeTilingParams();kernel 侧 regbase.h 常量定义、static_assert、Init() 分支、InitBuffer 双 buffer。

Special notes for this issue/备注

关联 PR:https://gitcode.com/cann/ops-nn/pull/12957

likedislike
chenfengchenfeng成员
4 天前 添加了label:bug-report
chenfeng
chenfeng成员
4 天前 评论:

/assign @chenfeng61

likedislike
CANN-robotCANN-robot成员
4 天前 将 chenfeng61 设为负责人
CANN-robotCANN-robot成员
3 天前 关闭了 issue
CANN-robotCANN-robot成员
3 天前 添加了label:resolved