Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] Support reset_prefix_cache #12284

Merged
merged 7 commits into from
Jan 22, 2025

Conversation

comaniac
Copy link
Collaborator

@comaniac comaniac commented Jan 21, 2025

This PR adds the capability of resetting prefix cache for both v0 and v1. This feature could be useful for the following cases:

  1. In RLHF after weight syncing.
  2. In benchmarking.

The prefix cache can only be reset when all blocks are free. However, although this PR also provide /reset_prefix_cache in API server, we currently always return 200 whether the prefix cache is reset successfully or not. This is mainly because it's not trivial for engine client and server to communicate such information (no fundamental burden but just need some work).

cc @youkaichao @robertgshaw2-redhat

Copy link

👋 Hi! Thank you for contributing to the vLLM project.
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 do one of these:

  • Add ready label to the PR
  • Enable auto-merge.

🚀

@mergify mergify bot added the frontend label Jan 21, 2025
@comaniac comaniac removed the frontend label Jan 21, 2025
Signed-off-by: Cody Yu <[email protected]>
Signed-off-by: Cody Yu <[email protected]>
Signed-off-by: Cody Yu <[email protected]>
@mergify mergify bot added the frontend label Jan 21, 2025
Signed-off-by: Cody Yu <[email protected]>
@@ -519,6 +519,17 @@ async def create_score_v1(request: ScoreRequest, raw_request: Request):
}


@router.post("/reset_prefix_cache")
Copy link
Member

Choose a reason for hiding this comment

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

it's better to have a flag so that this endpoint is opt-in, users should not send this request.

we can add an env var VLLM_DEV_MODE, and only expose this endpoint when VLLM_DEV_MODE is set.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah we can just add an argument when launching an endpoint to allow this route. I supposed most production API server doesn't want to this be enabled.

Copy link
Member

@youkaichao youkaichao 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 the great work! I didn't imagine this is so involved (it touches quite a lot files). I think we should do something to refactor the way we create a new endpoint, cc @robertgshaw2-redhat

@comaniac comaniac added the ready ONLY add when PR is ready to merge/full CI is needed label Jan 22, 2025
@comaniac comaniac enabled auto-merge (squash) January 22, 2025 16:48
@comaniac comaniac merged commit 7206ce4 into vllm-project:main Jan 22, 2025
64 checks passed
abmfy pushed a commit to abmfy/vllm-flashinfer that referenced this pull request Jan 24, 2025
abmfy pushed a commit to abmfy/vllm-flashinfer that referenced this pull request Jan 24, 2025
tjtanaa pushed a commit to EmbeddedLLM/vllm that referenced this pull request Jan 27, 2025
tjtanaa pushed a commit to EmbeddedLLM/vllm that referenced this pull request Jan 27, 2025
tjtanaa pushed a commit to EmbeddedLLM/vllm that referenced this pull request Jan 28, 2025
rasmith pushed a commit to rasmith/vllm that referenced this pull request Jan 30, 2025
Isotr0py pushed a commit to Isotr0py/vllm that referenced this pull request Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend ready ONLY add when PR is ready to merge/full CI is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants