-
Notifications
You must be signed in to change notification settings - Fork 69
[vllm-ext] allows setting flashinfer workspace #1259
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?
Conversation
Signed-off-by: yiliu30 <yi4.liu@intel.com>
for more information, see https://pre-commit.ci
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.
Pull request overview
This PR adds support for configuring the FlashInfer workspace buffer size through an environment variable. It introduces a new environment variable VLLM_AR_FLASHINFER_WORKSPACE_BUFFER_SIZE that allows users to override the default workspace buffer size.
Changes:
- Added new environment variable
VLLM_AR_FLASHINFER_WORKSPACE_BUFFER_SIZEto control FlashInfer workspace buffer size - Implemented automatic update of FlashInfer's workspace buffer size on module initialization when the environment variable is set
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| auto_round_extension/vllm_ext/envs_ext.py | Registers the new VLLM_AR_FLASHINFER_WORKSPACE_BUFFER_SIZE environment variable with default value of 0 |
| auto_round_extension/vllm_ext/vllm_oot_patches.py | Implements the workspace buffer size update logic and applies it during module initialization if the environment variable is set |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import vllm.v1.attention.backends.flashinfer as flashinfer_backend | ||
|
|
||
| flashinfer_backend.WORKSPACE_BUFFER_SIZE = new_size |
Copilot
AI
Jan 12, 2026
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.
This code executes at module import time and may fail if the flashinfer backend module is not available or hasn't been initialized. Consider wrapping this in a try-except block to handle ImportError gracefully, or defer the update until runtime when the backend is actually needed.
| import vllm.v1.attention.backends.flashinfer as flashinfer_backend | |
| flashinfer_backend.WORKSPACE_BUFFER_SIZE = new_size | |
| try: | |
| import vllm.v1.attention.backends.flashinfer as flashinfer_backend | |
| except ImportError: | |
| logger.warning( | |
| "FlashInfer backend is not available; " | |
| "skipping update of WORKSPACE_BUFFER_SIZE to %s", | |
| new_size, | |
| ) | |
| return | |
| except Exception: | |
| # Catch any unexpected errors during backend import or initialization | |
| logger.exception( | |
| "Failed to import FlashInfer backend while trying to update " | |
| "WORKSPACE_BUFFER_SIZE to %s", | |
| new_size, | |
| ) | |
| return | |
| flashinfer_backend.WORKSPACE_BUFFER_SIZE = new_size | |
| logger.info("Updated FlashInfer WORKSPACE_BUFFER_SIZE to %s", new_size) |
|
|
||
|
|
||
| def update_flashinfer_workspace_buffer_size(new_size: int): | ||
| import vllm.v1.attention.backends.flashinfer as flashinfer_backend |
Copilot
AI
Jan 12, 2026
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.
If the flashinfer backend module cannot be imported or WORKSPACE_BUFFER_SIZE doesn't exist, this will raise an unclear error. Add error handling with a descriptive message explaining that FlashInfer backend is required for this feature.
| import vllm.v1.attention.backends.flashinfer as flashinfer_backend | |
| try: | |
| import vllm.v1.attention.backends.flashinfer as flashinfer_backend | |
| except ImportError as e: | |
| raise RuntimeError( | |
| "FlashInfer backend is required to set WORKSPACE_BUFFER_SIZE, but it " | |
| "could not be imported. Make sure vLLM is installed and built with " | |
| "FlashInfer support before setting VLLM_AR_FLASHINFER_WORKSPACE_BUFFER_SIZE." | |
| ) from e | |
| if not hasattr(flashinfer_backend, "WORKSPACE_BUFFER_SIZE"): | |
| raise RuntimeError( | |
| "FlashInfer backend does not define WORKSPACE_BUFFER_SIZE. This feature " | |
| "requires a FlashInfer-enabled version of vLLM that exposes this setting." | |
| ) |
Signed-off-by: yiliu30 yi4.liu@intel.com