Repository navigation
[Feature] Add --attn-dp-size and deprecate --enable-dp-attention - #41818
Merged
Merged
Conversation
ch-wan
requested review from
JustinTong0323,
sogalin,
wisclmy0611 and
zijiexia
as code owners
September 30, 2026 03:07
This was referenced Sep 30, 2026
ch-wan
force-pushed
the
cheng/refactor/spec-draft-scope
branch
from
September 30, 2026 04:24
5353ac8 to
215ad7b
Compare
ch-wan
requested review from
Jiminator,
Qiaolin-Yu,
alexnails,
hnyls2002,
kpham-sgl,
liusy58 and
pyc96
as code owners
September 30, 2026 04:24
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
`--dp-size` counted attention data-parallel groups when `--enable-dp-attention` was set and model replicas otherwise. Give each meaning its own argument: - `--attn-dp-size N` (alias `--attention-data-parallel-size`) sets the number of attention DP groups inside the TP group; `--dp-size` counts replicas only. Replicas combined with attention DP are rejected. - `--enable-dp-attention` is registered with `DeprecatedStoreTrueAction`. Resolution turns `--dp-size N --enable-dp-attention` into `--attn-dp-size N --dp-size 1` before any handler reads the layout. Nothing outside argument handling reads `enable_dp_attention`. The parallel config publishes `attn_dp_enabled` (attention DP size above one, or an elastic EP scale joiner) and `num_dp_ranks` (`dp_size * attn_dp_size`, the old `dp_size` under either meaning), and readers move to whichever of `dp_size`, `attn_dp_size`, `attn_dp_enabled` and `num_dp_ranks` they mean. Wire formats keep their `dp_size` keys for the DP rank count, and the model gateway counts DP ranks as `dp_size * attn_dp_size`. Docs, cookbook configs, scripts and tests use `--attn-dp-size`.
Commands that passed `--dp 1 --enable-dp-attention` ran without attention DP. After the move to `--attn-dp-size` they read `--attn-dp-size 1`, which sets the default. Drop the flag from those commands, drop the DP option that only emitted it from the DeepSeek-OCR, DeepSeek-OCR-2 and GLM-4.7-Flash generators, and let the Kimi-K3 950PR/DT recipe pick DP-Attention off.
The DSA, MLA and DeepSeek-V4 context-parallel handlers run DP groups as attention DP: they set `attn_dp_size = attn_dp_size * dp_size` and `dp_size = 1`. They run before `handle_data_parallelism`, so its replicas-with-attention-DP check never saw `--dp-size 2 --attn-dp-size 2` there, and the handlers resolved it to attention DP 4 without an error. Assert the same condition in each handler before the product.
State that an elastic EP scale joiner runs DP attention at width one, that the DP rank count is `dp_size * attn_dp_size`, what `/server_info` reports for each, and which wire formats keep the `dp_size` key for the rank count.
The Ascend PD disaggregation recipes added after the migration still passed `--dp-size N --enable-dp-attention`. Those become `--attn-dp-size N`, and the TP32 cells that passed `--enable-dp-attention` alone, which ran without attention DP, drop it.
This was referenced Oct 3, 2026
5 tasks done
This was referenced Oct 5, 2026
This branch was successfully deployed
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.
Motivation
--dp-sizemeans two different things. With--enable-dp-attentionit counts attention data-parallel groups inside the TP group; without it, it counts model replicas. Every reader has to look at both flags to know which meaning it has. This PR gives each meaning its own argument, and the runtime reads the meaning it needs.Modifications
Arguments.
--attn-dp-size N(alias--attention-data-parallel-size, default 1) runs N attention data-parallel groups inside the TP group, one scheduler each, while the FFN stays tensor / expert parallel.--dp-sizecounts replicas only. Replicas combined with attention DP (--dp-size> 1 with--attn-dp-size> 1) were never supported and are now rejected at resolution.--enable-dp-attentionis registered withDeprecatedStoreTrueAction: it warns and names--attn-dp-sizeas the replacement. Resolution turns--dp-size N --enable-dp-attentioninto--attn-dp-size N --dp-size 1before any handler reads the layout. With--dp-size 1the old spelling still means attention DP off. Passing it together with--attn-dp-sizeis rejected.--dp-size Nas attention DP N, as before, and reject replicas combined with--attn-dp-size.Runtime. Outside argument handling nothing reads
enable_dp_attention. The published parallel config gains two derived fields:attn_dp_enabled:attn_dp_size > 1, or an elastic EP scale joiner. A joiner's own group can be one rank wide, but it joins an attention-DP deployment and runs its DP-attention paths.num_dp_ranks:dp_size * attn_dp_size, the number of DP ranks (schedulers). It equals the olddp_sizeunder either meaning.Readers migrate by meaning:
dp_size→num_dp_ranks(DP controllers, MLP sync, CUDA graph buffers, load snapshots, prefill delayer, startup weight load, and so on).enable_dp_attention→attn_dp_enabled.dp_size: tokenizer control, the PD bootstrap world size,compute_world_size.Other runtime changes:
num_dp_ranks;attn_dp_sizekeeps the local layout.dp_sizekeys, which still carry the DP rank count: KV-event descriptors, PD prefill server info, and load snapshots.attn_dp_sizeinstead of the flag./server_inforeportsattn_dp_size. The model gateway counts DP ranks asdp_size * attn_dp_size, and falls back todp_sizefor a server that does not report it.Docs, scripts, tests.
--attn-dp-size N.--dp 1 --enable-dp-attentionran without attention DP; they drop the flag. The DeepSeek-OCR, DeepSeek-OCR-2 and GLM-4.7-Flash generators drop the DP option that only emitted it, and the Kimi-K3 950PR/DT recipe picks DP-Attention off.--enable-dp-attentiondeprecated.dp_sizekey for the DP rank count.attn_dp_size.Tests. The new
test_attn_dp_size.pycovers:--attn-dp-size;attn_dp_size/num_dp_ranks/attn_dp_enabled, including a scale joiner and overrides.Gateway unit tests cover the DP rank count.
Accuracy Tests
H200, this PR vs its base. GSM8K uses 300 questions; greedy text is 4 prompts × 48 tokens. The DeepSeek-V2-Lite (base model) row is the mean of 6 interleaved runs per side:
server_infothis PR--tp 4 --attn-dp-size 4 --ep-size 4/--tp 4 --dp 4 --enable-dp-attention --ep-size 4dp_size=1, attn_dp_size=4--tp 2 --attn-dp-size 2/--tp 2 --dp 2 --enable-dp-attentiondp_size=1, attn_dp_size=2--tp 2 --dp 2(replicas) on bothdp_size=2, attn_dp_size=1--tp 4 --dp 4 --enable-dp-attentionresolves to the same layout as--attn-dp-size 4, produces identical greedy text, and prints one deprecation warning. The new spelling prints none.Speed Tests and Profiling
DeepSeek-V2-Lite,
--tp 4 --attn-dp-size 4 --ep-size 4vs the old spelling on the base, 6 interleaved runs each, GSM8K output throughput: base 6069 tok/s (range 5626–6367), this PR 5883 tok/s (range 5676–6456). The difference is within the run-to-run spread;attn_dp_enabledandnum_dp_ranksare computed once at publication, not per read.Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): 🚫 Run #36773503469⚠️ Not run on latest push -- push again to dispatch.
Latest PR Test (Extra):
Latest PR Test (AMD ROCm 10): 🚫 Run #36773503843