Repository navigation
[AOT compilation] support torch.compile inductor artifacts in VllmCompiledFunction - #25205
Conversation
|
This pull request has merge conflicts that must be resolved before it can be |
05baf79 to
96f5d79
Compare
0ce2620 to
38b6517
Compare
|
This pull request has merge conflicts that must be resolved before it can be |
db326a9 to
03fa8b3
Compare
03fa8b3 to
579ec82
Compare
|
This pull request has merge conflicts that must be resolved before it can be |
579ec82 to
869b3fe
Compare
Summary: Fixing issue vllm-project#27348 For dynamo caching, it's possible that the compilation succeeds but the serialization step fails. In this case, the failure of serialization step shouldn't block user from getting compilation results correctly. Therefore we add a handling of the serialization error and only give warning when model saving fails. When saving fails, VLLM model runner should be able to just fallback to the old path, and in the next process, it will fail to load dynamo cache but still fallback to retracing with dynamo + loading inductor cache, which is the same behavior to AOT compile turned of off. This is mostly a short term fix and in the long term we should resolve the serialization bugs by eliminating pickling of graph modules. i.e. Once vllm-project#25205 is merged, we should be able to resolve the issue at a lower level. Test Plan: pytest tests/lora/test_quant_model.py Reviewers: Subscribers: Tasks: Tags: Signed-off-by: zhxchen17 <zhxchen17@fb.com>
869b3fe to
7465ae3
Compare
|
NB: might merge conflict with #31756 |
144942a to
bc9a143
Compare
zou3519
left a comment
There was a problem hiding this comment.
lgtm, let me know if you want to resolve any of the comments before merging
| @@ -163,6 +467,11 @@ def compilation_config_hash_factors(vllm_config: VllmConfig) -> list[str]: | |||
| # model is created) | |||
| config_hash = vllm_config.compute_hash() | |||
| factors.append(config_hash) | |||
|
|
|||
| # 2. inductor factors if applicable | |||
There was a problem hiding this comment.
There is an open problem here in that I think we need #29108 .
I think we're missing the "source code of the files that get traced through" in the hash. Zhengxu's work was going to make it so that vLLM includes "all python files" in the hash so we don't need to distinguish between which files get traced through.
basically, this stuff:
vllm/vllm/compilation/backends.py
Lines 588 to 627 in 130d6c9
We can figure this out as a follow-up (also I'm not sure if you're going to continue working on this or if @zhxchen17 is going to pick up from here)
bc9a143 to
da64538
Compare
ProExpertProg
left a comment
There was a problem hiding this comment.
I won't pretend I understand everything but looks overall good to me!
| @@ -21,15 +21,17 @@ | |||
| "vllm/transformers_utils/config.py", | |||
| "vllm/model_executor/models/registry.py", | |||
| "vllm/compilation/caching.py", | |||
| "vllm/compilation/piecewise_backend.py", | |||
There was a problem hiding this comment.
We should really think about the threat model here, cc @russellb
da64538 to
690fb8e
Compare
Signed-off-by: dolpm <34420038+dolpm@users.noreply.github.com>
Adds support for inductor artifacts in VllmCompiledFunction
Purpose
we want to ensure that all pre-compiled artifacts (e.g., dynamo+inductor) live under one roof (i.e., VllmSerializableFunction).
the general implementation is as follows.
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.Note
Enables direct reuse of Inductor-compiled artifacts without re-splitting or recompiling, improving cold-start behavior and preserving output semantics.
VllmSerializableFunction.InductorCompiledArtifacts(deduped, pickleable, bulk-load) and embeds bytes plussym_shape_indices/returns_tuplein serialized stateVllmBackendWithCacheto rebuildsplit_gmfrom cached artifacts and sharedwrap_with_cudagraph_if_needed; validates cache completenessPiecewiseBackendwith general-shape precompile for serialization,to_bytes(), preload from cache, and correct tuple vs tensor outputs; shared cudagraph wrapper and input copy helperVllmBackendto detect pre-split graphs, collect artifacts for serialization, exposeon_compilation_complete, and pass sym-tensor indices for cudagraph copycompiler_interfacesupportsstandalone_compile(aot=True)with fallback; includes inductor factors; adjusts functorch configsupport_torch_compile: defer AOT save until post-warmup, addsave_compile_cache, mark cache hits (aot_compile_loaded_from_cache)VLLM_USE_BACKEND_WITH_INDUCTOR_COMPILED_ARTIFACTS, updates worker warmup to avoid CG padding, and extends pickle allowlistWritten by Cursor Bugbot for commit 3a4766931a62422c2c30e70b182f9f9dad1e99e7. This will update automatically on new commits. Configure here.