Repository navigation
Conversation
|
👋 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. Tip 💡 Consider Linking a Related Issue or RFCYour PR title contains the [Feature] tag, indicating a bug fix or new feature. Linking a related issue or RFC in the PR description is strongly encouraged — it gives reviewers helpful context and speeds up the review. You can use any of these keywords:
🙏 Thanks for helping us keep the project well-organized! |
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 introduces 'Decoder Append-Prefill' to optimize agentic workloads by reusing KV-cache resident on Decoder instances. By routing subsequent session turns to the same Decoder, the system reduces redundant prefill work. The changes include a new proxy server for session-affine routing, enhanced scheduler admission logic to handle cache misses gracefully, and platform-level configuration validation to ensure feature compatibility. 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
|
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
9371a29 to
5a1ce90
Compare
7ef4e25 to
91db3ed
Compare
91db3ed to
3943e7b
Compare
3eebae8 to
1d848d2
Compare
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
3 similar comments
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
e63fa91 to
669067d
Compare
…ading Add decoder_append_prefill_proxy_server.py to route subsequent requests from the same session to its owner Decoder instance and owner DP rank. Check local KV-cache hits in the Scheduler before running append-prefill. If the cached prefix has been released or evicted and no usable local prefix remains, reject the Decoder-local attempt so the proxy falls back to the Prefiller for prefill. Otherwise, reuse the cached prefix and perform append-prefill on the Decoder. This offloads follow-up prefill work from the Prefiller to the Decoder for agentic multi-turn workloads while the session KV cache is reusable. Co-authored-by: zhaoshipu <zhaoshipu@huawei.com> Co-authored-by: wangpengcheng25 <wangpengcheng25@huawei.com> Signed-off-by: yudongrui <yudongrui@huawei.com>
669067d to
d72370c
Compare
What this PR does / why we need it?
Agentic workloads often have long inputs—tens of thousands of tokens from user and system prompts—but short outputs, such as tool-call instructions of around a hundred tokens. In P/D-disaggregated serving, this imbalance concentrates pressure on Prefiller instances. Even when multiple Prefillers serve one Decoder (nP1D), a fixed P/D ratio cannot dynamically adjust prefill capacity to fluctuating request rates, leaving Prefillers vulnerable to sharp load increases and queueing during request bursts.
Successive turns in an agentic session often extend the same conversation history, so the Decoder that served an earlier turn may still hold a reusable prefix in its KV cache. This creates an opportunity to attempt prefill for a follow-up request on that Decoder, reusing the cached prefix and computing the uncached suffix to reduce Prefiller load. This PR introduces Decoder Append-Prefill to support this approach, with a fallback to the Prefiller when no usable local prefix remains.
decoder_append_prefill_proxy_server.pyto route subsequent requests from the same session to its owner Decoder instance and owner DP rank.scheduler_config.decoder_append_prefill_enablein each Decoder's--additional-config. The platform automatically selects the synchronous/asynchronous class and its combined Recompute variant when configured. The feature defaults to disabled, preserving existing native/custom Scheduler handling. Starting the proxy does not configure remote backends.MultiConnector.sub_connectorsinterface.The design and benchmark benefits for the target deployment were discussed and recognized in the weekly community meeting recorded in #10928 (2026.10.23).
Does this PR introduce any user-facing change?
Yes. The standalone proxy adds opt-in
--enable-decoder-append-prefillrouting. To use Decoder Append-Prefill, clients must send the same session ID across turns, using either theX-Session-IDheader or a nonemptyconversation_idstring in the JSON body. The header takes precedence when both are provided. Requests without a session ID use normal P/D routing and do not attempt Decoder-local append-prefill. Clients must still send the complete conversation history with every request.Deployment configuration must guarantee that every Decoder uses
kv_consumer, prefix caching andscheduler_config.decoder_append_prefill_enable=truein--additional-config. The platform selects the matching synchronous/asynchronous Scheduler and, whenrecompute_scheduler_enable=trueis also set, the combined Recompute class; no--scheduler-clsis required. This includes newly added or restarted Decoders. The proxy trusts that deployment configuration and performs no capability probing; this PR adds no capability endpoint or API-router patch. Per-request KV residency is still checked by the Scheduler, and an admission cache miss still falls back through P/D.Request examples
The following examples show a follow-up turn after an initial request has completed with the same session ID,
conversation-001. Enable the proxy and Decoder options above, replace the example proxy address and model name, and supply the original system prompt, full user input and actual assistant reply from the preceding turn.curl with the session ID in the HTTP header
JSON body with the session ID in
conversation_idAlternatively, put the same session ID in the JSON body. Save the following as
request.json; theX-Session-IDheader can be omitted.{ "model": "your-model", "conversation_id": "conversation-001", "messages": [ {"role": "system", "content": "<original system prompt>"}, {"role": "user", "content": "Analyze this report: <full report>"}, {"role": "assistant", "content": "<actual reply from the preceding turn>"}, {"role": "user", "content": "Suggest three improvements."} ] }Send this JSON as the HTTP request body:
curl -sS http://127.0.0.1:9000/v1/chat/completions \ -H 'Content-Type: application/json' \ --data-binary @request.jsonThe first turn uses normal P/D. Later turns with the same session ID attempt Decoder-local append-prefill and fall back through P/D if no usable local KV prefix remains.
How was this patch tested?
Decoder Append-Prefill supports both Model Runner V1 (MRV1) and Model Runner V2 (MRV2). The performance comparison below reports MRV2 results.
Qwen3 performance with MRV2
544f182d9f0c9bfe8bd7645525951d5e3692a542and vLLM-Ascend1d848d299e8765b980085fe4346c6a7a19fb542f.Gains use unrounded values. Higher throughput and lower elapsed time, latency or queue length count as positive gains. Output throughput is the total number of output tokens divided by the total completion time, including output from the single answer-scoring failure in each arm. Request throughput counts protocol-valid completions over that interval. Total completion time runs from the workload start until the last request completes, including think time and the completion tail, with model loading excluded. TTFT starts at turn eligibility and includes client and queueing time.
The MRV2 run exercised 113 real local append operations and 67 verified zero-output misses followed by one P/D fallback each. Both DP ranks were covered by warm-hit and intentional-miss preflight probes. Local-hit records were joined to native Scheduler admission and checked against same-backend P/D READ logs.
The feature reduced Prefiller queueing and improved throughput and TTFT in this workload, while TPOT increased. Additional prefill work extends the duration of mixed prefill/decode steps on the Decoder, increasing TPOT, and we are designing an approach to reduce this impact.
Compatibility with PreemptOffload
PreemptOffload is supported with Decoder Append-Prefill in the tested MRV2 configuration.
Decoder Append-Prefill targets P-heavy workloads, shifting follow-up prefill work to a Decoder with available capacity. PreemptOffload targets D-heavy workloads, saving and restoring active-request KV when Decoder memory pressure causes preemption. In their intended operating regimes, the two features typically do not trigger together.
We adapted the combined Scheduler and validated the overlap with the following setup.
With both features enabled, 72/72 formal requests passed protocol and answer validation. Native traces confirmed one complete formal same-request chain from local append through preemption, device-to-host KV save, CPU state ready, host-to-device restore and continued generation to 512 output tokens. This verified functional compatibility when the two features were deliberately triggered together.