Pull Request已成功合入, 合并人@CANN-robot
(感谢 fengxingpan 的贡献)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
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) |
| gmm | ✅ kknan, 陈康 (2/2) | ✅ kknan, 陈康 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
fengxingpan1, thanks for your pull request. All authors of the commits have signed the CLA. 👍


Now I have a comprehensive understanding of all changes. Let me provide the summary.
变更摘要
此 PR 为 grouped_matmul_swiglu_quant_v2 算子新增 MXFP4/MXFP8 多 Tensor Weight NZ 场景支持。在单 Tensor(viewShape 为 3 维 (E, K, N))基础上,扩展支持多 Tensor 场景(viewShape 为 2 维 (K, N)),此时 tensorlist 长度需等于 E。改动贯穿算子 API 校验、tiling 数据流、kernel 计算等各层,新增 isMxWeightNzMultiTensor 标志位用于在运行时区分单/多 Tensor 路径。
主要改动
-
多 Tensor 标志位
isMxWeightNzMultiTensor引入与传递: 在GMMTiling结构体、GMMSwigluQuantParamstiling 数据(替换原reserved1字段)、GMMSwigluQuantV2Tiling950类中均新增isMxWeightNzMultiTensor字段,从 tiling 层一致传递至 kernel 层,控制 B 矩阵和 x2Scale 的基地址计算方式。 -
Kernel 层
UpdateGlobalBuffer与UpdateOffset适配:kernel_gmm_swiglu_mxquant.h中UpdateGlobalBuffer新增groupIdx参数,UpdateOffset新增Params参数;多 Tensor 场景下 B 矩阵和 x2Scale 的 GM 地址直接通过GetTensorAddr按groupIdx索引,偏移量置零,与单 Tensor 沿连续 buffer 偏移的计算方式区分。 -
Tiling 层输入校验与动态输入计数:
grouped_matmul_swiglu_quant_v2_basic_tiling.cpp新增GetDynamicInputCount函数、IsMxWeightNzMultiTensor判断及多 Tensor 场景下的逐 Tensor 校验逻辑,校验 weight/weightScale 的 tensorlist 长度与groupNum一致,并逐 Tensor 校验 shape 维度。 -
Op API 层维度适配与 Shape 校验:
grouped_matmul_swiglu_quant_v2_utils.h新增IsMxWeightNzMultiTensorSupported方法,在CheckMXShape、CheckInputOutDimsForMX、CheckInputOutDims中根据多/单 Tensor 场景分别计算n、e维度并校验 shape;grouped_matmul_swiglu_quant_v2.cpp新增IsMxWeightNzMultiTensor静态函数用于层级维度推断。 -
文档与测试用例更新:
aclnnGroupedMatmulSwigluQuantWeightNzV2.md补充多 Tensor 场景的约束说明与 shape 表格;CSV 测试文件新增 3 条覆盖 MXFP8/MXFP4 多 Tensor 场景的测试用例(含 E=1 边界情况)。
文件审查结果:
gmm/common/cgmct/kernel/kernel_gmm_swiglu_mxquant.h— 无问题gmm/grouped_matmul_swiglu_quant_v2/docs/aclnnGroupedMatmulSwigluQuantWeightNzV2.md— 无问题gmm/grouped_matmul_swiglu_quant_v2/op_api/aclnn_grouped_matmul_swiglu_quant_v2.cpp— 无问题gmm/grouped_matmul_swiglu_quant_v2/op_api/grouped_matmul_swiglu_quant_v2.cpp— 无问题gmm/grouped_matmul_swiglu_quant_v2/op_api/grouped_matmul_swiglu_quant_v2_utils.h— 无问题gmm/grouped_matmul_swiglu_quant_v2/op_host/op_tiling/arch35/grouped_matmul_swiglu_quant_v2_basic_tiling.cpp— 无问题gmm/grouped_matmul_swiglu_quant_v2/op_host/op_tiling/arch35/grouped_matmul_swiglu_quant_v2_basic_tiling.h— 无问题gmm/grouped_matmul_swiglu_quant_v2/op_host/op_tiling/grouped_matmul_swiglu_quant_v2_tiling.h— 无问题gmm/grouped_matmul_swiglu_quant_v2/op_kernel/arch35/grouped_matmul_swiglu_quant_v2_mxfp4_weight_nz.h— 无问题gmm/grouped_matmul_swiglu_quant_v2/op_kernel/arch35/grouped_matmul_swiglu_quant_v2_mxquant.h— 无问题gmm/grouped_matmul_swiglu_quant_v2/tests/ut/op_api/test_aclnn_grouped_matmul_swiglu_quant_v2.csv— 无问题


/lgtm


/lgtm
/approve


描述
原因:用户实际使用时mx weightnz场景支持 常用到weight是多tensor的,本次新特性可方便用户使用
修改:通路支持多 tensor的输入shape,在kernel中使用不同的寻址方式拿取数据
关联的Issue
https://gitcode.com/cann/ops-transformer/issues/3631
测试
测试通过
文档更新
gmm/grouped_matmul_swiglu_quant_v2/docs/aclnnGroupedMatmulSwigluQuantWeightNzV2.md
类型标签