-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[Metrics] Log multi-modal cache stats #26285
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
base: main
Are you sure you want to change the base?
[Metrics] Log multi-modal cache stats #26285
Conversation
Signed-off-by: DarkLight1337 <[email protected]>
There was a problem hiding this comment.
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 introduces metrics for the multi-modal cache, including query and hit counts. The implementation involves a nice refactoring of the existing prefix caching metrics into a more generic CachingMetrics
class, which is then used for both prefix and multi-modal cache statistics. The changes are well-structured and the tests have been updated to cover both text and multimodal models. I found one issue in the test suite where an assertion relies on a coincidence in test data, which I've commented on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
vllm/vllm/v1/core/kv_cache_manager.py
Lines 188 to 194 in db606d9
if self.log_stats: | |
assert self.prefix_cache_stats is not None | |
if request.num_preemptions > 0: | |
# Previously preempted request | |
self.prefix_cache_stats.preempted_requests += 1 | |
self.prefix_cache_stats.preempted_queries += request.num_tokens | |
self.prefix_cache_stats.preempted_hits += num_new_computed_tokens |
The refactor in PrefixCacheStats
removes the preempted_requests
, preempted_queries
, and preempted_hits
attributes, but KVCacheManager.get_computed_blocks
still increments those fields when a request is preempted. Any preempted request with stats logging enabled will now raise AttributeError: 'PrefixCacheStats' object has no attribute 'preempted_requests'
before the scheduler returns, breaking request handling whenever preemption occurs. Either keep these attributes on the stats object or stop writing to them.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Signed-off-by: DarkLight1337 <[email protected]>
Signed-off-by: DarkLight1337 <[email protected]>
Signed-off-by: DarkLight1337 <[email protected]>
Signed-off-by: DarkLight1337 <[email protected]>
Signed-off-by: DarkLight1337 <[email protected]>
/gemini review |
There was a problem hiding this comment.
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 introduces metrics for multi-modal cache statistics and refactors the testing framework to support both text and multi-modal models, removing obsolete v0 engine logic. The changes are well-structured, particularly the generalization of caching metrics. However, I've identified a critical issue in one of the metric tests where an expected value is calculated incorrectly, which could lead to false positives in testing.
Signed-off-by: DarkLight1337 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
I'm unable to get |
Also cc @njhill |
Signed-off-by: DarkLight1337 <[email protected]>
Purpose
This is a redo of #16478 . It is much simplified from the original PR as we have recently consolidated the code related to multi-modal cache. Also, we now only log the stats of the cache from P0, which addresses the concern about IPC overhead.
I have also removed all of the dead V0 logic from the metrics tests.
cc @markmc
Test Plan
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.md
andexamples
for a new model.