合并受阻
变更摘要
本 PR 修复 MegaMoe Level1 用例在 CI 使用不含 Git 元数据的测试归档目录时,采集源码 SHA 因 git rev-parse HEAD 返回 128 而失败的问题,并将重复的默认容量测试收敛为单一 Router 接口测试。核心改动:在 _mega_moe_utils.py 的 environment_identity() 中将 Git SHA 采集改为可降级的辅助信息,Git 仓库缺失或不可用时记录 source_sha: null 与 source_sha_error 失败原因,同时继续写出版本、文件哈希及各 rank 证据;删除 _test_mega_moe_defaults.py 并新增 _test_mega_moe_router_interface.py,将原先默认容量四组合、ABBA、预热与内存采样收敛为一个 Router 接口场景,保留省略 counts 时的内部统计、Router 梯度回传及参数更新校验;test_mega_moe.py 中对应的四卡用例由 test_mega_moe_default_interface 更名为 test_mega_moe_router_interface,worker 从 _test_mega_moe_defaults.py 切换为 _test_mega_moe_router_interface.py,Common/Mega 各执行一次正反向与 SGD,每个 rank 的正反向次数由 136 降至 2。
主要改动
- Git SHA 采集降级: 在
_mega_moe_utils.py的environment_identity()中,git rev-parse HEAD改为try/except包裹,捕获CalledProcessError与OSError,返回值新增source_sha_error字段,Git 不可用时source_sha记录为null而不再中断证据写出。 - 删除默认容量测试: 删除
_test_mega_moe_defaults.py(原 218 行),移除重复的默认/显式容量 A/B 四组合(ABBA)、预热与内存采样逻辑。 - 新增 Router 接口测试: 新增
_test_mega_moe_router_interface.py,通过_router_weight、_route、_run_router_layer实现 Common 与MegaMoeExperts各一次正反向和 SGD 更新,以 dict 形式比对 output、input/route/专家/Router 梯度及权重,并在write_evidence中记录counts_supplied: False与backend_steps。 - 用例更名与 worker 切换: 在
test_mega_moe.py中,四卡用例更名为test_mega_moe_router_interface,文档字符串与调用目标同步更新,2 卡仍沿用_test_mega_moe_resources.py,并顺带调整了 import 顺序。


@feiranzhang, 当前/check-pr未通过,原因如下:
以下Pull Request描述检查项未通过:
选项未通过检查: 设计:PR对应的方案是否已经经过Maintainer评审,方案检视意见是否均已答复并完成方案修改
选项未通过检查: 测试:PR中的代码是否已有UT/ST测试用例进行充分的覆盖,新增测试用例是否随本PR一并上库或已经上库
以下issue检查项未通过:
Pull Request未关联issue
请修改好上述检查错误后,重新使用/check-pr触发检查。


/check-pr


PR did not pass the platform merge check, please confirm CodeOwner review and other merge conditions are met.


/retest


🎉 恭喜!代码检查通过
本次 PR 未发现关键问题 ✅
此评论由 AI Code Review Bot 自动生成


| Platform Type | Module | Excution Time | Time Limit |
|---|---|---|---|
| _mindspore | - | - | - |
| - | shard | 754.604s | 600.0s |
| - | pipeline_parallel | 1168.70363s | 675.0s |
| - | fully_shard | 2446.766s | 1375.0s |
| - | process_group | 85.079s | 120.0s |
| - | context_parallel | 79.537s | 120.0s |
| - | init_weights | 77.748s | 120.0s |
| - | swap_optimizer | 103.592s | 120.0s |
| - | distributed_checkpoint | 63.58s | 120.0s |
| - | st | 14.52662s | 15.0s |
| - | activation_checkpoint | 8.9935s | 300.0s |
| _torch | - | - | - |
| - | shard | 210.428s | 300.0s |
| - | pipeline_parallel | 755.201s | 600.0s |
| - | clip_grad | 87.816s | 120.0s |
| - | activation_checkpoint | 122.82225s | 150.0s |
| - | optimizer | 343.351s | 300.0s |
| - | accuracy | 96.66s | 120.0s |
| - | fully_shard | 374.116s | 600.0s |
| - | tensor_parallel | 289.228s | 300.0s |
| - | swap_optimizer | 98.829s | 120.0s |
| - | expert_parallel | 98.977s | 120.0s |
| - | multicore | 97.502s | 120.0s |
| - | dtensor | 94.077s | 120.0s |
| - | llama3_examples | 120.404s | 120.0s |
| - | init_weights | 104.795s | 118.75s |
| - | distributed_checkpoint | 125.415s | 120.0s |
| - | process_group | 120.313s | 90.0s |
| - | context_parallel | 110.114s | 120.0s |


| Project Name | Build_Stage | Build Result | Details |
|---|---|---|---|
| Hyper-parallel_Atomgit_Gate | - | ❌ FAILURE | 9049 |
| Smoke_Ascend910b | FAILURE | 9049 | |
| Smoke_Ascend910b_Torch | FAILURE | 9049 |


Paired: GitHub #4 ↔ GitCode !1368
What type of PR is this?
/kind bug
What does this PR do / why do we need it:
CI 使用不含 Git 元数据的测试归档目录,两个 MegaMoe Level1 用例完成计算和校验后,在采集源码 SHA 时因 Git 返回 128 而失败。
source_sha: null和source_sha_error,继续写入版本、文件哈希及各 rank 的证据;其他证据读取错误仍正常抛出。router_interface命名。tests/torch/multicore/目录,已有精度、性能和共享资源用例保持其覆盖范围。本 PR 涉及 4 个测试文件,新增 118 行、删除 230 行。
Which issue(s) this PR fixes:
Fixes #375
Test Plan and Test result:What scenarios were tested, and what were the verification results(Function, performance, reliability, etc.):
Self-checklist:(请自检,在[ ]内打上x,我们将检视你的完成情况,否则会导致pr无法合入)