Open
[fix] Align v0.4.0 performance with v0.3.0 #1424
1Fire4Add on 6 days ago
[fix] Align v0.4.0 performance with v0.3.0 #1424
Open
Merge blocked
CANN-robot
6 days ago Comments:
6 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
⚠️ This PR does not yet meet the following requirements:lgtm (requires ≥ 2 person(s) per module)、approve (requires ≥ 1 person(s) per module)
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-cann/torchtitan-npu | ❌ (0/2)(You can also ask: zzyyjj012, zhaowei1936, 钟林, xuyujun, wanghui0) | ❌ (0/1)(You can also ask: wanghui0, lrwei0709, 钟林, zhanghz1, panchao-gitcode) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
hitwdy, thanks for your pull request. All authors of the commits have signed the CLA. 👍


6 days ago Added label: cann-cla/yes
6 days ago Set hwcaifubi,lrwei0709,zhaowei1936,zhong_lin,zhanghz1,depeng1994,shengnan666,XDaoHong,xuyujun,zhuofanshen,wanghui0,panchao-gitcode,zzyyjj012 as approver
6 days ago Set hwcaifubi,lrwei0709,zhaowei1936,zhong_lin,zhanghz1,depeng1994,shengnan666,XDaoHong,xuyujun,zhuofanshen,wanghui0,panchao-gitcode,zzyyjj012 as approver
6 days ago Set hwcaifubi,lrwei0709,zhaowei1936,zhong_lin,zhanghz1,depeng1994,shengnan666,XDaoHong,xuyujun,zhuofanshen,wanghui0,panchao-gitcode,zzyyjj012 as approver
6 days ago Set hwcaifubi,lrwei0709,zhaowei1936,zhong_lin,zhanghz1,depeng1994,shengnan666,XDaoHong,xuyujun,zhuofanshen,wanghui0,panchao-gitcode,zzyyjj012 as approver
55 messages are collapsed here。 See more
CANN-robot
2 days ago Comments:
2 days ago Comments:
| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


2 days ago Removed label: ci-pipeline-failed
2 days ago Added label: ci-pipeline-running
2 days ago Removed label: ci-pipeline-running
2 days ago Added label: ci-pipeline-passed
描述
恢复 DeepSeek V4.1 的 ViT 激活重算,在 FSDP 包装前为 32 个视觉 block 注册重算。分块 loss 将输出头的 BF16 梯度累积到独立 FP32 缓冲区,末块沿用 FSDP ReduceScatter,减少重复 Cast 和 Transpose。
新增 DeepSeek V4.1 的 A5 八卡 block-FP8 性能配方,使用轮转路由和 40 层 fullgraph 编译。该配方将 Engram 门控投影纳入 FP8,并在 A5 Inductor 编译 Engram 层时限制融合,避免反向传播生成超大工作区。
类型
Checklist:
如何测试
TORCH_DEVICE_BACKEND_AUTOLOAD=0 python -m pytest -q tests/unit_tests/models/common/test_chunked_loss.py tests/unit_tests/models/deepseek_v4_1/test_model_split.py::test_multimodal_parallelize_wraps_each_vision_block_before_fsdp,3 项通过。全量 pre-commit 通过,包含 Pyrefly。
单元测试
python -m pytest -q tests/unit_tests,1462 项通过,42 项跳过,1 项符合预期失败。A5 八卡复现命令(路径已脱敏)
HF_ASSETS_PATH="$TOKENIZER_DIR" \ MODULE=torchtitan_npu_recipes.tests.models.deepseek_v4_1 \ CONFIG=deepseek_v4_1_flash_8p_cpt_4k_a5_balanced_compile \ bash scripts/run_train.sh精度和性能验证结果
grad_norm各 50/50 步比特一致。2c6eb407A5 性能。8 卡 block-FP8,序列长度 4096,每卡每个 microbatch 8192 tokens,梯度累积 4 次,全局每步 262144 tokens。两版各运行 10 步,耗时和吞吐取第 2–10 步中位数,显存取日志峰值。基线为 v0.3.0,CPU 绑核、loss 实现、运行栈和编译调试设置沿用各自版本。
其他信息
沿用现有 checkpoint 参数和格式,无新增依赖。性能验证使用本地 4K 基准配方,路径已脱敏。