[Misc][BE] Type coverage for vllm/compilation [2/3]#31744
[Misc][BE] Type coverage for vllm/compilation [2/3]#31744mgoin merged 4 commits intovllm-project:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request continues the effort to improve type hint coverage in the vllm/compilation module. The changes are extensive and add type annotations to numerous functions, methods, and variables across multiple files. The added types are accurate and enhance code readability and maintainability. Several minor fixes are included, such as correcting return types and handling nullable arguments, which further improve the robustness of the code. The use of type: ignore is judicious and applied in contexts where type checkers might struggle with dynamic aspects of the code. Overall, this is a high-quality contribution that successfully improves type coverage.
Signed-off-by: Lucas Kabela <lucaskabela@meta.com>
daa6bb4 to
42dc81c
Compare
Signed-off-by: Lucas Kabela <lucaskabela@meta.com>
Head branch was pushed to by a user without write access
Signed-off-by: dsuhinin <suhinin.dmitriy@gmail.com>
| # Re-export CustomGraphPass for external usage | ||
| __all__ = ["CustomGraphPass"] | ||
|
|
| # Explicitly exports Range | ||
| __all__ = ["Range"] | ||
|
|
Purpose
We want to provide better type hint coverage in vllm/compilation to improve maintainability, readability, and reduce silent errors
This PR should be applied on top of #31554
Test Plan
mypy vllm/compilation
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.Note
Improves type safety and readability across compilation code with precise annotations and minor behavior clarifications.
Callable/Anywith concrete signatures (Callable[..., Any],Generator,ParamSpec,TypeVar,Literal) and adds return types throughout (backends,caching,cuda_graph,decorators,fix_functionalization,inductor_pass,noop_elimination,pass_manager,piecewise_backend,wrapper).piecewise_backend: validatescompile_sizes(disallows"cudagraph_capture_sizes"here), supportsNone, returnsRangeEntryfrom range lookup, and uses fakified inputs only for non-singleton ranges.decorators/wrapper: typed contexts and calls; preserve behavior while adding guard-related annotations and AOT/partition-wrapper hooks; minor mypy ignores where needed.pass_manager/inductor_pass: exposeCustomGraphPassvia__all__, typed manager methods, and include compile range in UUID state deterministically.caching: fully typedVllmSerializableFunction, safer graph pickling reducer, and typedco_name.cuda_graph: typed logging wrapper, wrapper methods, and callback signatures.config/compilation: exportRangevia__all__.Written by Cursor Bugbot for commit 58f1249. This will update automatically on new commits. Configure here.
Note
Cursor Bugbot is generating a summary for commit 78d91f2. Configure here.
Note
Improves type safety and clarity across the compilation stack with precise annotations and a few safe behavioral refinements.
backends,caching,cuda_graph,decorators,fix_functionalization,inductor_pass,noop_elimination,pass_manager,piecewise_backend, andwrapper(with minimal mypy ignores)piecewise_backend: validatescompile_sizes(disallows"cudagraph_capture_sizes"here), supportsNone, returnsRangeEntryfrom range lookup, and only fakifies inputs for non-singleton rangesCustomGraphPass, include compile range inPostGradPassManager.uuid, exportRangeviaconfig/compilationco_name, typed CUDA graph wrapper callbacks, typed context managers and guard-handling indecorators/wrapperWritten by Cursor Bugbot for commit 78d91f2. This will update automatically on new commits. Configure here.