Merged
Restore ND MXFP4 error message rectification #8787
jayshuAdd on Jul 16
Restore ND MXFP4 error message rectification #8787
Merged
Pull Request has been successfully merged by CANN-robot.
(Thank you for jayshu's contribution.)atomgit-bot
Jul 16 Comments:
Jul 16 Comments:
变更摘要
此 PR 主要修复了 ND 格式下 MXFP4 数据类型校验的错误消息问题。通过将原先统一的 MXFP4 支持列表按 weight 的存储格式(ND 与 NZ)拆分为两组常量,并新增辅助函数在运行时根据格式动态选择正确的支持列表,使得 ND 格式下不再接受 DT_FLOAT4_E1M2 类型,同时改进了相关错误消息的准确性和可读性。
主要改动
- 拆分 MXFP4 数据类型支持列表:将
X_DTYPE_SUPPORT_LIST_MXFP4、WEIGHT_DTYPE_SUPPORT_LIST_MXFP4和QUANTOUT_DTYPE_SUPPORT_LIST_MXFP4分别拆分为_ND(仅含DT_FLOAT4_E2M1)和_NZ(含DT_FLOAT4_E2M1和DT_FLOAT4_E1M2)两个常量,以区分不同存储格式下的类型支持范围。 - 新增运行时格式判断辅助函数:添加
GetXSupportListMxfp4、GetWeightSupportListMxfp4、GetOutputSupportListMxfp4,根据weight的StorageFormat是否为私有格式(NZ)来返回对应的支持列表;同时新增IsMxfp4Dtype用于判断数据类型是否为 MXFP4 类型。 - 更新 MXFP4 场景识别逻辑:在
GetGroupedMatmulSwigluQuantV2ScenarioName中使用IsMxfp4Dtype替代原来仅检查DT_FLOAT4_E2M1的硬编码判断,使场景识别覆盖所有 MXFP4 类型。 - 改进 ND 格式不支持 DT_FLOAT4_E1M2 的错误消息:将原来的
OP_LOGE简单日志替换为OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON,明确列出 weight、x 和 output 的实际类型,并给出 "ND 格式下三者均不能为 DT_FLOAT4_E1M2" 的详细原因。 - 根据格式动态生成错误消息中的支持类型列表:引入
dtypeSupportList变量,在 NZ 格式下提示包含FLOAT4_E1M2的完整列表,在 ND 格式下则只提示到FLOAT4_E2M1,使 x/weight 类型不匹配时的错误提示与实际约束一致。


Incorrect?
Jul 16 Added label: stat/needs-squash
Jul 16 Added label: cann-cla/yes
CANN-robot
Jul 16 Comments:
Jul 16 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
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| gmm | ✅ 马兵, kknan (2/2) | ✅ 马兵 (1/1) |
| tests | ✅ 马兵, gaoxiang618 (2/2) | ✅ 马兵, gaoxiang618 (2/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. 👍


51 messages are collapsed here。 See more
Jul 16 Added label: approved
gaoxiang618
Jul 17 Comments:
Jul 17 Comments:
/lgtm
/approve


kknan
Jul 17 Comments:
Jul 17 Comments:
/lgtm


Jul 17 Added label: lgtm
Jul 17 Merged pull request
描述
调整
grouped_matmul_swiglu_quant_v2中 MXFP4 场景的 dtype 校验逻辑,使其按 weight format 区分 ND 和 NZ 的支持范围。主要改动:
x/weight/outputdtype 支持列表:FLOAT4_E2M1FLOAT4_E2M1、FLOAT4_E1M2CheckFp4DtypeValid按 weight storage format 选择对应 dtype 支持列表。CheckDtypeValid前置校验同步按 ND/NZ 区分 MXFP4 dtype 支持范围。DT_FLOAT4_E1M2场景的 error message,使用OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON标准错误日志宏。关联的Issue
https://gitcode.com/cann/ops-transformer/issues/3790
测试
二级冒烟+异常用例验证
文档更新
无
类型标签