Repository navigation
[Performance][MRV2] Skip CPU length synchronization for DeepSeek V4 - #19355
linfeng-yuan wants to merge 1 commit into
Conversation
Assisted-by: Codex Signed-off-by: linfeng-yuan <194351811+linfeng-yuan@users.noreply.github.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request optimizes speculative decoding performance for the DeepSeek V4 model family by removing redundant CPU-side synchronization of token counts. By generalizing the existing V4.1 exemption logic, the changes ensure that models using device-side sequence lengths can proceed without stalling the asynchronous decode pipeline, while maintaining compatibility with existing PP (Pipeline Parallelism) consumers. Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:
If CI fails, you can run linting and testing checks locally according Contributing and Testing. |
There was a problem hiding this comment.
Code Review
Suggested PR Title:\n\nmarkdown\n[Ops][Feature] Extend device sequence length exemption to DeepSeek V4 family\n\n\nSuggested PR Summary:\n\nmarkdown\n### What this PR does / why we need it?\nThis PR extends the exemption for CPU length synchronization to the entire DeepSeek V4 family (including `deepseek_v4`, `deepseek_v4_text`, `deepseek_v41`, and `deepseek_v41_text`), as these models use device sequence lengths for attention. Previously, this exemption was only applied to `deepseek_v41`. A new helper function `is_deepseek_v4_family` is introduced in `utils.py` to identify these configurations, and the model runner has been updated to use this helper.\n\n### Does this PR introduce _any_ user-facing change?\nNo.\n\n### How was this patch tested?\nThe changes were tested by updating existing unit tests in `tests/ut/worker/test_model_runner_v2.py` and adding new unit tests in `tests/ut/worker/test_spec_pp_cpu_counts.py` to verify the configuration detection and the host synchronization bypass logic.\n
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
What this PR does / why we need it?
MRV2 exempts DeepSeek V4.1 from copying rejection-corrected token counts back to the CPU and waiting for that copy on the next step, but V4 takes the synchronous path even though its attention uses device sequence lengths. This can interrupt asynchronous decode submission.
Extend the existing exemption to the V4/V4.1 family. Recognize text configs, nested config representations, and the config-class identity when DSpark overrides an instance's
model_type. Keep the device-side postprocessing and optimistic CPU upper bounds, and preservesync_spec_pp_cpu_countsso PP consumers still receive exact counts. Other models retain their existing behavior.This PR is independent of the UVA prefix-write optimization.
Does this PR introduce any user-facing change?
V4 speculative decoding avoids an unnecessary host/device synchronization. No new configuration, API, or MRV1 changes.
How was this patch tested?
python -m pytest --noconftest -q tests/ut/worker/test_spec_pp_cpu_counts.py: 132 passed. The test executes the production methods on CPU and covers V4/V4.1 config detection, rejected-token device updates, CPU upper bounds, PP overrides, and existing deferred PP behavior.tests/ut/worker/test_model_runner_v2.pyto cover the V4 family.git diff --checkpassed for all changed files.prepare_dcp_local_seq_lensrequired by current main. Fullbash format.sh ciwas also attempted, but hook dependency initialization stalled in this environment; only the scoped Ruff checks are claimed as passing. Main-branch integration and full hook checks remain for CI.Before porting to main, the V4 exemption was exercised on Ascend hardware with MRV2, DSpark (5 draft tokens), MooncakeHybridConnector, DP4/TP1, 224 client concurrency, and 64K/128K inputs. Four 1,000-request comparison runs and one 3,000-request long run completed without request failures; requested input/output lengths were checked. These runs validate operation, not model accuracy, and do not isolate the throughput gain from this exemption alone.
Implementation and tests were prepared with Codex.