feat: add NPU SAS + LI patch for DeepSeek-V4 without mindspeed - #260
Open
0hujun wants to merge 1 commit into
Open
feat: add NPU SAS + LI patch for DeepSeek-V4 without mindspeed#2600hujun wants to merge 1 commit into
0hujun wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is changed
为 DeepSeek-V4 的注意力层添加 NPU 融合算子 patch:
twinkle.kernel.ops.dsv4_sas_li.aclnn_ops.SparseAttnSharedKV融合算子;twinkle.kernel.ops.dsv4_sas_li.aclnn_ops.LightningIndexer融合算子。两个 patch 均为 NPU-only,非 NPU 环境保持默认行为不变。
Motivation
DeepSeek-V4 的混合注意力结构中,稀疏注意力计算和 lightning indexer 索引计算在 NPU 上使用通用 PyTorch 算子串行执行,存在 kernel launch 开销大、显存占用高、耗时波动剧烈等问题。
Performance Results
速度提升(6 层对比)
对比mindspeed与aclnn直调方式:
LI 增量收益(12 层对比)
显存与可训练层数
Summary