已关闭
[Bug-Report|缺陷反馈]: aclnnAddLayerNormQuant static量化场景下空Tensor处理不完整 #5639
rk创建于  9月8日关闭于  9月11日
rk成员
9月8日 创建

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

aclnnAddLayerNormQuant 算子在 Regbase(Ascend950)架构上,空 Tensor 早返回判断条件为 outScales1Out->IsEmpty()。static 量化场景下 outScales 输出无实际意义(static 量化使用 input scales,不依赖 output scales),其是否为空不能作为空 Tensor 的判据。当 x1 为空但 outScales1Out 不为空时,该条件不成立,算子未走早返回,继续执行导致异常。

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

  • 硬件:Ascend950(Regbase 架构)
  • 算子:aclnnAddLayerNormQuant
  • 量化模式:static

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

  1. 在 Ascend950 设备上,构造输入 x1 shape 为 {0, 64}、gamma shape 为 {64}、quantMode="static"、outScales1Out shape 为 {1}(非空)。
  2. 调用 aclnnAddLayerNormQuantGetWorkspaceSize。
  3. 观察返回值及 workspaceSize。

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

static 量化场景下,当 x1 为空时应以 x1->IsEmpty() 作为早返回判据(返回 ACL_SUCCESS 且 workspaceSize==0),而非依赖 outScales1Out 是否为空。

修复前:x1 为空但 outScales1Out 非空时,未走早返回路径,算子执行异常。
修复后:UT 用例 static_outer_axis_empty(x1={0,64})和 static_normalized_axis_empty(x1={2,0})均验证返回 ACL_SUCCESS 且 workspaceSize==0。

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

修复方案:引入 IsDynamicQuant 区分 dynamic/static 量化,新增 regbaseEmptySkip 判据(dynamic 看 outScales1Out、static 看 x1),将 Regbase 早返回条件由 outScales1Out->IsEmpty() 改为 regbaseEmptySkip。

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

likedislike
Rrk成员
9月8日 添加了label:bug-report
yuning_chenyuning_chen成员
9月8日 将 wangpengbo26 设为负责人
Rrk成员
9月8日 修改了issue 的描述
Rrk成员
9月8日 添加了label:bug
Rrk成员
9月8日 删除了label:bug-report
Rrk成员
9月8日 修改了issue 的描述
Rrk成员
9月9日 修改了issue 的描述
CANN-robotCANN-robot成员
9月11日 关闭了 issue
CANN-robotCANN-robot成员
9月11日 添加了label:resolved