Merged
【WeightQuantBatchMamtul】【9202】 A16系列适配9202 #14232
【WeightQuantBatchMamtul】【9202】 A16系列适配9202 #14232
Merged
ruan-cjAdd on 10 days ago
ruan-cj
ruan-cjCollaborators
10 days ago

描述

【WeightQuantBatchMamtul】【9202】 A16系列适配9202

关联的Issue

关联 Issue #8726

测试

完成9201/9202 冒烟用例验证

文档更新

类型标签

AI/Agent生成声明

不涉及

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for ruan-cj's contribution.)
ruan-cjruan-cjCollaborators
10 days ago Created pull request, commit 5dced937
atomgit-bot
atomgit-bot
10 days ago Comments:

变更摘要

本 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:

likedislike
Incorrect?
atomgit-bot
atomgit-bot
10 days ago Comments:

代码审查

审查结论

  • [建议] matmul/weight_quant_batch_matmul_v2/op_host/config/ascend960pr/weight_quant_batch_matmul_v2_binary.json:154 fix: 修正 fp16 条目 antiquant_offset 的 dtype(误写为 bfloat16)
  • [建议] matmul/weight_quant_batch_matmul_v2/op_host/config/ascend960pr/weight_quant_batch_matmul_v2_binary.json:2662 fix: 修正 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:426 fix: 使用不存在的 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:782 fix: baseK 统一按 64 上取整,可能使 baseK 超过 kSize
  • [建议] matmul/weight_quant_batch_matmul_v2/op_host/op_tiling/arch35/weight_quant_batch_matmul_v2_checker_for_920r1.cpp:654 fix: HIFLOAT4 权重不再受 N/K 对齐约束,与下游 64 对齐前提不一致
  • [建议] matmul/weight_quant_batch_matmul_v2/op_host/op_tiling/weight_quant_batch_matmul_v2_tiling_registry.cpp:101 fix: 9202 进入 A16 tiling 路径但 aclnn 侧仍只按 DAV_9201 做 A16 专属校验
  • [建议] matmul/weight_quant_batch_matmul_v2/op_host/weight_quant_batch_matmul_v2_def.cpp:842 fix: 新增 ascend960pr 平台配置需同步 kernel 编译单元列表
  • [建议] matmul/weight_quant_batch_matmul_v2/op_kernel/arch35/asw/weight_quant_batch_matmul_v2_adaptive_sliding_window_mx.h:358 fix: 确认 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:434 fix: HIFP4 的 weight srcStride 改为按对齐后 N 计算前需确认 N 已对齐
类型 数量
🔴 阻塞 1
🟡 建议 8

⛔ 需要修改


🧩 本次 Review 已使用自定义 Skill:

likedislike
Incorrect?
CANN-robot
CANN-robotCollaborators
10 days ago Comments:

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)

likedislike
CANN-robotCANN-robotCollaborators
10 days ago Added label: cann-cla/yes
82 messages are collapsed here。 See more
CANN-robotCANN-robotCollaborators
9 days ago Added label: approved
CANN-robotCANN-robotCollaborators
9 days ago Closed associated issue
CANN-robotCANN-robotCollaborators
9 days ago Merged pull request
CANN-robot
CANN-robotCollaborators
9 days ago Comments:

Pull Request 已合并或已关闭。

If you want to solve this problem, you can click here to do it in the FAQs.

likedislike
wangyongguang
wangyongguangCollaborators
9 days ago Comments:

/approve

likedislike