已关闭
[Bug-Report|缺陷反馈]: QuantBatchMatMulV3 一维 bias shape 报错缺少方括号 #6129
Hu1L1创建于  9月22日关闭于  9月24日
Hu1L1
Hu1L1成员
9月22日 创建

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

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

QuantBatchMatMulV3 的一维 bias shape 校验报错中,实际 shape 缺少方括号,与 reason 中的期望 shape 格式不一致。

代码位置:matmul/quant_batch_matmul_v3/op_api/quant_matmul_checker.cpp,QuantMatmulChecker::CheckBiasShape()。

执行到该函数、biasDimNum == 1 且 biasFirstDim != x2NDim_ 时,调用 OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON。第三个参数使用 std::to_string(biasFirstDim).c_str(),因此实际长度为 16 时传入的是 16,而期望的形状表示为 [16]。

该问题涉及此分支的普通日志及 EZ0009 上报参数格式,不涉及计算结果或三维 bias 分支。

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

源码检查基线:

  • ops-nn master:d83bd1684f9ba6dd7f8c6aa1024796fddce2e9b1。
  • ops-nn 9.2.0:6d94b9eead9c7c887d07ee6757abf7f0df960eae。
  • 问题位于 Host/API 侧的报错文本构造。
  • 昇腾硬件型号、CANN 安装版本和 Python 版本:本次未采集,未进行设备运行复现。

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

源码级定位步骤(非端到端运行复现):

  1. 打开 matmul/quant_batch_matmul_v3/op_api/quant_matmul_checker.cpp 中的 QuantMatmulChecker::CheckBiasShape()。
  2. 定位 biasDimNum == 1 分支,在 biasFirstDim != x2NDim_ 时检查其错误上报调用。
  3. 第三个参数当前为 std::to_string(biasFirstDim).c_str(),只包含数字。
  4. 假设已进入该错误分支,且 biasFirstDim == 16、x2NDim_ == 64,实际 shape 文本为 16,reason 中期望 shape 为 [64]。两处形状表示不一致。

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

实际 shape 应使用方括号表示。例如上述分支应输出 incorrect shape [16],与期望 shape [64] 的表示方式一致。

在该分支中,实际长度为 0 时同样应表示为 [0]。保持原有校验条件、返回值、错误码和 reason 不变。

以下为根据源码格式串推导的示例,非设备运行日志;<apiName> 为算子接口名称占位符。

当前:

Parameter bias of <apiName> has incorrect shape 16. Reason: the shape of bias must be [64].

预期:

Parameter bias of <apiName> has incorrect shape [16]. Reason: the shape of bias must be [64].

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

修复方式:在算子调用处将第三个参数改为 "[" + std::to_string(biasFirstDim) + "]",显式构造一维 shape 文本。

关联修复 PR:

两条 PR 均仅修改一个文件的一行。git diff --check 通过;未执行算子编译、UT 或设备测试。本 Issue 由 AI 辅助整理。

likedislike
Hu1L1Hu1L1成员
9月22日 添加了label:bug-report
Hu1L1Hu1L1成员
9月22日 关联了pull request:fix(qbmm): 修复 bias shape 报错缺少方括号(master)
Hu1L1Hu1L1成员
9月22日 关联了pull request:fix(qbmm): 修复 bias shape 报错缺少方括号(9.2.0)
Hu1L1
Hu1L1成员
9月22日 评论:

/assign

likedislike
CANN-robotCANN-robot成员
9月22日 将 Hu1L1 设为负责人
CANN-robotCANN-robot成员
9月24日 关闭了 issue
CANN-robotCANN-robot成员
9月24日 添加了label:resolved