Skip to content

[Bugfix] Fix uniform_batch for same-sized prefills - #39945

Open
benchislett wants to merge 8 commits into
vllm-project:mainfrom
CentML:bugfix-specdec-uniform-batch
Open

benchislett wants to merge 8 commits into
vllm-project:mainfrom
CentML:bugfix-specdec-uniform-batch

Conversation

@benchislett

Copy link
Copy Markdown
Member

Purpose

FIX #39928

Testing

Added some more tests for the modified code. Can reproduce #39928 but it is resolved with this patch. No additional testing planned.

Signed-off-by: Benjamin Chislett <bchislett@nvidia.com>
Signed-off-by: Benjamin Chislett <bchislett@nvidia.com>
@benchislett
benchislett requested a review from njhill as a code owner April 15, 2026 20:39
@benchislett
benchislett requested a review from mgoin April 15, 2026 20:39

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements a prefill guard within the _is_uniform_decode method to prevent the misclassification of prefill batches as uniform decode batches. While the current implementation checks for zero computed tokens, review feedback highlights that this is insufficient for chunked prefills. It is recommended to instead compare computed tokens against prompt tokens to reliably determine if a request has finished prefilling.

Comment thread vllm/v1/worker/gpu_model_runner.py Outdated
Comment thread vllm/v1/worker/gpu_model_runner.py
@mgoin mgoin added bug Something isn't working ready ONLY add when PR is ready to merge/full CI is needed nvidia labels Apr 15, 2026
@mergify mergify Bot added the v1 label Apr 15, 2026

@MatthewBonanni MatthewBonanni left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gemini's suggestion is reasonable to me. Probably worth adding a chunked prefill edge case to the test too.

Comment thread vllm/v1/worker/gpu_model_runner.py Outdated

@LucasWilkinson LucasWilkinson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know the root cause? This feels a bit like an attention backend problem if it can properly handle this; mostly just curious

We do have backends that treat small chunked prefills as decodes since it more efficient; so Im a bit resistant to global changes like this without better understanding the motivation

It does seem like we may need a better way for attention backends to disable full-CGs (e.g. cascade attention could use this); but there is bit of an ordering problem here since we want to pad for CGs before building attention metadata

@benchislett

Copy link
Copy Markdown
Member Author

The problem is the graph selection: when a prefill has exactly the wrong size, the dispatcher thinks it's a uniform_decode batch and issues a FULL CUDA graph which replays the decode kernel and not the prefill kernel. AFAIK this incongruity is causing it to fail to populate the KV cache for all the prefill slots. Not sure if it's supposed to be able to handle this case just by running the decode kernel. Probably being a hybrid model is also complicating things, could be that the FULL graph isn't handling the mamba state properly or some such

lukealonso pushed a commit to local-inference-lab/vllm that referenced this pull request Jun 12, 2026
Port vllm-project#39945 onto the MiMo Black Benediction branch. The fix keeps same-sized prefill batches from being misclassified by the uniform_batch path, which DFlash relies on during draft proposal.
lukealonso pushed a commit to local-inference-lab/vllm that referenced this pull request Jun 19, 2026
Port vllm-project#39945 onto the MiMo Black Benediction branch. The fix keeps same-sized prefill batches from being misclassified by the uniform_batch path, which DFlash relies on during draft proposal.
@njhill njhill added the mrv1-only Issues/PRs which apply only to Model Runner V1 (not applicable to Model Runner V2) label Aug 28, 2026
Leonccaa added a commit to Leonccaa/1Cat-vLLM that referenced this pull request Aug 31, 2026
Derive unfinished-prefill state from the current scheduler output so both the normal model-runner path and the early PP+SP path reject shape-aliased prefills. Keep the override hybrid-only and preserve CUDA graph capture semantics.

Based-on: vllm-project/vllm#39945
Based-on: vllm-project/vllm#47123
Based-on: vllm-project/vllm#53059
Co-authored-by: Katsumi Takeuchi <contact@recutita.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working mrv1-only Issues/PRs which apply only to Model Runner V1 (not applicable to Model Runner V2) nvidia ready ONLY add when PR is ready to merge/full CI is needed v1

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[Bug]: Qwen3.5 DFlash gives strange responses on SM90

5 participants