Merged
refactor: retire suspended CV parallel experiment #1237
refactor: retire suspended CV parallel experiment #1237
Merged
zhenyuAdd on 25 days ago
zhenyu
zhenyuCollaborators
25 days ago

描述

依据已关闭的 #198 挂起决策,在 dev_0.4.0 下线 CV Parallel 实验及其独占资源,减少未完成运行迁移接口的维护负担。

Fixes #206

Related #198(已关闭的挂起决策);原始实现为 PR !940。

  • 对照 !940 及后续修改,删除实验目录、五个专属 UT、launcher、指南,以及仅被 CV dispatcher 导入的 permute wrapper。
  • 清理四条专属架构债务边、测试排除项和文档引用;保留标准 dispatcher 的 V4/V4.1 SwiGLU 测试。
  • 指定历史 Note .agents/notes/implemented/architecture/2026-10-14-backend-owned-attention-metadata.md 原文保留,不在本 PR diff 中。

共 33 文件 +6/-7518:25 文件删除、8 文件引用收尾,原始 !940 的 23 个新增文件全部覆盖。其余 307 个 package 文件与基线一致;普通 dispatcher、模型、GraphTrainer/EP overlap、auto-overlap、量化、依赖和上游 pin 均未改动。

类型

Checklist:

如何测试

验证版本:NPU e47332eb,基线 4584ada1,固定 TorchTitan ebdfc8c2。3.2 服务器,8×910B2 64GiB,Python 3.12.13、Torch 2.14.0+cpu、torch_npu 2.14.0.dev20260918、Triton-Ascend 3.2.1、CANN 9.3.0~weekly.20261104.01。

检查 实际结果
相关 CPU UT 33 passed,无 skip/deselect,退出 0;包含标准 dispatcher、SwiGLU、前后向、Inductor 和两进程 Gloo
完整 pre-commit 通过,含 Pyrefly、Ruff/format、架构和基础检查;OAT 因无暂存文件未实际扫描
融合 Flash 四层八卡 FSDP8/EP8、4K、16 experts、Muon、262144 tokens/step,三步退出 0,八 rank 正常完成
TensorBoard 原始标量 loss 12.18317413 → 12.15625954 → 12.07823944;grad_norm 30.51685333 → 30.93746758 → 30.00865746,均有限
diff/引用/保护范围 通过;无活跃 CV 引用,历史 Note 不变,其他 307 个 package 文件不变

CPU 和 lint 命令(仓库根目录):

TORCH_DEVICE_BACKEND_AUTOLOAD=0 python -m pytest -v --tb=short -x \
  tests/unit_tests/override/common/test_swiglu_group.py \
  tests/unit_tests/override/common/test_token_dispatch_ops.py \
  tests/unit_tests/override/common/test_moe_score_absorption.py
python -m pre_commit run --all-files --show-diff-on-failure

NPU 复用 examples/deepseek_v4/debug/deepseek_v4_flash_8p_cpt_4k_a3.sh。目录名含 debug,但选择的是完整 Flash/16 专家模型,只裁到四层;仓外 recipe 通过现有工厂裁剪 layers/n_layers/compress_ratios 并重建 Muon profile,设置 compile=None 运行 eager,不修改仓库模型或启动脚本。

MODULE=flash4_recipe CONFIG=flash4_eager NGPU=8 USE_GOLDEN=0 \
  bash examples/deepseek_v4/debug/deepseek_v4_flash_8p_cpt_4k_a3.sh \
  --training.steps 3 --debug.seed 42 --metrics.enable-tensorboard --metrics.log-freq 1

原有 dsv4_smla_ep2_fsdp2 ST 原样执行未通过:仍传入已删除的 --compile.enable / --compile.backend,在配置解析时退出。该 case 与基线相同,本 PR 未修改它;上述 Flash 是通过当前 launcher 的独立功能验证,未冒充该 ST 通过。

按精度对齐开发指南第 3 节非数值改动例外,跳过 3.1~3.4 整网精度对齐。三步训练是功能回归,不作为完整精度、续训或性能验收。

其他信息

新 issue:206;挂起依据:198。

原始日志、JUnit、TensorBoard 与命令归档在验证机 /home/zy/ai_runs/t037_deploy32_20261110_153200;取回证据包包含 95 文件,SHA256 为 25637b03382859a36c37562c9d665b4411d2cc14acde3fe721fe45516a7638fa。

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for zhenyu's contribution.)
zhenyuzhenyuCollaborators
25 days ago Created pull request, commit 5ee31a26
zhenyuzhenyuCollaborators
25 days ago Associated issue: [特性分析] CV并行收益上限分析,[Requirement|需求建议]: dev_0.4.0 下线已挂起的 CV Parallel 实验
atomgit-bot
atomgit-botCollaborators
25 days ago Comments:

🤖 正在生成合并请求摘要,请稍候…

likedislike
Incorrect?
atomgit-bot
atomgit-botCollaborators
25 days ago Comments:

🤖 AI 代码检视正在进行中,请稍候…

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
25 days ago Added label: stat/needs-squash
CANN-robotCANN-robotCollaborators
25 days ago Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
25 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
repo-cann/torchtitan-npu ✅ xuyujun, lrwei0709 (2/2) ✅ xuyujun (1/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
atomgit-bot
atomgit-botCollaborators
25 days ago Comments:

⚠️ 本次变更过大(26 个可审文件、7315 行,预估需 7 轮分片审查),已超出 AI 代码评审的处理范围,本次跳过。建议拆分为更小的 PR 以获得有效评审。

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
25 days ago Set hwcaifubi,lrwei0709,zhaowei1936,zhong_lin,zhanghz1,depeng1994,shengnan666,XDaoHong,xuyujun,zhuofanshen,wanghui0,panchao-gitcode,zzyyjj012 as approver
CANN-robotCANN-robotCollaborators
25 days ago Set hwcaifubi,lrwei0709,zhaowei1936,zhong_lin,zhanghz1,depeng1994,shengnan666,XDaoHong,xuyujun,zhuofanshen,wanghui0,panchao-gitcode,zzyyjj012 as approver
atomgit-bot
atomgit-botCollaborators
25 days ago Comments:

⚠️ 本次变更过大(26 个可审文件、7315 行,预估需 7 轮分片审查),已超出 AI 代码评审的处理范围,本次跳过。建议拆分为更小的 PR 以获得有效评审。

likedislike
Incorrect?
titan-npu-reviewer
titan-npu-reviewer25 days agoStart code review1
.agents/notes/proposed/architecture/2026-09-02-plugin-layout-and-injection-boundaries.md
@@ -3,7 +3,7 @@
33Status: proposed
44Created: 2026-09-02
55Last updated: 2026-10-12
66Tracking: PR #688
titan-npu-reviewer
titan-npu-reviewer25 days agoComments:

当前PR改动代码超过1k行,建议拆分PR后合入。

问题编号:R1237-001

审查版本:e47332ebbcd96562709ec7f78076c7eda3623135

likedislike
titan-npu-reviewer
titan-npu-reviewer25 days agoStart code review1
tests/unit_tests/override/common/test_swiglu_group.py
@@ -51,3 +46,3 @@
5146 
5247@pytest.mark.parametrize(("module", "recipe"), _RECIPES, ids=["v4", "v41"])
53-@pytest.mark.parametrize("dispatcher", ["standard", "cv"])
48+@pytest.mark.parametrize("dispatcher", ["standard"])
titan-npu-reviewer
titan-npu-reviewer25 days agoComments:

一般(S2): 【文档同步】需要补充或更新文档。

本 PR 的文档同步要求:
本 PR 已经在 .agents/notes/proposed/upstream/2026-10-31-upgrade-torchtitan-plan.md 中删掉 CV 的阶段六迁移要求和范围表格项,但同一文件还有两处把 CV 写成“剩余范围”和“必须覆盖的验证项”。.agents/notes 的定位是当前阶段状态,不是只读历史,留着会让后续维护者以为 CV 仍需迁移和验证,和本 PR 的挂起决策冲突。另一处 .agents/notes/implemented/architecture/2026-10-14-backend-owned-attention-metadata.md:104 保留了已删除文档 graph_trainer_cv_parallel.md 的名字,作者明确要求原文保留,本次不列为需改项,但它是历史记录里的一处死路径引用,可另行处理。

  1. .agents/notes/proposed/upstream/2026-10-31-upgrade-torchtitan-plan.md:218:从 Graph/AC 行的必覆盖项里删除 CV、,与本 PR 已删除的阶段六 CV 迁移要求保持一致。
  2. .agents/notes/proposed/upstream/2026-10-31-upgrade-torchtitan-plan.md:91:该条是 2026-10-31 的阶段实施小结,可保留历史结论,但建议补一句“CV 已于后续下线,不再作为剩余迁移项”,避免被读成当前状态。

问题编号:R1237-002

审查版本:e47332ebbcd96562709ec7f78076c7eda3623135

likedislike
titan-npu-reviewer
titan-npu-reviewer
25 days ago Comments:

使用模型:deepseek-v4.1-flash

🤖 AI 代码审查报告

审查结论

  • 合入建议: ⚠️ 建议修改后合入
  • 严重性: 建议(S3)
  • 代码质量: 删除边界清晰,未发现残余运行时引用
  • 安全性: 未发现安全问题
  • 测试数据: 有覆盖(作者报告,本地未复跑)
  • 文档完整性: 部分

这是一个范围明确的删除型 PR:CV 实验、5 个专属 UT、launcher、指南、只被 CV dispatcher 引用的 permute wrapper 都被移除,head 快照的全树搜索没有发现残余导入,架构边界检查与字节编译在实际运行时通过。唯一需要收尾的是同一份升级计划 note 里仍有两处把 CV 当作现役能力/剩余迁移项;代码本身没有发现 S1/S2 问题。

代码质量检查

正确性与鲁棒性

未发现明确问题

专项规则

未发现明确问题

代码坏味道

未发现明确问题

设计与架构

未发现明确问题

上游交互

未发现明确问题

训练 infra 与 NPU 性能

未发现明确问题

文档同步建议

  • 结论:需要修改
  • 依据与建议:本 PR 已经在 .agents/notes/proposed/upstream/2026-10-31-upgrade-torchtitan-plan.md 中删掉 CV 的阶段六迁移要求和范围表格项,但同一文件还有两处把 CV 写成“剩余范围”和“必须覆盖的验证项”。.agents/notes 的定位是当前阶段状态,不是只读历史,留着会让后续维护者以为 CV 仍需迁移和验证,和本 PR 的挂起决策冲突。另一处 .agents/notes/implemented/architecture/2026-10-14-backend-owned-attention-metadata.md:104 保留了已删除文档 graph_trainer_cv_parallel.md 的名字,作者明确要求原文保留,本次不列为需改项,但它是历史记录里的一处死路径引用,可另行处理。
  1. .agents/notes/proposed/upstream/2026-10-31-upgrade-torchtitan-plan.md:218:从 Graph/AC 行的必覆盖项里删除 CV、,与本 PR 已删除的阶段六 CV 迁移要求保持一致。
  2. .agents/notes/proposed/upstream/2026-10-31-upgrade-torchtitan-plan.md:91:该条是 2026-10-31 的阶段实施小结,可保留历史结论,但建议补一句“CV 已于后续下线,不再作为剩余迁移项”,避免被读成当前状态。

改进建议

  • 建议级、可选:tests/unit_tests/override/common/test_swiglu_group.py:24-26,48 的 _DISPATCHERS 现在只剩 standard 一项,@pytest.mark.parametrize("dispatcher", ["standard"]) 也只产生一个取值。既然 cv 分支已删除,可把 dispatcher 目标和配置直接内联,去掉这层只在两值场景下才有意义的间接层;不改行为。
  • 未发现其他必须修改的后续项。

没能验证的部分

  • 没有执行任何 pytest、pre-commit 或 NPU 训练:当前环境缺少 torch、torch_npu 和 torchtitan(import torch 直接失败)。作者报告的 33 项 CPU UT、pre-commit 通过、8 卡三步训练和 TensorBoard 数值都没有复跑;本次实际执行的是静态导入/引用搜索、改动 Python 文件的 py_compile,以及在 head 快照上运行 scripts/check_architecture_boundaries.py --root repo(通过)。
  • 工作区是 head 快照且没有 .git,无法执行 base 4584ada1 与 head e47332e 的树级 diff 或 merge-tree 检查;本次用 diff.patch(33 个文件)与完整 head 快照的全文搜索互相印证,未发现只存在于基线的反向引用。
  • ST dsv4_smla_ep2_fsdp2 仍传入 --compile.enable / --compile.backend(tests/integration_tests/deepseek_v4.py:301-302,316-317),作者说明它与基线一样在配置解析阶段失败;该文件不在本 PR 改动内,因此无法用它证明或否定本 PR 的 ST 状态。

测试审查

  • 结论:可以合入。删除的是已挂起的 CV 实验及只被它引用的资源,保留的运行路径没有被改坏。
  • UT:无需补充。删除的 5 个 CV UT 和 test_swiglu_group.py 里的 cv 参数只覆盖被删实现;保留用例仍从真实 recipe 和 override.imports 进入 standard dispatcher 与 V4/V4.1 SwiGLU。conftest.py 的排除项随目录一起删除,对 cv_parallel、batch_chunk 和被删模块名的全树搜索未发现残余导入,架构边界脚本在 head 通过。
  • ST:无需补充。tests/integration_tests 与 tests/smoke_tests 中没有 CV 用例;本 PR 没有改动任何 ST 的模型、override、并行或编译配置,CV 也没有对应的真实 NPU 训练入口需要回归。

必须解决项以成功发布的代码行内评论为准;总结中的其他内容仅供参考。

审查版本:e47332ebbcd96562709ec7f78076c7eda3623135

likedislike
zhenyu
zhenyuCollaborators
25 days ago Comments:

compile

likedislike
zhenyuzhenyuCollaborators
25 days ago Pre merge succeeded (commit_id: 0dc6154c4dbf1fc5eadf03c2e0f196bdaf966c81)
CANN-robot
CANN-robotCollaborators
25 days ago Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
25 days ago Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
25 days ago Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
25 days ago Added label: ci-pipeline-passed
xuyujun
xuyujunCollaborators
25 days ago Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
25 days ago Added label: approved
weijinyi
weijinyiCollaborators
25 days ago Comments:

/lgtm

likedislike
CANN-robotCANN-robotCollaborators
25 days ago Added label: lgtm
CANN-robot
CANN-robotCollaborators
25 days ago Comments:

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
zhenyuzhenyuCollaborators
25 days ago Resolved final issue
CANN-robotCANN-robotCollaborators
25 days ago Merged pull request
CANN-robot
CANN-robotCollaborators
25 days ago Comments:

Pull Request 已合并或已关闭。

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

likedislike