feat: support FlashComm1 sequence parallelism for DeepSeekV4 NPU. - #2022
Open
chenchuw886 wants to merge 3 commits into
Open
feat: support FlashComm1 sequence parallelism for DeepSeekV4 NPU.#2022chenchuw886 wants to merge 3 commits into
chenchuw886 wants to merge 3 commits into
Conversation
Collaborator
|
Commit messages must conform to the specifications and must end with a dot. |
chenchuw886
force-pushed
the
flashcomm1-clean
branch
2 times, most recently
from
July 28, 2026 01:32
68a6b53 to
464e245
Compare
chenchuw886
force-pushed
the
flashcomm1-clean
branch
from
July 28, 2026 04:57
464e245 to
856c5fb
Compare
Author
Done. |
chenchuw886
marked this pull request as ready for review
July 28, 2026 05:00
chenchuw886
requested review from
Clement-Wang26,
DongheJin,
DragonFive,
JimHsiung,
Kang-Meng,
RobbieLeung,
XuZhang99,
liujinguang0125,
liutongxuan,
walsonyang,
xiao-yu-chen,
yingxudeng,
yq33victor and
zhang-minchao
as code owners
July 28, 2026 05:00
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.
Summary
This PR extends the NPU FlashComm1 sequence-parallel path introduced in
#1890 to DeepSeek V4 /
DSV4-Flash.
During prefill, hidden states are sharded across the TP group and kept in the
sharded layout where supported. The full-sequence layout is restored before
DeepSeek Sparse Attention and routed-MoE computation, then converted back to
the sharded layout through ReduceScatter or explicit re-sharding. The final
hidden states are gathered before the model head and MTP state handling.
FlashComm1 remains disabled by default:
Enable it with:
MMRS fusion remains an independent opt-in inherited from #1890:
The supplied performance record identifies only the FlashComm1 off/on toggle;
it does not identify the MMRS setting or communication mode. Therefore, the
results below make no separate MMRS performance claim.
Main Changes
FlashComm1Contextinto the DeepSeek V4 NPU prefill path.model-output and MTP state handling.
routed-MoE computation.
output projection.
layout.
DenseMLPfrom the generic FlashComm1gather/reduce-scatter path, avoiding an incorrect gather inside the
shared-expert branch.
dp=1andtp>=8activation restrictions so thetested
dp4 tp4topology can use FlashComm1.policy change also applies to the existing Qwen3.5 FlashComm1 path.
padding, and reduce-mode selection.
Default Activation Policy
FlashComm1 becomes active only when all applicable runtime conditions are met:
--enable_flashcomm1=true.--flashcomm1_min_prefill_tokens, which now defaults to 1000.cp_size=1; context parallelism remains unsupported.actual sequence sharding.
There is no longer an explicit
dp=1ortp>=8requirement. Decode remainsoutside the FlashComm1 path.
ACL Graph was enabled in the benchmark deployment, but the implementation does
not run FlashComm1 inside an ACL Graph forward. FlashComm1 operates on the
eligible non-graph prefill path, while graph execution can remain enabled for
the deployment.
Validation
Unit coverage added
dp4 tp4.Checks performed
pre-commit run --all-files: passed.Performance
Test Configuration
cp_size)Measured Results
At concurrency 32, total throughput per card increases from 604.57 to 646.43.
At concurrency 1, it increases from 50.43 to 50.76.