Merged
Restore ND MXFP4 error message rectification #8787
Restore ND MXFP4 error message rectification #8787
Merged
jayshuAdd on Jul 16
Total: 3 files changed+89-22
@@ -141,13 +141,16 @@ constexpr int64_t MXA8W4_N_ALIGN = 128LL;
141constexpr int64_t MXA8W4_N_MIN = 128LL;141constexpr int64_t MXA8W4_N_MIN = 128LL;
142constexpr int64_t MXA8W4_SCALE_BLOCK = 128LL;142constexpr int64_t MXA8W4_SCALE_BLOCK = 128LL;
143const std::vector<DataType> X_DTYPE_SUPPORT_LIST = {DataType::DT_FLOAT8_E4M3FN, DataType::DT_FLOAT8_E5M2};143const std::vector<DataType> X_DTYPE_SUPPORT_LIST = {DataType::DT_FLOAT8_E4M3FN, DataType::DT_FLOAT8_E5M2};
144-const std::vector<DataType> X_DTYPE_SUPPORT_LIST_MXFP4 = {DataType::DT_FLOAT4_E2M1, DataType::DT_FLOAT4_E1M2};144+const std::vector<DataType> X_DTYPE_SUPPORT_LIST_MXFP4_ND = {DataType::DT_FLOAT4_E2M1};
145+const std::vector<DataType> X_DTYPE_SUPPORT_LIST_MXFP4_NZ = {DataType::DT_FLOAT4_E2M1,
146+ DataType::DT_FLOAT4_E1M2};
145const std::vector<DataType> XW_DTYPE_SUPPORT_LIST_PERTOKEN = {147const std::vector<DataType> XW_DTYPE_SUPPORT_LIST_PERTOKEN = {
146 DataType::DT_INT8, DataType::DT_FLOAT8_E4M3FN, DataType::DT_FLOAT8_E5M2, DataType::DT_HIFLOAT8};148 DataType::DT_INT8, DataType::DT_FLOAT8_E4M3FN, DataType::DT_FLOAT8_E5M2, DataType::DT_HIFLOAT8};
147const std::vector<DataType> WEIGHT_DTYPE_SUPPORT_LIST = {DataType::DT_FLOAT8_E4M3FN,149const std::vector<DataType> WEIGHT_DTYPE_SUPPORT_LIST = {DataType::DT_FLOAT8_E4M3FN,
148 DataType::DT_FLOAT8_E5M2};150 DataType::DT_FLOAT8_E5M2};
149-const std::vector<DataType> WEIGHT_DTYPE_SUPPORT_LIST_MXFP4 = {DataType::DT_FLOAT4_E2M1,151+const std::vector<DataType> WEIGHT_DTYPE_SUPPORT_LIST_MXFP4_ND = {DataType::DT_FLOAT4_E2M1};
150- DataType::DT_FLOAT4_E1M2};152+const std::vector<DataType> WEIGHT_DTYPE_SUPPORT_LIST_MXFP4_NZ = {DataType::DT_FLOAT4_E2M1,
153+ DataType::DT_FLOAT4_E1M2};
151const std::vector<DataType> WEIGHT_SCALE_DTYPE_SUPPORT_LIST = {DataType::DT_FLOAT8_E8M0};154const std::vector<DataType> WEIGHT_SCALE_DTYPE_SUPPORT_LIST = {DataType::DT_FLOAT8_E8M0};
152const std::vector<DataType> WEIGHT_SCALE_DTYPE_SUPPORT_LIST_PERTOKEN_XINT8 = {155const std::vector<DataType> WEIGHT_SCALE_DTYPE_SUPPORT_LIST_PERTOKEN_XINT8 = {
153 DataType::DT_FLOAT16, DataType::DT_BF16, DataType::DT_FLOAT};156 DataType::DT_FLOAT16, DataType::DT_BF16, DataType::DT_FLOAT};
@@ -156,8 +159,10 @@ const std::vector<DataType> WEIGHT_SCALE_DTYPE_SUPPORT_LIST_PERTOKEN_XFP8HIF8 =
156const std::vector<DataType> X_SCALE_DTYPE_SUPPORT_LIST = {DataType::DT_FLOAT8_E8M0};159const std::vector<DataType> X_SCALE_DTYPE_SUPPORT_LIST = {DataType::DT_FLOAT8_E8M0};
157const std::vector<DataType> X_SCALE_DTYPE_SUPPORT_LIST_PERTOKEN = {DataType::DT_FLOAT};160const std::vector<DataType> X_SCALE_DTYPE_SUPPORT_LIST_PERTOKEN = {DataType::DT_FLOAT};
158const std::vector<DataType> GROUP_LIST_DTYPE_SUPPORT_LIST = {DataType::DT_INT64};161const std::vector<DataType> GROUP_LIST_DTYPE_SUPPORT_LIST = {DataType::DT_INT64};
159-const std::vector<DataType> QUANTOUT_DTYPE_SUPPORT_LIST_MXFP4 = {162+const std::vector<DataType> QUANTOUT_DTYPE_SUPPORT_LIST_MXFP4_ND = {
160- DataType::DT_FLOAT8_E4M3FN, DataType::DT_FLOAT8_E5M2, DataType::DT_FLOAT4_E2M1, DataType::DT_FLOAT4_E1M2};163+ DataType::DT_FLOAT8_E4M3FN, DataType::DT_FLOAT8_E5M2, DataType::DT_FLOAT4_E2M1};
164+const std::vector<DataType> QUANTOUT_DTYPE_SUPPORT_LIST_MXFP4_NZ = {
panzhija
panzhijapanzhijaJul 16

[正确性][建议改进] 新拆出的 NZ output 支持列表仍包含 DT_FLOAT8_E5M2,但 Tiling 的 quantDtypeMxFp4NzSupportList 只允许 E4M3FN/E2M1/E1M2,接口文档也未声明 NZ MXFP4 支持 E5M2;现有 ascend950_test_opapi_mxfp4_weight_nz_invalid_output_dtype_mismatch 还明确把 E5M2 当作非法输入。这样 op_api 会先把不支持的 dtype 判为“支持”,再把失败推迟到 Tiling。请从该列表移除 E5M2;如果确实准备支持,则需同步 Tiling、文档和测试预期。

likedislike
165+ DataType::DT_FLOAT8_E4M3FN, DataType::DT_FLOAT4_E2M1, DataType::DT_FLOAT4_E1M2};
161const std::vector<DataType> QUANTOUT_DTYPE_SUPPORT_LIST_PERTOKEN = {166const std::vector<DataType> QUANTOUT_DTYPE_SUPPORT_LIST_PERTOKEN = {
162 DataType::DT_INT8, DataType::DT_FLOAT8_E4M3FN, DataType::DT_FLOAT8_E5M2, DataType::DT_HIFLOAT8};167 DataType::DT_INT8, DataType::DT_FLOAT8_E4M3FN, DataType::DT_FLOAT8_E5M2, DataType::DT_HIFLOAT8};
163const std::vector<DataType> QUANTSCALEOUT_DTYPE_SUPPORT_LIST = {DataType::DT_FLOAT8_E8M0};168const std::vector<DataType> QUANTSCALEOUT_DTYPE_SUPPORT_LIST = {DataType::DT_FLOAT8_E8M0};
@@ -165,6 +170,33 @@ const std::vector<DataType> QUANTSCALEOUT_DTYPE_SUPPORT_LIST_PERTOKEN = {DataTyp
165const std::vector<DataType> X_DTYPE_SUPPORT_LIST_MXA8W4 = {DataType::DT_FLOAT8_E4M3FN};170const std::vector<DataType> X_DTYPE_SUPPORT_LIST_MXA8W4 = {DataType::DT_FLOAT8_E4M3FN};
166const std::vector<DataType> WEIGHT_DTYPE_SUPPORT_LIST_MXA8W4 = {DataType::DT_FLOAT4_E2M1};171const std::vector<DataType> WEIGHT_DTYPE_SUPPORT_LIST_MXA8W4 = {DataType::DT_FLOAT4_E2M1};
167 172 
173+inline bool IsMxfp4WeightNzFormat(const aclTensor *weight)
174+{
175+ return weight != nullptr && weight->GetStorageFormat() == op::Format::FORMAT_FRACTAL_NZ;
176+}
177+ 
178+inline const std::vector<DataType> &GetXSupportListMxfp4(const aclTensor *weight)
179+{
180+ return IsMxfp4WeightNzFormat(weight) ? X_DTYPE_SUPPORT_LIST_MXFP4_NZ : X_DTYPE_SUPPORT_LIST_MXFP4_ND;
181+}
182+ 
183+inline const std::vector<DataType> &GetWeightSupportListMxfp4(const aclTensor *weight)
184+{
185+ return IsMxfp4WeightNzFormat(weight) ? WEIGHT_DTYPE_SUPPORT_LIST_MXFP4_NZ :
186+ WEIGHT_DTYPE_SUPPORT_LIST_MXFP4_ND;
187+}
188+ 
189+inline const std::vector<DataType> &GetOutputSupportListMxfp4(const aclTensor *weight)
190+{
191+ return IsMxfp4WeightNzFormat(weight) ? QUANTOUT_DTYPE_SUPPORT_LIST_MXFP4_NZ :
192+ QUANTOUT_DTYPE_SUPPORT_LIST_MXFP4_ND;
193+}
194+ 
195+inline bool IsMxfp4Dtype(DataType dtype)
196+{
197+ return dtype == DataType::DT_FLOAT4_E2M1 || dtype == DataType::DT_FLOAT4_E1M2;
198+}
199+ 
168inline const char *GetGroupedMatmulSwigluQuantV2ScenarioName(const GroupedMatmulSwigluQuantParamsBase &params)200inline const char *GetGroupedMatmulSwigluQuantV2ScenarioName(const GroupedMatmulSwigluQuantParamsBase &params)
169{201{
170 if (params.x == nullptr || params.weight == nullptr || params.weight->Size() == 0 ||202 if (params.x == nullptr || params.weight == nullptr || params.weight->Size() == 0 ||
@@ -174,7 +206,7 @@ inline const char *GetGroupedMatmulSwigluQuantV2ScenarioName(const GroupedMatmul
174 DataType xDtype = params.x->GetDataType();206 DataType xDtype = params.x->GetDataType();
175 DataType weightDtype = (*params.weight)[0]->GetDataType();207 DataType weightDtype = (*params.weight)[0]->GetDataType();
176 if (params.quantMode == QUNAT_MODE_MX) {208 if (params.quantMode == QUNAT_MODE_MX) {
177- if (xDtype == DataType::DT_FLOAT4_E2M1 && weightDtype == DataType::DT_FLOAT4_E2M1) {209+ if (IsMxfp4Dtype(xDtype) && IsMxfp4Dtype(weightDtype)) {
178 return "MXFP4";210 return "MXFP4";
179 }211 }
180 if ((xDtype == DataType::DT_FLOAT8_E4M3FN || xDtype == DataType::DT_FLOAT8_E5M2) &&212 if ((xDtype == DataType::DT_FLOAT8_E4M3FN || xDtype == DataType::DT_FLOAT8_E5M2) &&
@@ -821,13 +853,13 @@ protected:
821 for (size_t i = 0; i < weightLength; i++) {853 for (size_t i = 0; i < weightLength; i++) {
822 const aclTensor *weightScale = (*gmmDsqParams_.weightScale)[i];854 const aclTensor *weightScale = (*gmmDsqParams_.weightScale)[i];
823 const aclTensor *weight = (*gmmDsqParams_.weight)[i];855 const aclTensor *weight = (*gmmDsqParams_.weight)[i];
824- GMM_SWIGLU_CHECK_DTYPE(weight, "weight", WEIGHT_DTYPE_SUPPORT_LIST_MXFP4, return false);856+ GMM_SWIGLU_CHECK_DTYPE(weight, "weight", GetWeightSupportListMxfp4(weight), return false);
825 GMM_SWIGLU_CHECK_DTYPE(weightScale, "weightScale", WEIGHT_SCALE_DTYPE_SUPPORT_LIST, return false);857 GMM_SWIGLU_CHECK_DTYPE(weightScale, "weightScale", WEIGHT_SCALE_DTYPE_SUPPORT_LIST, return false);
826 }858 }
827- GMM_SWIGLU_CHECK_DTYPE(x, "x", X_DTYPE_SUPPORT_LIST_MXFP4, return false);859+ GMM_SWIGLU_CHECK_DTYPE(x, "x", GetXSupportListMxfp4((*gmmDsqParams_.weight)[0]), return false);
828 GMM_SWIGLU_CHECK_DTYPE(xScale, "xScale", X_SCALE_DTYPE_SUPPORT_LIST, return false);860 GMM_SWIGLU_CHECK_DTYPE(xScale, "xScale", X_SCALE_DTYPE_SUPPORT_LIST, return false);
829 GMM_SWIGLU_CHECK_DTYPE(groupList, "groupList", GROUP_LIST_DTYPE_SUPPORT_LIST, return false);861 GMM_SWIGLU_CHECK_DTYPE(groupList, "groupList", GROUP_LIST_DTYPE_SUPPORT_LIST, return false);
830- GMM_SWIGLU_CHECK_DTYPE(output, "output", QUANTOUT_DTYPE_SUPPORT_LIST_MXFP4, return false);862+ GMM_SWIGLU_CHECK_DTYPE(output, "output", GetOutputSupportListMxfp4((*gmmDsqParams_.weight)[0]), return false);
831 GMM_SWIGLU_CHECK_DTYPE(outputScale, "outputScale", QUANTSCALEOUT_DTYPE_SUPPORT_LIST, return false);863 GMM_SWIGLU_CHECK_DTYPE(outputScale, "outputScale", QUANTSCALEOUT_DTYPE_SUPPORT_LIST, return false);
832 return true;864 return true;
833 }865 }
@@ -1179,6 +1211,22 @@ protected:
1179 return true;1211 return true;
1180 }1212 }
1181 1213 
1214+ bool CheckWeightFormatConsistency() const
1215+ {
1216+ const auto firstFormat = (*gmmDsqParams_.weight)[0]->GetStorageFormat();
1217+ size_t weightLength = gmmDsqParams_.weight->Size();
1218+ for (size_t i = 1; i < weightLength; ++i) {
1219+ const auto currentFormat = (*gmmDsqParams_.weight)[i]->GetStorageFormat();
1220+ if (currentFormat != firstFormat) {
1221+ const std::string firstFormatStr = op::ToString(firstFormat).GetString();
1222+ OP_LOGE_FOR_INVALID_FORMAT(apiName_.c_str(), "weight",
1223+ op::ToString(currentFormat).GetString(), firstFormatStr.c_str());
1224+ return false;
1225+ }
1226+ }
1227+ return true;
1228+ }
1229+ 
1182 bool CheckDtypeValid() override1230 bool CheckDtypeValid() override
1183 {1231 {
1184 DataType xDtype = gmmDsqParams_.x->GetDataType();1232 DataType xDtype = gmmDsqParams_.x->GetDataType();
@@ -1189,38 +1237,49 @@ protected:
1189 const aclTensor *groupList = gmmDsqParams_.groupList;1237 const aclTensor *groupList = gmmDsqParams_.groupList;
1190 const aclTensor *output = gmmDsqParams_.output;1238 const aclTensor *output = gmmDsqParams_.output;
1191 const aclTensor *outputScale = gmmDsqParams_.outputScale;1239 const aclTensor *outputScale = gmmDsqParams_.outputScale;
1192- if (weight->GetStorageFormat() == ge::FORMAT_ND && (weight->GetDataType() == DataType::DT_FLOAT4_E1M2 ||1240+ if (!CheckWeightFormatConsistency()) {
1193- gmmDsqParams_.x->GetDataType() == DataType::DT_FLOAT4_E1M2 ||
1194- gmmDsqParams_.output->GetDataType() == DataType::DT_FLOAT4_E1M2)) {
1195- OP_LOGE(ACLNN_ERR_PARAM_INVALID,
1196- "ND format weight does not support weight/x/quant_dtype with DT_FLOAT4_E1M2 data type.");
1197 return false;1241 return false;
1198 }1242 }
1243+ if (weight->GetStorageFormat() == ge::FORMAT_ND && (weightDtype == DataType::DT_FLOAT4_E1M2 ||
1244+ xDtype == DataType::DT_FLOAT4_E1M2 || output->GetDataType() == DataType::DT_FLOAT4_E1M2)) {
1245+ OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON(
1246+ apiName_.c_str(), "weight, x and output",
1247+ "weight=" + std::string(op::ToString(weightDtype).GetString()) +
1248+ ", x=" + op::ToString(xDtype).GetString() +
1249+ ", output=" + op::ToString(output->GetDataType()).GetString(),
1250+ "when the format of weight is ND, the dtypes of weight, x and output can not be DT_FLOAT4_E1M2");
1251+ return false;
1252+ }
1253+ const auto &xDtypeSupportListMxfp4 = GetXSupportListMxfp4(weight);
1254+ const auto &weightDtypeSupportListMxfp4 = GetWeightSupportListMxfp4(weight);
1255+ const char *dtypeSupportList =
1256+ IsMxfp4WeightNzFormat(weight) ?
1257+ "{INT8, FLOAT8_E4M3FN, FLOAT8_E5M2, HIFLOAT8, FLOAT4_E2M1, FLOAT4_E1M2}" :
1258+ "{INT8, FLOAT8_E4M3FN, FLOAT8_E5M2, HIFLOAT8, FLOAT4_E2M1}";
1199 bool xDtypeNotSupported =1259 bool xDtypeNotSupported =
1200 std::find(X_DTYPE_SUPPORT_LIST.begin(), X_DTYPE_SUPPORT_LIST.end(), xDtype) == X_DTYPE_SUPPORT_LIST.end();1260 std::find(X_DTYPE_SUPPORT_LIST.begin(), X_DTYPE_SUPPORT_LIST.end(), xDtype) == X_DTYPE_SUPPORT_LIST.end();
1201 bool xDtypeNotSupportedMxfp4 =1261 bool xDtypeNotSupportedMxfp4 =
1202- std::find(X_DTYPE_SUPPORT_LIST_MXFP4.begin(), X_DTYPE_SUPPORT_LIST_MXFP4.end(), xDtype) ==1262+ std::find(xDtypeSupportListMxfp4.begin(), xDtypeSupportListMxfp4.end(), xDtype) ==
1203- X_DTYPE_SUPPORT_LIST_MXFP4.end();1263+ xDtypeSupportListMxfp4.end();
1204 bool xDtypeNotSupportedPertoken =1264 bool xDtypeNotSupportedPertoken =
1205 std::find(XW_DTYPE_SUPPORT_LIST_PERTOKEN.begin(), XW_DTYPE_SUPPORT_LIST_PERTOKEN.end(), xDtype) ==1265 std::find(XW_DTYPE_SUPPORT_LIST_PERTOKEN.begin(), XW_DTYPE_SUPPORT_LIST_PERTOKEN.end(), xDtype) ==
1206 XW_DTYPE_SUPPORT_LIST_PERTOKEN.end();1266 XW_DTYPE_SUPPORT_LIST_PERTOKEN.end();
1207 if (xDtypeNotSupported && xDtypeNotSupportedMxfp4 && xDtypeNotSupportedPertoken) {1267 if (xDtypeNotSupported && xDtypeNotSupportedMxfp4 && xDtypeNotSupportedPertoken) {
1208- OP_LOGE_FOR_INVALID_DTYPE(apiName_.c_str(), "x", op::ToString(xDtype).GetString(),1268+ OP_LOGE_FOR_INVALID_DTYPE(apiName_.c_str(), "x", op::ToString(xDtype).GetString(), dtypeSupportList);
1209- "{INT8, FLOAT8_E4M3FN, FLOAT8_E5M2, HIFLOAT8, FLOAT4_E2M1}");
1210 return false;1269 return false;
1211 }1270 }
1212 bool weightDtypeNotSupported =1271 bool weightDtypeNotSupported =
1213 std::find(WEIGHT_DTYPE_SUPPORT_LIST.begin(), WEIGHT_DTYPE_SUPPORT_LIST.end(), weightDtype) ==1272 std::find(WEIGHT_DTYPE_SUPPORT_LIST.begin(), WEIGHT_DTYPE_SUPPORT_LIST.end(), weightDtype) ==
1214 WEIGHT_DTYPE_SUPPORT_LIST.end();1273 WEIGHT_DTYPE_SUPPORT_LIST.end();
1215 bool weightDtypeNotSupportedMxfp4 =1274 bool weightDtypeNotSupportedMxfp4 =
1216- std::find(WEIGHT_DTYPE_SUPPORT_LIST_MXFP4.begin(), WEIGHT_DTYPE_SUPPORT_LIST_MXFP4.end(), weightDtype) ==1275+ std::find(weightDtypeSupportListMxfp4.begin(), weightDtypeSupportListMxfp4.end(), weightDtype) ==
1217- WEIGHT_DTYPE_SUPPORT_LIST_MXFP4.end();1276+ weightDtypeSupportListMxfp4.end();
1218 bool weightDtypeNotSupportedPertoken =1277 bool weightDtypeNotSupportedPertoken =
1219 std::find(XW_DTYPE_SUPPORT_LIST_PERTOKEN.begin(), XW_DTYPE_SUPPORT_LIST_PERTOKEN.end(), weightDtype) ==1278 std::find(XW_DTYPE_SUPPORT_LIST_PERTOKEN.begin(), XW_DTYPE_SUPPORT_LIST_PERTOKEN.end(), weightDtype) ==
1220 XW_DTYPE_SUPPORT_LIST_PERTOKEN.end();1279 XW_DTYPE_SUPPORT_LIST_PERTOKEN.end();
1221 if (weightDtypeNotSupported && weightDtypeNotSupportedMxfp4 && weightDtypeNotSupportedPertoken) {1280 if (weightDtypeNotSupported && weightDtypeNotSupportedMxfp4 && weightDtypeNotSupportedPertoken) {
1222 OP_LOGE_FOR_INVALID_DTYPE(apiName_.c_str(), "weight", op::ToString(weightDtype).GetString(),1281 OP_LOGE_FOR_INVALID_DTYPE(apiName_.c_str(), "weight", op::ToString(weightDtype).GetString(),
1223- "{INT8, FLOAT8_E4M3FN, FLOAT8_E5M2, HIFLOAT8, FLOAT4_E2M1}");1282+ dtypeSupportList);
1224 return false;1283 return false;
1225 }1284 }
1226 if (gmmDsqParams_.quantMode == QUNAT_MODE_MX &&1285 if (gmmDsqParams_.quantMode == QUNAT_MODE_MX &&
@@ -1246,7 +1305,7 @@ protected:
1246 ", weight=" + op::ToString(weightDtype).GetString(),1305 ", weight=" + op::ToString(weightDtype).GetString(),
1247 "the dtypes of x and weight must be within the range quantMode 0: both INT8, both "1306 "the dtypes of x and weight must be within the range quantMode 0: both INT8, both "
1248 "FLOAT8_E4M3FN/FLOAT8_E5M2, or both HIFLOAT8; quantMode 2: both FLOAT8_E4M3FN/FLOAT8_E5M2 "1307 "FLOAT8_E4M3FN/FLOAT8_E5M2, or both HIFLOAT8; quantMode 2: both FLOAT8_E4M3FN/FLOAT8_E5M2 "
1249- "or both FLOAT4_E2M1");1308+ "or MXFP4 dtypes supported by the format of weight");
1250 return false;1309 return false;
1251 }1310 }
1252 return true;1311 return true;
@@ -32,6 +32,13 @@ Ascend950,ascend950_mx_multi_weightscale_invalid,V2,true,161002,16:64,FLOAT8_E5M
32Ascend950,ascend950_weightnzv2_mxfp8_multi_weight_e1_valid,WeightNzV2,true,0,16:64,FLOAT8_E4M3FN,ND,NONE,NONE,64:128,FLOAT8_E4M3FN,FRACTAL_NZ,4:4:16:32,NONE,1:128:2,FLOAT8_E8M0,ND,NONE,NONE,NONE,FLOAT,ND,NONE,NONE,16:1:2,FLOAT8_E8M0,ND,NONE,FLOAT,ND,1,INT64,ND,2,0,2,0,NONE,16:64,FLOAT8_E4M3FN,ND,16:1:2,FLOAT8_E8M0,ND32Ascend950,ascend950_weightnzv2_mxfp8_multi_weight_e1_valid,WeightNzV2,true,0,16:64,FLOAT8_E4M3FN,ND,NONE,NONE,64:128,FLOAT8_E4M3FN,FRACTAL_NZ,4:4:16:32,NONE,1:128:2,FLOAT8_E8M0,ND,NONE,NONE,NONE,FLOAT,ND,NONE,NONE,16:1:2,FLOAT8_E8M0,ND,NONE,FLOAT,ND,1,INT64,ND,2,0,2,0,NONE,16:64,FLOAT8_E4M3FN,ND,16:1:2,FLOAT8_E8M0,ND
33Ascend950,ascend950_weightnzv2_mxfp8_multi_weight_valid,WeightNzV2,true,0,16:64,FLOAT8_E4M3FN,ND,NONE,NONE,64:128;64:128,FLOAT8_E4M3FN,FRACTAL_NZ,4:4:16:32;4:4:16:32,NONE,1:128:2;1:128:2,FLOAT8_E8M0,ND,NONE,NONE,NONE,FLOAT,ND,NONE,NONE,16:1:2,FLOAT8_E8M0,ND,NONE,FLOAT,ND,2,INT64,ND,2,0,2,0,NONE,16:64,FLOAT8_E4M3FN,ND,16:1:2,FLOAT8_E8M0,ND33Ascend950,ascend950_weightnzv2_mxfp8_multi_weight_valid,WeightNzV2,true,0,16:64,FLOAT8_E4M3FN,ND,NONE,NONE,64:128;64:128,FLOAT8_E4M3FN,FRACTAL_NZ,4:4:16:32;4:4:16:32,NONE,1:128:2;1:128:2,FLOAT8_E8M0,ND,NONE,NONE,NONE,FLOAT,ND,NONE,NONE,16:1:2,FLOAT8_E8M0,ND,NONE,FLOAT,ND,2,INT64,ND,2,0,2,0,NONE,16:64,FLOAT8_E4M3FN,ND,16:1:2,FLOAT8_E8M0,ND
34Ascend950,ascend950_weightnzv2_mxfp4_multi_weight_valid,WeightNzV2,true,0,16:64,FLOAT4_E2M1,ND,NONE,NONE,64:128;64:128,FLOAT4_E2M1,FRACTAL_NZ,2:4:16:64;2:4:16:64,NONE,1:128:2;1:128:2,FLOAT8_E8M0,ND,NONE,NONE,NONE,FLOAT,ND,NONE,NONE,16:1:2,FLOAT8_E8M0,ND,NONE,FLOAT,ND,2,INT64,ND,2,0,2,0,NONE,16:64,FLOAT4_E2M1,ND,16:1:2,FLOAT8_E8M0,ND34Ascend950,ascend950_weightnzv2_mxfp4_multi_weight_valid,WeightNzV2,true,0,16:64,FLOAT4_E2M1,ND,NONE,NONE,64:128;64:128,FLOAT4_E2M1,FRACTAL_NZ,2:4:16:64;2:4:16:64,NONE,1:128:2;1:128:2,FLOAT8_E8M0,ND,NONE,NONE,NONE,FLOAT,ND,NONE,NONE,16:1:2,FLOAT8_E8M0,ND,NONE,FLOAT,ND,2,INT64,ND,2,0,2,0,NONE,16:64,FLOAT4_E2M1,ND,16:1:2,FLOAT8_E8M0,ND
35+Ascend950,ascend950_weightnzv2_mxfp4_e1m2_valid,WeightNzV2,true,0,16:64,FLOAT4_E1M2,ND,NONE,NONE,64:128;64:128,FLOAT4_E1M2,FRACTAL_NZ,2:4:16:64;2:4:16:64,NONE,1:128:2;1:128:2,FLOAT8_E8M0,ND,NONE,NONE,NONE,FLOAT,ND,NONE,NONE,16:1:2,FLOAT8_E8M0,ND,NONE,FLOAT,ND,2,INT64,ND,2,0,2,0,NONE,16:64,FLOAT4_E1M2,ND,16:1:2,FLOAT8_E8M0,ND
panzhija
panzhijapanzhijaJul 16

[测试][建议改进] 当前新增正例只覆盖 x/weight/output 全为 E1M2,未覆盖本次代码明确放开的 E1M2↔E2M1 交叉组合;新增反例也只覆盖 ND output=E1M2,而 CheckDtypeValid 的新条件分别处理 weight、x、output 三个入口。建议至少补充 NZ 下 x=E1M2/weight=E2M1 及反向组合,并补 ND 下 x=E1M2、weight=E1M2 的非法用例,避免分支或错误日志后续回退。

likedislike
36+Ascend950,ascend950_weightnzv2_mxfp4_x_e1m2_weight_e2m1_valid,WeightNzV2,true,0,16:64,FLOAT4_E1M2,ND,NONE,NONE,64:128;64:128,FLOAT4_E2M1,FRACTAL_NZ,2:4:16:64;2:4:16:64,NONE,1:128:2;1:128:2,FLOAT8_E8M0,ND,NONE,NONE,NONE,FLOAT,ND,NONE,NONE,16:1:2,FLOAT8_E8M0,ND,NONE,FLOAT,ND,2,INT64,ND,2,0,2,0,NONE,16:64,FLOAT4_E1M2,ND,16:1:2,FLOAT8_E8M0,ND
37+Ascend950,ascend950_weightnzv2_mxfp4_x_e2m1_weight_e1m2_valid,WeightNzV2,true,0,16:64,FLOAT4_E2M1,ND,NONE,NONE,64:128;64:128,FLOAT4_E1M2,FRACTAL_NZ,2:4:16:64;2:4:16:64,NONE,1:128:2;1:128:2,FLOAT8_E8M0,ND,NONE,NONE,NONE,FLOAT,ND,NONE,NONE,16:1:2,FLOAT8_E8M0,ND,NONE,FLOAT,ND,2,INT64,ND,2,0,2,0,NONE,16:64,FLOAT4_E2M1,ND,16:1:2,FLOAT8_E8M0,ND
38+Ascend950,ascend950_mxfp4_private_non_nz_e1m2_invalid,V2,true,161002,16:64,FLOAT4_E1M2,ND,NONE,NONE,64:128;64:128,FLOAT4_E1M2,FRACTAL_NZ_C0_2,2:4:16:64;2:4:16:64,NONE,1:128:2;1:128:2,FLOAT8_E8M0,ND,NONE,NONE,NONE,FLOAT,ND,NONE,NONE,16:1:2,FLOAT8_E8M0,ND,NONE,FLOAT,ND,2,INT64,ND,2,0,2,0,NONE,16:64,FLOAT4_E1M2,ND,16:1:2,FLOAT8_E8M0,ND
39+Ascend950,ascend950_mxfp4_nd_x_e1m2_invalid,V2,true,161002,16:64,FLOAT4_E1M2,ND,NONE,NONE,2:64:128,FLOAT4_E2M1,ND,NONE,NONE,2:1:128:2,FLOAT8_E8M0,ND,NONE,NONE,NONE,FLOAT,ND,NONE,NONE,16:1:2,FLOAT8_E8M0,ND,NONE,FLOAT,ND,2,INT64,ND,2,0,2,0,NONE,16:64,FLOAT4_E2M1,ND,16:1:2,FLOAT8_E8M0,ND
40+Ascend950,ascend950_mxfp4_nd_weight_e1m2_invalid,V2,true,161002,16:64,FLOAT4_E2M1,ND,NONE,NONE,2:64:128,FLOAT4_E1M2,ND,NONE,NONE,2:1:128:2,FLOAT8_E8M0,ND,NONE,NONE,NONE,FLOAT,ND,NONE,NONE,16:1:2,FLOAT8_E8M0,ND,NONE,FLOAT,ND,2,INT64,ND,2,0,2,0,NONE,16:64,FLOAT4_E2M1,ND,16:1:2,FLOAT8_E8M0,ND
41+Ascend950,ascend950_mxfp4_nd_output_e1m2_invalid,V2,true,161002,16:64,FLOAT4_E2M1,ND,NONE,NONE,2:64:128,FLOAT4_E2M1,ND,NONE,NONE,2:1:128:2,FLOAT8_E8M0,ND,NONE,NONE,NONE,FLOAT,ND,NONE,NONE,16:1:2,FLOAT8_E8M0,ND,NONE,FLOAT,ND,2,INT64,ND,2,0,2,0,NONE,16:64,FLOAT4_E1M2,ND,16:1:2,FLOAT8_E8M0,ND
35Ascend950,ascend950_mx_grouplist_len_mismatch,V2,true,161002,16:64,FLOAT8_E5M2,ND,NONE,NONE,2:64:128,FLOAT8_E5M2,ND,NONE,NONE,2:1:128:2,FLOAT8_E8M0,ND,NONE,NONE,NONE,FLOAT,ND,NONE,NONE,16:1:2,FLOAT8_E8M0,ND,NONE,FLOAT,ND,1,INT64,ND,2,0,2,0,NONE,16:64,FLOAT8_E5M2,ND,16:1:2,FLOAT8_E8M0,ND42Ascend950,ascend950_mx_grouplist_len_mismatch,V2,true,161002,16:64,FLOAT8_E5M2,ND,NONE,NONE,2:64:128,FLOAT8_E5M2,ND,NONE,NONE,2:1:128:2,FLOAT8_E8M0,ND,NONE,NONE,NONE,FLOAT,ND,NONE,NONE,16:1:2,FLOAT8_E8M0,ND,NONE,FLOAT,ND,1,INT64,ND,2,0,2,0,NONE,16:64,FLOAT8_E5M2,ND,16:1:2,FLOAT8_E8M0,ND
36Ascend950,ascend950_pertoken_multi_weight_invalid,V2,true,161002,16:64,INT8,ND,NONE,NONE,64:128;64:128,INT8,ND,NONE,NONE,128;128,FLOAT16,ND,NONE,NONE,NONE,FLOAT,ND,NONE,NONE,16,FLOAT,ND,NONE,FLOAT,ND,2,INT64,ND,0,0,0,0,NONE,16:64,INT8,ND,16,FLOAT,ND43Ascend950,ascend950_pertoken_multi_weight_invalid,V2,true,161002,16:64,INT8,ND,NONE,NONE,64:128;64:128,INT8,ND,NONE,NONE,128;128,FLOAT16,ND,NONE,NONE,NONE,FLOAT,ND,NONE,NONE,16,FLOAT,ND,NONE,FLOAT,ND,2,INT64,ND,0,0,0,0,NONE,16:64,INT8,ND,16,FLOAT,ND
37Ascend950,ascend950_pertoken_wscale_dim_invalid,V2,true,161002,16:64,INT8,ND,NONE,NONE,2:64:128,INT8,ND,NONE,NONE,2:128:1,FLOAT16,ND,NONE,NONE,NONE,FLOAT,ND,NONE,NONE,16,FLOAT,ND,NONE,FLOAT,ND,2,INT64,ND,0,0,0,0,NONE,16:64,INT8,ND,16,FLOAT,ND44Ascend950,ascend950_pertoken_wscale_dim_invalid,V2,true,161002,16:64,INT8,ND,NONE,NONE,2:64:128,INT8,ND,NONE,NONE,2:128:1,FLOAT16,ND,NONE,NONE,NONE,FLOAT,ND,NONE,NONE,16,FLOAT,ND,NONE,FLOAT,ND,2,INT64,ND,0,0,0,0,NONE,16:64,INT8,ND,16,FLOAT,ND
@@ -40,6 +40,7 @@ inline aclDataType ParseAclDtype(const std::string &dtype)
40 {"FLOAT8_E8M0", ACL_FLOAT8_E8M0},40 {"FLOAT8_E8M0", ACL_FLOAT8_E8M0},
41 {"HIFLOAT8", ACL_HIFLOAT8},41 {"HIFLOAT8", ACL_HIFLOAT8},
42 {"FLOAT4_E2M1", ACL_FLOAT4_E2M1},42 {"FLOAT4_E2M1", ACL_FLOAT4_E2M1},
43+ {"FLOAT4_E1M2", ACL_FLOAT4_E1M2},
43 {"UNDEFINED", ACL_DT_UNDEFINED},44 {"UNDEFINED", ACL_DT_UNDEFINED},
44 };45 };
45 const auto it = dtypeMap.find(Trim(dtype));46 const auto it = dtypeMap.find(Trim(dtype));