已合并
ci(pre-commit): OAT 检查切换为远程 compliance hook #13627
ci(pre-commit): OAT 检查切换为远程 compliance hook #13627
已合并
景明创建于 27 天前
景明
景明成员
27 天前

关联Issue https://gitcode.com/cann/ops-transformer/issues/6573

描述

🔧 配置变更

按社区统一接入方式(issue #6573,chenyx_2012)切换:OAT 合规检查由「仓内自维护 oat_check.sh + repo: local」切换为「HiAgent/compliance 远程 Python hook」,业务仓不再维护 OAT 脚本,OAT 版本由 rev 标签(v1.0.6)统一管控。

改动(3 文件)

  • .pre-commit-config.yaml:repo: local 的 oat-check 块替换为 repo: https://gitcode.com/HiAgent/compliance, rev: v1.0.6(id: oat-check,pass_filenames/stages/verbose 与原配置一致)
  • 删除 scripts/oat_check.sh(本地脚本退役)
  • .gitignore 补 oat_reports/(远程 hook 报告目录)

行为等价性评估(已读 compliance v1.0.6 源码)

本地脚本的全部修复点均由远程 hook 覆盖,且架构更优:

本地脚本修复点 远程 hook 实现
120KB 分批(E2BIG 防护) in-process 调用(import oat 直接跑 pipeline),无 subprocess argv 限制,问题不存在
RC=1 无报告阻断 report_file.is_file() 守卫:无报告且 RC!=0 → return 1 阻断 ✅
跨批次旧报告复用 state_file 按 HEAD SHA 聚合 + lock,_cleanup_stale_run_state 清理同 HEAD 残留 ✅
done-marker 去重 "one terminal report per HEAD" 终局报告模型 + CI 分批调度取代 ✅
OAT.xml 支持 _resolve_oat_xml 读仓根 OAT.xml ✅

测试

  • YAML 解析通过;pre-commit run oat-check 实测通过(hook 环境自动克隆 compliance 仓并安装 OAT)
  • 报告目录变化:pre_commit_reports/oat_result.txt → oat_reports/result.txt(已 gitignore)

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 景明 的贡献)
景明景明成员
27 天前 创建了 pull request,commit 08afe863
atomgit-bot
atomgit-bot
27 天前 评论:

变更摘要

本 PR 在 mc2/common/torch_extension 中新增 MoonEP(冗余专家均衡)适配包装 MoonEPElasticBuffer,以组合 ElasticBuffer 的方式复用 ep 四件套 kernel(moe_ep_dispatch/epilogue/combine/combine_epilogue),不改动任何 kernel。包装固化了两个已验证的关键语义:一是把 plan 输出的虚拟专家 id 直通扩充空间 E' = 2E,使 ep 的 home(v) 推导自动正确;二是因 ep 的 combine 为纯求和,改由包装层对专家输出按 recv_topk_weights 预乘实现加权,再走标准 combine 回收。__init__.py 同步导出新类。

主要改动

  • 新增 MoonEPElasticBuffer 包装类: 在 mc2/common/torch_extension/moonep_buffer.py 中新增该类,__init__ 校验 num_experts 为正且为 world size 的整数倍,并在 num_experts 语义上保留 MoonEP 原始专家数 E,内部组合一个 ElasticBuffer。
  • dispatch 自动扩充虚拟专家空间: dispatch 对一维 vtopk 自动 reshape 为 [num_tokens, num_topk],并以 num_experts=2 * self._num_experts、expert_alignment=1、do_cpu_sync=False 调用底层 dispatch,返回 recv_x、与 recv_x 行序一致的 recv_topk_weights 及 EPHandle。
  • combine_weighted 实现加权回收: 先按 num_recv_tokens(handle) 的有效行数构造权重向量并对专家输出 main 预乘 recv_topk_weights(fp8 的 (main, scales) 场景仅预乘 main、scales 透传),再调用底层 combine 得到 combined_x[t] = Σ_k w·x。
  • combine_sum 与 combine_transpose 支持反向: combine_sum 走 ep 原生纯 sum 语义用于 grad_x;combine_transpose 通过 ep 的 topk_weights 透传通道把份级标量发回 home 的 combined_topk_weights[t, k],用于 grad_w。
  • 导出新包装类: mc2/common/torch_extension/__init__.py 的 __all__ 增加 MoonEPElasticBuffer 并新增对应 from .moonep_buffer import MoonEPElasticBuffer 导入。

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

likedislike
不准确?
CANN-robotCANN-robot成员
27 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
27 天前 评论:

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
docs ✅ 刘丹, 蒋礼锐 (2/2) ✅ 刘丹, 蒋礼锐 (2/1)
scripts ✅ 刘丹, 蒋礼锐 (2/2) ✅ 刘丹, 蒋礼锐 (2/1)
sig-ops-transformer ✅ 刘丹, 蒋礼锐 (2/2) ✅ 刘丹, 蒋礼锐 (2/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
CANN-robot
CANN-robot成员
27 天前 评论:

CLA Signature Pass

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

likedislike
此处折叠了130条消息 查看更多
CANN-robotCANN-robot成员
13 天前 添加了label:lgtm
CANN-robot
CANN-robot成员
13 天前 评论:

The MR can not be merged, because of CodeReview discussion not resolved

If you want to solve this problem, you can click here to do it in the FAQs.

likedislike
景明景明成员
13 天前 解决了最后一个问题
CANN-robotCANN-robot成员
13 天前 关闭了关联的issue
CANN-robotCANN-robot成员
13 天前 合入了pull request