Pull Request has been successfully merged by CANN-robot.
(Thank you for jayshu's contribution.)变更摘要
此 PR 为 grouped_matmul 算子的 MX 量化路径新增了 scale 张量的 FRACTAL_NZ_C0_2 格式(ScaleNZ)支持。通过在 tiling key 模板体系中引入 SCALE_FORMAT 参数,区分 ScaleND 与 ScaleNZ 两种布局,并将其传递到内核模板 GmmTensorApiMxKernel 中,驱动 GroupedMatmulWithScaleMx 策略的分发。同时,在 host 端 tiling 阶段增加对 scale 格式的检测逻辑,当识别为 MX 微缩放且格式为 FRACTAL_NZ_C0_2 时自动启用 ScaleNZ 标记。
主要改动
-
新增
SCALE_FORMATtiling 模板参数:在gqmm_tiling_key.h中定义GMM_SCALE_ND和GMM_SCALE_NZ两个常量,并将SCALE_FORMAT追加到所有已存在的模板组合声明中 — MX 路径同时支持两种格式,非 MX 路径仅支持GMM_SCALE_ND,确保向后兼容。 -
Host 端 scale 格式检测与标记传递:在
GroupedQmmTiling::AnalyzeDtype()中从动态输入描述符获取 scale 的原始格式,当满足 MX 微缩放条件且格式为FORMAT_FRACTAL_NZ_C0_2时设置scaleNzFlag;该标记随后通过GetTilingKey()编入 tiling key,参与内核模板选择。 -
GQmmInputInfo新增字段:在grouped_quant_matmul_tiling.h中添加scaleFormat和scaleNzFlag两个成员变量,并在Reset()中初始化为默认值(FORMAT_ND/false),完成生命周期管理。 -
内核模板扩展 ScaleNz 参数:
GmmTensorApiMxKernel新增bool ScaleNz模板参数(默认false),用于配置GroupedMatmulWithScaleMx策略;在grouped_matmul_apt.cpp的宏展开中,将(SCALE_FORMAT == GMM_SCALE_NZ)作为实参传入。


Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| */*/docs/acl*.md | ✅ 陈娇, 马兵 (2/2) | ✅ 陈娇 (1/1) |
| */*/op_host/*_def.cpp | ✅ 马兵, 王永光 (2/2) | ✅ 王永光 (1/1) |
| gmm | ✅ 马兵, kknan (2/2) | ✅ 马兵 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
jayshu, thanks for your pull request. All authors of the commits have signed the CLA. 👍


/lgtm


The following users do not have permission to comment /lgtm or /approve on any module in this PR:
Coopermassaki


描述
GroupedMatmulMX 量化场景中支持scaleOptional使用 scale NZ 昇腾亲和格式。scaleOptional为FRACTAL_NZ、dtype 为FLOAT8_E8M0、weight 为FRACTAL_NZ且transpose_weight=false时进入 scale NZ 目标通路。关联的Issue
测试
文档更新
gmm/grouped_matmul/docs/aclnnGroupedMatmulWeightNz.md,补充 scale NZ 昇腾亲和格式的 storage shape 和使用约束。类型标签