已关闭
[Bug-Report|缺陷反馈]: 9.1.0 分支 QBMM 公共校验逻辑缺少 nullptr 防护 #3839
zhaoyingchao2创建于  7月4日关闭于  7月6日
zhaoyingchao2
7月4日 创建

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

9.1.0 分支中,matmul/quant_batch_matmul_v3aclnnQuantMatmulV4 的部分公共校验逻辑仍散落在 aclnn_quant_matmul_v4.cpp 内,A8W4/MX/TCG 等场景判断函数对可选 tensor 的空指针防护不够集中。

master 分支已通过 PR #6889(【qbmm】公共校验逻辑拆分与安全性增强)完成整改:抽取 quant_matmul_v4_common.h,复用公共常量、tuple 类型和判断函数,并对 isA8W4FloatisA8W4IntisMxisA8W4MsdIsMicroScalingIsFormatNZ 等函数补充 nullptr 防护。需要将该修复迁移到 9.1.0 分支。

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

  • 仓库:cann/ops-nn
  • 目标分支:9.1.0
  • 模块:matmul/quant_batch_matmul_v3
  • 相关接口:aclnnQuantMatmulV4 / QuantBatchMatmulV3

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

  1. 切换到 9.1.0 分支。
  2. 查看 matmul/quant_batch_matmul_v3/op_api/aclnn_quant_matmul_v4.cpp
  3. 可见 V4 公共常量、tuple 类型和 A8W4/MX/TCG 相关判断函数仍在 cpp 内部定义,未拆分到公共头文件。
  4. 对比 master 分支 PR #6889,可见 9.1.0 缺少对应的公共校验逻辑拆分与 nullptr 防护。

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

  • 9.1.0 分支同步 PR #6889 中与 QBMM V4 公共校验、安全防护相关的有效改动。
  • 新增 matmul/quant_batch_matmul_v3/op_api/quant_matmul_v4_common.h,沉淀公共常量、tuple 类型和公共判断函数。
  • aclnn_quant_matmul_v4.cpp 引入公共头文件并复用 quant_matmul_v4 命名空间,减少重复定义。
  • 公共判断函数补充 nullptr 防护,避免可选 tensor 被直接解引用。
  • 迁移时保留 9.1.0 分支已有的平台宏路径,避免引入该分支不存在的宏头文件。

参考已合入 master 的 PR:

本次迁移后涉及文件:

matmul/quant_batch_matmul_v3/op_api/aclnn_quant_matmul_v4.cpp
matmul/quant_batch_matmul_v3/op_api/quant_matmul_v4_common.h
matmul/quant_batch_matmul_v3/op_host/op_tiling/arch35/adaptive_sliding_window_mx_basic_api_tiling.cpp

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

PR #6889 中部分 kernel 宏前移逻辑依赖 master 分支已有的宏头文件路径,9.1.0 分支当前不存在该头文件。因此迁移时保留 9.1.0 现有可编译宏路径,仅同步公共校验拆分、nullptr 防护和无副作用的参数命名整改。

likedislike
Zzhaoyingchao2
7月4日 添加了label:bug-report
Zzhaoyingchao2
7月4日 关联了pull request:fix(qbmm): 迁移公共校验安全整改到 9.1.0
yuning_chenyuning_chen成员
7月4日 将 zhaoyingchao2 设为负责人
CANN-robotCANN-robot成员
7月6日 关闭了 issue
CANN-robotCANN-robot成员
7月6日 添加了label:resolved