已合并
refactor: remove deepseek4 redundant Triton paths and align CSA/MHC CLI #4871
refactor: remove deepseek4 redundant Triton paths and align CSA/MHC CLI #4871
已合并
丁子叉创建于 16 天前
丁子叉成员
16 天前

What this PR does / why we need it?

This PR simplifies the DeepSeek-V4 CSA and MHC implementations after the Ascend fused paths became stable.

Main changes:

  • Remove redundant Triton MHC, Sinkhorn, RMSNorm, and SFA implementations.
  • Retain the Triton pre_only kernel required by the MHC head stage.
  • Keep eager implementations as fallback paths.
  • Rename G2-related components to DeepSeek-V4 CSA/HCA terminology.
  • Relocate MHC operators into the common ops directories.
  • Consolidate CSA eager attention implementations.
  • Align DeepSeek-V4 CLI arguments with Megatron and MindSpeed conventions.
  • Remove incompatible legacy RoPE options from all DeepSeek-V4 scripts.

Does this PR introduce any user-facing change?

Yes. DeepSeek-V4 CLI configurations need to be updated as follows:

Type Previous option New option / behavior
Renamed --use-ascend-mhc --use-fused-mhc
Renamed --g2-window-size 128 --sliding-window-size 128
Removed --rope-head-dim 64 --qk-pos-emb-head-dim 64
Removed --norm-eps 1e-6 --norm-epsilon 1e-6
Renamed --position-embedding-type g2 --position-embedding-type deepseek4
Replaced --use-g2-indexer-loss --indexer-loss-coeff 1.0; use 0 for inference
Removed --use-triton-sfa --use-sparse-flash-attn
Removed --use-g2-attention No replacement required
Removed --use-triton-sinkhorn Use fused MHC or the eager fallback
Removed --use-triton-rmsnorm-without-weight Use fused MHC or the eager fallback
Removed --mhc-recompute No replacement required
Removed from V4 scripts --use-fused-rotary-pos-emb Incompatible with the DeepSeek-V4 RoPE path
Removed from V4 scripts --use-rotary-position-embeddings Overrides the DeepSeek-V4 position embedding type
Retained --use-triton-mhc Only controls the MHC-head pre_only kernel
Behavior changed --use-fused-lightning-indexer and --use-fused-lightning-indexer-loss Must be enabled or disabled together; the framework automatically enables both if only one is provided

Recommended DeepSeek-V4 position embedding configuration:

--position-embedding-type deepseek4
--qk-pos-emb-head-dim 64

Do not combine it with:

--use-fused-rotary-pos-emb
--use-rotary-position-embeddings

How was this patch tested?

  • Checked all DeepSeek-V4 training, fine-tuning, inference, POC, and ST scripts.
  • Verified that removed CLI options have no remaining DeepSeek-V4 references.
  • Ran bash -n against all affected DeepSeek-V4 shell scripts.
  • Ran Python compilation and applicable code-quality checks for the modified Python modules.
  • Ran git diff --check.
  • Applicable local pre-commit hooks passed. The local Gitleaks hook could not run because the ./gitleaks binary was unavailable.
  • GitCode remote Git Hooks passed successfully.
  • Verified that importing the repository without Triton remains protected by the existing try/except logic.
likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 丁子叉 的贡献)
丁子叉成员
16 天前 创建了 pull request,commit f6456092
atomgit-bot
atomgit-bot
16 天前 评论:

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

likedislike
atomgit-bot
atomgit-bot
16 天前 评论:

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

likedislike
ascend-robotascend-robot成员
16 天前 添加了label:stat/needs-squash
此处折叠了255条消息 查看更多
guozhihua2成员
13 天前 评论:

/approve

likedislike
ascend-robotascend-robot成员
13 天前 添加了label:approvedlgtm
ascend-robotascend-robot成员
13 天前 合入了pull request
ascend-robot
ascend-robot成员
13 天前 评论:

Pull Request 已合并或已关闭。

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

likedislike
ascend-robot
ascend-robot成员
13 天前 评论:

Pull Request 已合并或已关闭。

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

likedislike