Pull Request has been successfully merged by CANN-robot.
(Thank you for ruan-cj's contribution.)变更摘要
本 PR 为 WeightQuantBatchMatmulV2(WeightQuantBatchMatmulV2 量化矩阵乘)新增对 9202(ascend960pr)架构的适配,使 A16 系列数据类型组合可在 9202 上运行。改动覆盖算子定义与配置(新增 ascend960pr 二进制配置、注册新的 AICore 配置)、tiling 入口的架构分支(将 DAV_9202 并入 9201 路径)、tiling checker 对 HiFloat4 的判定,以及内核侧 9202 条件下的编译分支与内存偏移对齐逻辑。
主要改动
- 新增 9202 算子配置: 新增
ascend960pr/weight_quant_batch_matmul_v2_binary.json,并在weight_quant_batch_matmul_v2_def.cpp中将原aicore_config_960DT重命名为通用的aicore_config_960,同时注册到ascend960dt与ascend960pr两个配置项。 - Tiling 入口纳入 9202:
WeightQuantBatchMatmulV2TilingFunc的架构判断由仅NpuArch::DAV_9201扩展为DAV_9201 || DAV_9202,使 9202 复用WeightQuantBatchMatmulV2CheckerFor920R1的校验流程。 - Checker 新增 HiFloat4 判定:
CheckInputSize新增成员isA16HiFp4_(bDtype == ge::DT_HIFLOAT4),并在FORMAT_FRACTAL_NZ且transB的 n0*n1 校验中加入该条件;CheckShapeAdvanced中DT_HIFLOAT4从通用 A16W4 的 64 对齐分支中移出,交由 HiFloat4 专属分支处理。 - 内核编译分支支持 9202:
weight_quant_batch_matmul_v2.cpp与weight_quant_batch_matmul_v2_arch35_tiling_key.h中所有__NPU_ARCH__ == 9201的判断均扩展为9201 || 9202,使 ASW 系列头文件、INVOKE_WEIGHT_QUANT_BMM_OP_ASW_IMPL_9201宏、Tiling Key 选择等在 9202 上生效。 - ASW K 轴对齐逻辑统一:
CalL1Tiling()中basicTiling_.baseK不再区分 A16+MxFP4,统一按B4_C0_SIZE向上对齐;adaptive_sliding_window_mx.h中原本仅对fp4x2_e2m1_t生效的kL1Size对齐、scaleGmOffset与weightGmOffset/dataCopyParams.srcStride计算改为无条件执行。
🧩 本次 Review 已使用自定义 Skill:


代码审查
审查结论
- [建议]
matmul/weight_quant_batch_matmul_v2/op_host/config/ascend960pr/weight_quant_batch_matmul_v2_binary.json:154fix: 修正 fp16 条目 antiquant_offset 的 dtype(误写为 bfloat16) - [建议]
matmul/weight_quant_batch_matmul_v2/op_host/config/ascend960pr/weight_quant_batch_matmul_v2_binary.json:2662fix: 修正 bf16 hifloat4 条目 antiquant_offset 的 dtype(误写为 float16) - [阻塞]
matmul/weight_quant_batch_matmul_v2/op_host/op_tiling/arch35/weight_quant_batch_matmul_v2_checker_for_920r1.cpp:426fix: 使用不存在的 ge::DT_HIFLOAT4,应为 Ops::NN::DT_HIFLOAT4 - [建议]
matmul/weight_quant_batch_matmul_v2/op_host/op_tiling/arch35/weight_quant_batch_matmul_v2_adaptive_sliding_window_mix_tiling.cpp:782fix: baseK 统一按 64 上取整,可能使 baseK 超过 kSize - [建议]
matmul/weight_quant_batch_matmul_v2/op_host/op_tiling/arch35/weight_quant_batch_matmul_v2_checker_for_920r1.cpp:654fix: HIFLOAT4 权重不再受 N/K 对齐约束,与下游 64 对齐前提不一致 - [建议]
matmul/weight_quant_batch_matmul_v2/op_host/op_tiling/weight_quant_batch_matmul_v2_tiling_registry.cpp:101fix: 9202 进入 A16 tiling 路径但 aclnn 侧仍只按 DAV_9201 做 A16 专属校验 - [建议]
matmul/weight_quant_batch_matmul_v2/op_host/weight_quant_batch_matmul_v2_def.cpp:842fix: 新增 ascend960pr 平台配置需同步 kernel 编译单元列表 - [建议]
matmul/weight_quant_batch_matmul_v2/op_kernel/arch35/asw/weight_quant_batch_matmul_v2_adaptive_sliding_window_mx.h:358fix: 确认 HIFP4(hifloat4x2_t) 路径 K/N 已对齐后再取消 fp4 专属分支 - [建议]
matmul/weight_quant_batch_matmul_v2/op_kernel/arch35/asw/weight_quant_batch_matmul_v2_adaptive_sliding_window_mx.h:434fix: HIFP4 的 weight srcStride 改为按对齐后 N 计算前需确认 N 已对齐
| 类型 | 数量 |
|---|---|
| 🔴 阻塞 | 1 |
| 🟡 建议 | 8 |
⛔ 需要修改
🧩 本次 Review 已使用自定义 Skill:


Hi @ruan-cj, welcome to submitting your first PR to CANN!
PR Merge Steps
1. CLA Signing
If the current PR label includes cann-cla/yes, it means you have signed the CLA and can proceed to the next step. If the label includes cann-cla/no, please sign the CLA first. If you have any questions, please refer to the FAQ.
2. CI Check
Please comment /compile to trigger the CI pipeline check. If the CI run is successful, the PR will be tagged with ci-pipeline-passed and you can proceed to the next step. If the CI run fails, the PR will be tagged with ci-pipeline-failed, please check the CI logs to fix the issues in the PR. If you have any questions, please refer to the FAQ.
3. Code Review
After CI passes, please refer to the PR Approval Progress and proactively @ the committers in the table to review the code. After approval, committers will comment /lgtm and /approve. Once the lgtm and approved labels are successfully added, the PR will be merged automatically.
%!(EXTRA string=https://atomgit.com/cann/community/blob/master/en/sig-infrastructure/command.md)


Pull Request 已合并或已关闭。
If you want to solve this problem, you can click here to do it in the FAQs.


/approve


描述
【WeightQuantBatchMamtul】【9202】 A16系列适配9202
关联的Issue
关联 Issue #8726
测试
完成9201/9202 冒烟用例验证
文档更新
类型标签
AI/Agent生成声明
不涉及