Merged
MC2 A2/A3 错误码首报与失败传播整改 #15178
MC2 A2/A3 错误码首报与失败传播整改 #15178
Merged
ZZYuanAdd on 26 days ago
ZZYuan
ZZYuanCollaborators
26 days ago

整改 MC2 A2/A3 的错误码首报、参数诊断和失败传播。保留 MC2 公共路径中的用户输入校验及必要的安全失败返回。保留已登记的注册和下层依赖边界。

排除 AlltoAllAllGatherBatchMatMul、BatchMatMulReduceScatterAlltoAll、RMS 全变体、GroupedMatMulAllReduce 和 A5/A6 专属实现。两项新增排除的算子已撤回专属改动及独占的双通信组校验。

本次回退后两个算子的 910B host 构建通过。当前提交 CI 已触发。

关联 #7037。

按本轮范围收窄,HCCL 库加载、拓扑与 rank 查询、缓冲查询和图融合探测恢复既有上报行为。A2/A3 host UT 各 1137 项通过,受影响 API 产品库构建通过。

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for ZZYuan's contribution.)
ZZYuanZZYuanCollaborators
26 days ago Created pull request, commit 94e6b3d2
ZZYuanZZYuanCollaborators
26 days ago Associated issue: MC2 部分参数校验仍使用废弃错误码且重复上报
atomgit-bot
atomgit-bot
26 days ago Comments:

变更摘要

本次变更统一修正了 MC2 各算子(A2/A3 路径)参数校验的废弃错误码上报:将原有的 OP_LOGE_WITH_INVALID_ATTR、OP_LOGE_WITH_INVALID_INPUT_FORMAT 等旧接口替换为 OP_LOGE_FOR_INVALID_VALUE、OP_LOGE_FOR_INVALID_VALUE_WITH_REASON、OP_LOGE_FOR_INVALID_VALUES_WITH_REASON、OP_LOGE_FOR_INVALID_FORMAT_WITH_REASON 系列正式错误码宏,将属性名规范为 snake_case 并补齐参数名、实际取值与约束原因;同时把外层失败包装改为仅记录日志的 OP_LOGE_LIBOPAPI_REPORT,避免掩盖根因首报并保留原返回值。此外删除了若干已被前置校验保证不可达的检查,并新增统一的 UT 断言工具与大量负向用例。

主要改动

  • 错误码宏统一替换: 在 aclnn_all_gather_matmul_v2.cpp、attention_to_ffn_tiling.cpp、ffn_to_attention_tilling.cpp、moe_distribute_dispatch_tiling.cpp、moe_update_expert_tiling.cpp、mega_moe_infershape.cpp 等文件中,将旧 OP_LOGE_WITH_INVALID_ATTR 换为 OP_LOGE_FOR_INVALID_VALUE / ..._WITH_REASON / ..._VALUES_WITH_REASON,属性名由 worldSize、quantMode、moeExpertNum、epWorldSize 等改为 world_size、quant_mode、moe_expert_num、ep_world_size 等,并补充实际值与约束描述。
  • 多参数关系类校验改造: 对专家数与 rank 关系校验(attention_to_ffn_tiling.cpp 中 ffn_start_rank_id + ffn_num <= world_size、moe_distribute_combine_tiling.cpp 与 moe_distribute_dispatch_tiling.cpp 中 ep_world_size 可被 shared_expert_rank_num 整除、moe_expert_num 可被 ep_world_size - shared_expert_rank_num 整除、moe_distribute_dispatch_v3_infershape.cpp 中共享专家配置、moe_update_expert_tiling.cpp 中 local_rank_id 与 world_size 关系)改用 OP_LOGE_FOR_INVALID_VALUES_WITH_REASON 并同时上报多个参数名与取值。
  • 外层失败包装改为仅记录日志: 将 CheckAndSetAttrs、CheckExpertAttrs、CheckAddRmsNormInput、CheckExpertScalesDtypeAndFormat、CheckAndSetInputOutputInfo、InferShapeForMatmul 等上层调用的 OP_LOGE_FOR_INVALID_VALUE_WITH_REASON / MC2_CHECK_LOG_RET 替换为 OP_LOGE_LIBOPAPI_REPORT,使最终返回码与原返回逻辑保持不变、根因只上报一次。
  • 删除冗余校验: 移除 moe_distribute_combine_v2_tiling.cpp 中的 tp_world_size >= 2 检查、moe_distribute_dispatch_v3_infershape.cpp 中的 moeRankNum <= 0 检查、moe_distribute_dispatch_tiling.cpp 中的 localMoeExpertNum <= 0 检查,以及 quant_grouped_mat_mul_allto_allv_tiling_common.cpp 中对 sendCounts / recvCounts 空指针的检查。
  • 新增 UT 断言工具与负向用例: 新增 mc2/common/tests/ut/formal_error_assertions.h,提供 Mc2ErrorCodeUT::ExcelErrorReportScope 与 ExpectExcelFormalError,用于校验错误只上报一次、错误码(如 EZ0024、EZ0026、EZ0027、EZ0035)、参数字段与实际值及格式化消息内容;各算子 UT 文件据此新增了覆盖非法属性取值、参数关系与格式(如 expert_scales 的 FRACTAL_NZ)的负向测试用例。
  • 推断数据类型与属性诊断细化: mc2_common_infershape.cpp 与 matmul_reduce_scatter_v2_infershape.cpp 中对 y_dtype 为 null 或 DT_UNDEFINED 分别上报实际值并给出具体修复原因;all_gather_matmul_v2_infershape.cpp 将 OP_LOGE_IF 改为显式 if + OP_LOGE_LIBOPAPI_REPORT 并返回 GRAPH_FAILED。

🧩 本次 Review 已使用自定义 Skill:

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
26 days ago Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
26 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
mc2 ✅ zhu-mingzhe71, ryan_li (2/2) ✅ zhu-mingzhe71 (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

SuperYuan, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
290 messages are collapsed here。 See more
ZZYuanZZYuanCollaborators
18 days ago Associated issue: [Bug-Report|缺陷反馈]: aclnnAlltoAllQuantMatmul/V2 输出形状、BS 整除与 bias dtype 非法时返回 561002,资料声明 161002
ZZYuanZZYuanCollaborators
18 days ago Deleted associated issue: [Bug-Report|缺陷反馈]: aclnnAlltoAllQuantMatmul/V2 输出形状、BS 整除与 bias dtype 非法时返回 561002,资料声明 161002
ZZYuanZZYuanCollaborators
18 days ago Associated issue: [Bug-Report|缺陷反馈]: aclnnQuantMatmulAllReduceV4/V5 x1Scale 形状不符时返回 561002,资料声明 shape 违规应为 161002
ZZYuanZZYuanCollaborators
18 days ago Deleted associated issue: [Bug-Report|缺陷反馈]: aclnnQuantMatmulAllReduceV4/V5 x1Scale 形状不符时返回 561002,资料声明 shape 违规应为 161002
ZZYuanZZYuanCollaborators
18 days ago Associated issue: [Bug-Report|缺陷反馈]: aclnnAllGatherMatmulV2 A2(AIV 分支)不校验 amaxOut:非空指针仍返回 0 且输出永不写出