Skip to content

Conversation

DarkLight1337
Copy link
Member

@DarkLight1337 DarkLight1337 commented Aug 4, 2025

Essential Elements of an Effective PR Description Checklist

  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

Purpose

As discussed with @ywang96, there is actually no need to keep a mirrored cache between P0 and P1. All P0 needs is a key store that mirrors the key store of P1 (i.e. P0 doesn't have to store the values).

This PR separates processor cache (which is used to avoid calling HF processor) from IPC cache (which is used to avoid IPC transfer of multi-modal data from P0 to P1), and adjust the memory usage of each cache (or disable them) separately. This additional flexibility means that only the IPC cache needs to be disabled when DP/API server scale-out and the proposed #21740 are used.

This is part of the process of moving the processor cache from P0 to P1. As summarized by @ywang96:

  • We have 3 "caches", the two P0 caches (PreprocessorCache, InputCacheClient) tracking the same object, and the P1 mirrored cache (InputCacheServer), so overall 2X memory
  • We realized InputCacheClient actually doesn't need to store object, so this PR separates PreprocessorCache and InputCacheClient, and make InputCacheClient to not track the object
  • Eventually we only want one cache in P0 to be a key-only cache, and P1 to be an actual cache with the processed inputs, and the two caches should sync on keys, which are mm_hash/identiifer of individual mm data item

I have removed references to IPC cache from this PR to avoid confusion during this intermediate stage.

cc @WoosukKwon please review this as well!

User-facing changes

- Introduced a new argument mm_ipc_cache_gb to control the size of the IPC cache.
- VLLM_MM_INPUT_CACHE_GIB now only controls the processor cache. In a future PR, this will be changed to a config argument called mm_processing_cache_gb, and disable_mm_preprocessing_cache will become deprecated (since it is redundant with mm_processing_cache_gb = 0).

Test Plan

Test Result

(Optional) Documentation Update

  • Updated memory and optimization docs.
  • Indicate that the total memory usage of processor cache is multiplied by the number of processes.
  • Removed redundant Reducing Memory Usage section from Optimization page because it's covered by the Conserving Memory page already.

Copy link

github-actions bot commented Aug 4, 2025

👋 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.

🚀

@DarkLight1337 DarkLight1337 moved this to In Progress in Multi-modality Core Aug 4, 2025
@mergify mergify bot added documentation Improvements or additions to documentation frontend multi-modality Related to multi-modality (#4194) v1 labels Aug 4, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 effectively separates the multi-modal processor cache from the IPC cache, which is a great architectural improvement for clarity and functionality. The changes across the documentation, configuration, and core engine logic are consistent with this goal. However, I've identified a critical issue in kv_cache_utils.py that could lead to a crash under certain configurations. Please see my detailed comment below.

Signed-off-by: DarkLight1337 <[email protected]>
Signed-off-by: DarkLight1337 <[email protected]>
@DarkLight1337 DarkLight1337 changed the title [Core] Store only the keys for multi-modal data in V0 [Core] Store only the keys for multi-modal data in P0 Aug 7, 2025

### Adjust CUDA Graph Compilation
!!! note
API server scale-out is only available for online inference.
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm. What's preventing offline inference from using this?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's just how API server scale-out is set up now. Perhaps @njhill can help answer this

)
```
!!! note
[Multi-modal processor cache](#processor-cache) is disabled when API server scale-out is enabled
Copy link
Contributor

Choose a reason for hiding this comment

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

Link the data_parallel_external_lb doc here as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's not needed because the link is already at the beginning of this section


### Multimodal Models
You can adjust the size of the cache via `VLLM_MM_INPUT_CACHE_GIB` environment variable
(default 4 GiB per API process + 4 GiB per engine core process).
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto

# Cache size (in GiB) for multimodal input cache
# Default is 4 GiB
# Cache size (in GiB per process) for multimodal input cache
# Default is 4 GiB per API process + 4 GiB per engine core process
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto.

Copy link
Member

@ywang96 ywang96 left a comment

Choose a reason for hiding this comment

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

Left two comments - otherwise LGTM!

Signed-off-by: DarkLight1337 <[email protected]>
@vllm-bot vllm-bot merged commit 766bc81 into vllm-project:main Aug 7, 2025
5 of 9 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Multi-modality Core Aug 7, 2025
@DarkLight1337 DarkLight1337 deleted the mm-ipc-cache branch August 7, 2025 08:45
jinzhen-lin pushed a commit to jinzhen-lin/vllm that referenced this pull request Aug 9, 2025
noamgat pushed a commit to noamgat/vllm that referenced this pull request Aug 9, 2025
paulpak58 pushed a commit to paulpak58/vllm that referenced this pull request Aug 13, 2025
diegocastanibm pushed a commit to diegocastanibm/vllm that referenced this pull request Aug 15, 2025
epwalsh pushed a commit to epwalsh/vllm that referenced this pull request Aug 28, 2025
xiao-llm pushed a commit to xiao-llm/vllm that referenced this pull request Aug 28, 2025
zhewenl pushed a commit to zhewenl/vllm that referenced this pull request Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation frontend multi-modality Related to multi-modality (#4194) ready ONLY add when PR is ready to merge/full CI is needed v1
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants