Skip to content

Conversation

@comaniac
Copy link
Collaborator

@comaniac comaniac commented Mar 21, 2025

A prerequisite PR to enable the capability of contituning scheduling prefill chunks in PP.

This PR achieves the following flow:

  1. At .schedule(), we advance num_computed_tokens right after scheduling a batch, so that in the case of chunked prefill, we could continue scheduling the next chunk (not covered in this PR).
  2. In the model runner output, we make sure the sampled tokens of prefill requests are empty.
  3. At .update_from_output(), we do not check whether we should append the sampled tokens to requests using num_computed_tokens and num_tokens, but rely on whether model runner provides sampled tokens. Moreover, we do not advance num_computed_tokens in this function. Instead, we only decrease num_computed_tokens when spec tokens get rejected.

@github-actions
Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

@comaniac comaniac added the ready ONLY add when PR is ready to merge/full CI is needed label Mar 21, 2025
@mergify mergify bot added the v1 label Mar 21, 2025
@comaniac comaniac changed the title [WIP][V1][ModelRunner] Do not output sampled tokens for prefill requests [WIP][V1] Refactor num_computed_tokens logic Mar 21, 2025
@comaniac comaniac changed the title [WIP][V1] Refactor num_computed_tokens logic [V1] Refactor num_computed_tokens logic Mar 21, 2025
Copy link
Collaborator

@WoosukKwon WoosukKwon left a comment

Choose a reason for hiding this comment

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

Thanks for doing this! Left some comments.

@comaniac comaniac force-pushed the num-computed-tokens branch from 0a92097 to 56208c6 Compare March 25, 2025 22:52
comaniac and others added 6 commits March 26, 2025 11:20
Signed-off-by: Cody Yu <[email protected]>
Signed-off-by: Cody Yu <[email protected]>
Signed-off-by: Cody Yu <[email protected]>
Co-authored-by: Woosuk Kwon <[email protected]>
Signed-off-by: Cody Yu <[email protected]>
Signed-off-by: Cody Yu <[email protected]>
Signed-off-by: Cody Yu <[email protected]>
@comaniac comaniac force-pushed the num-computed-tokens branch from 22e14ab to a426db0 Compare March 26, 2025 18:20
Copy link
Collaborator

@WoosukKwon WoosukKwon left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the PR!

@WoosukKwon
Copy link
Collaborator

@comaniac Please check the CI failures. It seems related.

@njhill
Copy link
Member

njhill commented Mar 26, 2025

I will do a quick review now too...

Copy link
Member

@njhill njhill left a comment

Choose a reason for hiding this comment

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

Thanks @comaniac, I left a few comments too

Signed-off-by: Cody Yu <[email protected]>
Signed-off-by: Cody Yu <[email protected]>
Copy link
Member

@njhill njhill left a comment

Choose a reason for hiding this comment

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

Thanks @comaniac yep this looks good to me!

Signed-off-by: Cody Yu <[email protected]>
@comaniac comaniac enabled auto-merge (squash) March 27, 2025 00:18
Copy link
Member

@njhill njhill left a comment

Choose a reason for hiding this comment

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

Thanks @comaniac!

@comaniac comaniac merged commit 54aa619 into vllm-project:main Mar 27, 2025
33 checks passed
Alex4210987 pushed a commit to LeiWang1999/vllm-bitblas that referenced this pull request Apr 5, 2025
Signed-off-by: Cody Yu <[email protected]>
Co-authored-by: Woosuk Kwon <[email protected]>
Signed-off-by: xinyuxiao <[email protected]>
lulmer pushed a commit to lulmer/vllm that referenced this pull request Apr 7, 2025
Signed-off-by: Cody Yu <[email protected]>
Co-authored-by: Woosuk Kwon <[email protected]>
Signed-off-by: Louis Ulmer <[email protected]>
lk-chen pushed a commit to lk-chen/vllm that referenced this pull request Apr 29, 2025
shreyankg pushed a commit to shreyankg/vllm that referenced this pull request May 3, 2025
RichardoMrMu pushed a commit to RichardoMrMu/vllm that referenced this pull request May 12, 2025
Signed-off-by: Cody Yu <[email protected]>
Co-authored-by: Woosuk Kwon <[email protected]>
Signed-off-by: Mu Huai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready ONLY add when PR is ready to merge/full CI is needed v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants