Merged
test(gmm): 补充五个算子的 TTK 用例和 golden #15761
zhoushaolongAdd on 17 days ago
test(gmm): 补充五个算子的 TTK 用例和 golden #15761
Merged
Pull Request has been successfully merged by CANN-robot.
(Thank you for zhoushaolong's contribution.)17 days ago Created pull request, commit 4e3f31f2
atomgit-bot
17 days ago Comments:
17 days ago Comments:
变更摘要
本 PR 主要为 grouped_matmul_activation_quant(gmmaq)算子补充 MXFP8 相关的 ST 测试用例与 golden(参考实现)插件:新增三份 golden 插件,分别对接 ACLNN 的 NZ 权重视图接口、torch.ops.cann_ops_transformer.grouped_matmul_activation_quant 端到端通路以及 kernel 级参考实现,并修正 golden.py 中 FP8 次正规数舍入的边界处理,使量化参考结果与硬件行为一致。
主要改动
- 新增 ACLNN NZ 权重 golden 插件:在
gmmaq_aclnn_golden.py中新增AclnnGroupedMatmulActivationQuantWeightNzTestSpec,通过_nz_storage将按(e, cols/32, rows/16, 16, 32)组织的 NZ 物理存储还原为逻辑权重视图,依据权重 stride 判定是否转置并相应交换weightScale轴,customize_inputs则借助_make_valid_group_list规范化groupList,最终以__spec__注册到aclnnGroupedMatmulActivationQuantWeightNz。 - 新增 Torch 端到端 golden 插件:在
gmmaq_e2e_golden.py中新增GmmaqTorchTestSpec,npu_preprocess使用torch_npu.npu_format_cast(source, 29)在设备侧把权重转为 FRACTAL_NZ 并按需回转置,_decode_scale以en_dtypes.float8_e8m0解码 E8M0 缩放因子,pre_compare对整数载体输出按 E8M0 编码比较,注册到torch.ops.cann_ops_transformer.grouped_matmul_activation_quant。 - 新增 kernel 级 golden 插件:在
gmmaq_kernel_golden.py中新增GroupedMatmulActivationQuantTestSpec,customize_inputs直接复用_make_valid_group_list修正分组长度,golden中显式移除output_dtypes,以保证量化行为由 kernel 的y_dtype决定,默认激活函数为gelu_tanh。 - 修正 FP8 次正规数舍入边界:在
golden.py的_float_to_fp8_bytes中,将次正规数尾数裁剪上限由(1 << mant_bits) - 1改为1 << mant_bits,使舍入产生的进位能够正确编码为最小正规数。
🧩 本次 Review 已使用自定义 Skill:


Incorrect?
17 days ago Added label: cann-cla/yes
CANN-robot
17 days ago Comments:
17 days ago Comments:
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 |
|---|---|---|
| gmm | ✅ kknan, wuyi_huawei (2/2) | ✅ kknan (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
zhoushaolong, thanks for your pull request. All authors of the commits have signed the CLA. 👍


17 days ago Set yangziqi_007,cheng_zhiwei,chenkang30,juyangokok,monologue815,chaotang233,wuyi_huawei,chen-linxin4,jiang-lirui,Allan_Yu,liudan12,Wei_NaChuan,zhangshuoleiokok,shi-rui,cc-z,kdy18482276080,kknan,wenxin_fight,mabing1118,Julius47 as approver
17 days ago Set yangziqi_007,cheng_zhiwei,chenkang30,juyangokok,monologue815,chaotang233,wuyi_huawei,chen-linxin4,jiang-lirui,Allan_Yu,liudan12,Wei_NaChuan,zhangshuoleiokok,shi-rui,cc-z,kdy18482276080,kknan,wenxin_fight,mabing1118,Julius47 as approver
123 messages are collapsed here。 See more
16 days ago Added label: approved
wuyi_51
16 days ago Comments:
16 days ago Comments:
/lgtm


16 days ago Added label: lgtm
16 days ago Closed associated issue
16 days ago Merged pull request
描述
为 Ascend 950 的五个 GMM 系列算子补充 TTK 流水线用例和 CPU golden,覆盖
GroupedMatmul、GroupedMatmulActivationQuant、GroupedMatmulFinalizeRouting、GroupedMatmulSwigluQuantV2和QuantGroupedMatmulInplaceAdd。ops-test-kit主线即可运行。cann_matmul_test_。关联的Issue
#7451
测试
在蓝区 Ascend 950PR 上,使用 CANN Toolkit 与 950 ops
9.3.0~weekly.20261014.01、原样的ops-test-kit主线3055592验证流水线用例。将批跑失败的 GMM E2E 用例替换为 FP8 per-channel 用例后,复跑该表 10 条全部通过。文档更新
本次变更涉及 TTK 用例和 golden,未更新算子接口文档。
类型标签