Skip to content

[V1] Add API docs for EncoderCacheManager #19294

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

Merged

Conversation

russellb
Copy link
Member

@russellb russellb commented Jun 6, 2025

I was reading the code for the encoder cache to make sure I understood
it. Adding API docs while I was at it helped me make sure I went through
all of it. No real code changes are included here.

Signed-off-by: Russell Bryant rbryant@redhat.com

Copy link

github-actions bot commented Jun 6, 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.

🚀

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.

Hello @russellb, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

Hello! gemini-code-assist here to provide a summary of this pull request. This PR, authored by @russellb, focuses on improving the documentation within the vllm project. Specifically, it adds comprehensive API documentation to the EncoderCacheManager class and its methods. The author noted that this process helped them better understand the code, and confirms that no functional code changes were made in this PR.

Highlights

  • Documentation: The primary focus of this PR is the addition of detailed API documentation (docstrings) to the EncoderCacheManager class and its associated methods.
  • EncoderCacheManager: The documentation clarifies the purpose of the EncoderCacheManager as handling the caching of multimodal encoder outputs (like image embeddings) for individual requests, explaining its role in memory management and avoiding recomputation.
  • No Functional Changes: As stated in the PR description, this PR contains no actual code changes, only documentation additions.

Changelog

  • vllm/v1/core/encoder_cache_manager.py
    • Added a detailed class-level docstring explaining the purpose, usage, arguments, and attributes of the EncoderCacheManager.
    • Added docstrings to the has_cache method, explaining its function, arguments, and return value.
    • Added docstrings to the can_allocate method, explaining its function, arguments, and return value.
    • Added docstrings to the allocate method, explaining its function, arguments, and noting its prerequisite.
    • Added docstrings to the get_cached_input_ids method, explaining its function, arguments, and return value.
    • Added docstrings to the free_encoder_input method, explaining its function, arguments, and when it is called.
    • Added docstrings to the free method, explaining its function, arguments, and when it is typically called.
    • Added docstrings to the get_freed_ids method, explaining its function, return value, and side effect (clearing the internal list).
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@mergify mergify bot added the v1 label Jun 6, 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 adds comprehensive API documentation to the EncoderCacheManager class. The added docstrings are clear, well-structured, and significantly enhance the understandability of the code. Great job on being thorough and improving the codebase's maintainability!

Summary of Findings

  • Minor Formatting: Trailing Whitespace: There is a trailing whitespace character in the class docstring on line 37. This is a very minor issue and does not affect functionality. I have not created a specific review comment for this as per the review settings for low-severity issues.

Merge Readiness

The changes consist purely of adding API documentation, which has been done very well. There are no critical or high-severity issues. The pull request appears to be in excellent shape and ready for merging. As an AI, I am not authorized to approve pull requests, so please ensure it is reviewed and approved by a human maintainer.

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.

This is neat! Thank you for adding the documentation! @russellb

@ywang96 ywang96 added the ready ONLY add when PR is ready to merge/full CI is needed label Jun 6, 2025
I was reading the code for the encoder cache to make sure I understood
it. Adding API docs while I was at it helped me make sure I went through
all of it. No real code changes are included here.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
@russellb russellb force-pushed the api-docs-encoder-cache-manager branch from 9e198c2 to 50b7378 Compare June 14, 2025 16:46
@DarkLight1337 DarkLight1337 merged commit 5f52a84 into vllm-project:main Jun 18, 2025
66 checks passed
yeqcharlotte pushed a commit to yeqcharlotte/vllm that referenced this pull request Jun 22, 2025
Signed-off-by: Russell Bryant <rbryant@redhat.com>
minpeter pushed a commit to minpeter/vllm that referenced this pull request Jun 24, 2025
Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: minpeter <kali2005611@gmail.com>
yangw-dev pushed a commit to yangw-dev/vllm that referenced this pull request Jun 24, 2025
Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Yang Wang <elainewy@meta.com>
gmarinho2 pushed a commit to gmarinho2/vllm that referenced this pull request Jun 26, 2025
Signed-off-by: Russell Bryant <rbryant@redhat.com>
xjpang pushed a commit to xjpang/vllm that referenced this pull request Jun 30, 2025
Signed-off-by: Russell Bryant <rbryant@redhat.com>
wseaton pushed a commit to wseaton/vllm that referenced this pull request Jun 30, 2025
Signed-off-by: Russell Bryant <rbryant@redhat.com>
avigny pushed a commit to avigny/vllm that referenced this pull request Jul 31, 2025
Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: avigny <47987522+avigny@users.noreply.github.com>
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