feat: configure cudagraph capture batch sizes#4573
Open
CUHKSZzxy wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an explicit configuration path for CUDA graph capture batch sizes in the PyTorch engine, threading the configured sizes from PytorchEngineConfig through CacheConfig into graph runners.
Changes:
- Add
cudagraph_capture_batch_sizestoPytorchEngineConfigandCacheConfig, and plumb it through config building and spec-decode config cloning. - Update graph runners to prefer the configured capture sizes over the inferred (power-of-two) defaults.
- Expose the new option via the
lmdeploy serve api_serverCLI.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| lmdeploy/pytorch/engine/config_builder.py | Validates/normalizes configured capture sizes and passes them into CacheConfig. |
| lmdeploy/pytorch/config.py | Adds cudagraph_capture_batch_sizes to CacheConfig and propagates it in SpecDecodeConfig.from_config. |
| lmdeploy/pytorch/backends/graph_runner.py | Uses configured capture sizes when present. |
| lmdeploy/pytorch/backends/cuda/graph_runner.py | Uses configured capture sizes when present (CUDA backend). |
| lmdeploy/messages.py | Adds cudagraph_capture_batch_sizes to PytorchEngineConfig and documents it. |
| lmdeploy/cli/utils.py | Adds --cudagraph-capture-batch-sizes argument. |
| lmdeploy/cli/serve.py | Wires the CLI argument into PytorchEngineConfig for the API server. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
774b5d9 to
93496c5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation
Assistance
Assisted with Codex + GPT-5.5 High