Closed
[Bug-Report|缺陷反馈]: QuantMatmulActivationQuant NPU golden 的 NZ 视图与参数处理不一致 #8431
panzhijaAdd on  12 days agoClosed at  12 days ago
panzhija
panzhijaCollaborators
12 days ago Create

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

QuantMatmulActivationQuant 的 E2E 用例将 x2 声明为 FRACTAL_NZ,且 x2 为转置逻辑视图时,实际算子调用会进行 NZ 格式转换。NPU golden 只将张量搬到设备,保留了 ND 转置视图,导致独立 npu_quant_matmul 报出权重与 scale 的转置属性不匹配,TTK 随后回退 CPU golden。

同时,CPU golden 的输入与输出逻辑类型校验存在缺口,E2E 对 group_sizes=[] 和 scale_alg=None 的默认值处理与算子接口存在差异。

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

  • 昇腾硬件型号 Ascend950DT_9592
  • CANN 9.3.0~weekly.20261104.01
  • Python 3.12.9
  • torch 2.10.0+cpu
  • torch_npu 2.10.0.post7
  • ops-test-kit 3.0.0

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

以 SiLU、MXFP8 E4M3、scale_alg=0 为例,x1 形状为 (M,K),x2 逻辑形状为 (K,N),x2 stride 为 (1,K),x2_scale 连续。用例声明 x2 格式为 FRACTAL_NZ。

网络用例为 M=6877、K=6144、N=16384。PR 新增的小用例使用 M=3、K=128、N=256,可运行以下命令检查 golden 来源。

OP_TESTS=/path/to/ops-nn/matmul/quant_matmul_activation_quant/tests
python3 -m ttk e2e \
  -i "$OP_TESTS/st/arch35/ttk_e2e_quant_matmul_activation_quant_st.csv" \
  --plugin "$OP_TESTS/assets" -t silu_nz_transposed_view_e4m3 \
  --golden-mode NPU --task-prof=false --seed 42 --devices 0 --pc 1 --run 1 \
  -c=false -d=false

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

NPU golden 按用例声明的 NZ 格式准备权重,合法转置视图用例使用 NPU 拼接链完成计算。各通路按逻辑输入类型校验输出类型与 FP4 配对,可选属性的默认值与算子接口一致。

修复前独立拼接链报错。

Input x2 tensor and scale tensor's transpose are not same

修复后原始网络用例 precision_status=PASS,两个输出精度均为 100.0%,golden_source=npu。E2E 53/53、ACLNN ND 55/55、ACLNN NZ 114/114 通过。

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

独立 QuantMatmulWeightNz 对 E5M2 x1 搭配 NZ 权重存在类型限制,此组合使用 CPU golden 验收。ACLNN 回归因环境中的通用预热辅助 kernel 编译失败而设置 --warmup=false。

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

likedislike
panzhijapanzhijaCollaborators
12 days ago Added label: bug-report
panzhijapanzhijaCollaborators
12 days ago Assign smdbha as responsible person
CANN-robotCANN-robotCollaborators
12 days ago Close issue
CANN-robotCANN-robotCollaborators
12 days ago changed custom state from 待办的 to 已完成
CANN-robotCANN-robotCollaborators
12 days ago Added label: resolved