Merged
[fix](dsv4): avoid unbacked shape guards in fused Compressor #935
xuyujunAdd on Sep 24
[fix](dsv4): avoid unbacked shape guards in fused Compressor #935
Merged
Pull Request has been successfully merged by CANN-robot.
(Thank you for xuyujun's contribution.)Sep 24 Added label: cann-cla/yes
CANN-robot
Sep 24 Comments:
Sep 24 Comments:
CANN-robot
Sep 24 Comments:
Sep 24 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 | ✅ panchao-gitcode, lrwei0709 (2/2) | ✅ panchao-gitcode (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
xuyujun, thanks for your pull request. All authors of the commits have signed the CLA. 👍


Sep 24 Pre merge succeeded (commit_id: 100c402539e249457822b4990ffbced0709d66ca)
48 messages are collapsed here。 See more
weijinyi
Oct 10 Comments:
Oct 10 Comments:
/lgtm


panchao-gitcode
Oct 10 Comments:
Oct 10 Comments:
/approve


Oct 10 Added label: lgtmapproved
Oct 10 Merged pull request
Oct 24 Associated issue: [RFC] Compressor融合算子支持CP
描述
修复 DeepSeek V4 融合 Compressor 在 CP + torch.compile 下的无提示动态尺寸守卫错误。
计划构建时记录空计划标记,供编译区选择空输入回退;空 rank 仍参与必需的 CP collective。状态表尺寸使用 torch.sym_min/max 表达,保留原有尺寸语义。
在 torchtitan_npu/ops/ascendc/compressor.py 提供按需加载的 CANN 兼容入口:通过公开 torch.library.register_fake 接口,为 _compressor_forward 注册支持符号尺寸的 fake 实现,TND 输出容量以严格等价的整数公式
(a + b - abs(a - b)) // 2表达min(a, b),同时避免 Python 比较守卫和 A5 上报告的torch.sym_min返回NotImplemented导致new_empty失败。保留二维/三维输出形状和辅助输出 FP32 契约,继续复用 CANN 的计算内核、autograd 和反向实现。无需修改 CANN 安装包;仅在融合 override 构造时注册,不增加训练热路径操作。类型
Checklist:
如何测试
153 容器,CPU 测试,无需执行 A5 内核:
前一版两文件合计 45 passed。本轮改用整数容量公式并补充 checkpoint 用例后,新增测试文件独立重跑 12 passed。另在不加载 NPU 扩展的 CPU Inductor + checkpoint 探针中,C4/C128、每种 3 组动态输入,共 6 组前后向与 eager 对照通过。
覆盖:
独立检查 153 w0920 包内的真实 _compressor_forward_fake:原函数在 C4/C128 无提示符号输入上均复现 guard 错误,将 min 改为 torch.sym_min 后均通过;10 组具体尺寸检查通过。该探针未作为生产代码提交。
Ruff、格式、git diff --check 和新增模块的 Pyrefly 检查通过。pre-commit 基础检查通过;完整 OAT 因本机缺少 oat-py 且系统 Python 受管理而失败,项目 Pyrefly 因本机缺少仓库依赖失败,未声称完整检查通过。
其他信息
A5 真实融合算子的完整 compile 训练:
EP4FSDP4CP2不开启compressor算子:
EP4FSDP4CP2开启compressor算子: