Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
a6e72e1e
Unverified
Commit
a6e72e1e
authored
Apr 25, 2025
by
James Wu
Committed by
GitHub
Apr 26, 2025
Browse files
[Bugfix] [pytorch] Patch AOTAutogradCache._get_shape_env (#17142)
Signed-off-by:
James Wu
<
jjwu@meta.com
>
parent
5e83a727
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
vllm/compilation/compiler_interface.py
vllm/compilation/compiler_interface.py
+18
-1
No files found.
vllm/compilation/compiler_interface.py
View file @
a6e72e1e
...
...
@@ -195,7 +195,6 @@ class InductorAdaptor(CompilerInterface):
hash_str
,
file_path
=
None
,
None
from
torch._inductor.codecache
import
(
FxGraphCache
,
compiled_fx_graph_hash
)
if
torch
.
__version__
.
startswith
(
"2.5"
):
original_load
=
FxGraphCache
.
load
original_load_name
=
"torch._inductor.codecache.FxGraphCache.load"
...
...
@@ -280,6 +279,16 @@ class InductorAdaptor(CompilerInterface):
patch
(
"torch._inductor.codecache.FxGraphCache._get_shape_env"
,
_get_shape_env
))
from
torch._functorch._aot_autograd.autograd_cache
import
(
AOTAutogradCache
)
# torch 2.8+ on main uses _get_shape_env in AOTAutogradCache
if
hasattr
(
AOTAutogradCache
,
"_get_shape_env"
):
stack
.
enter_context
(
patch
(
"torch._functorch._aot_autograd.autograd_cache.AOTAutogradCache._get_shape_env"
,
_get_shape_env
))
# for forcing the graph to be cached
stack
.
enter_context
(
patch
(
...
...
@@ -325,11 +334,19 @@ class InductorAdaptor(CompilerInterface):
assert
isinstance
(
handle
[
1
],
str
)
hash_str
=
handle
[
0
]
from
torch._functorch._aot_autograd.autograd_cache
import
(
AOTAutogradCache
)
from
torch._inductor.codecache
import
FxGraphCache
with
ExitStack
()
as
exit_stack
:
exit_stack
.
enter_context
(
patch
(
"torch._inductor.codecache.FxGraphCache._get_shape_env"
,
lambda
*
args
,
**
kwargs
:
AlwaysHitShapeEnv
()))
# torch 2.8+ on main uses _get_shape_env in AOTAutogradCache
if
hasattr
(
AOTAutogradCache
,
"_get_shape_env"
):
exit_stack
.
enter_context
(
patch
(
"torch._functorch._aot_autograd.autograd_cache.AOTAutogradCache._get_shape_env"
,
lambda
*
args
,
**
kwargs
:
AlwaysHitShapeEnv
()))
# Dynamo metrics context, see method for more details.
exit_stack
.
enter_context
(
self
.
metrics_context
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment