-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[torch.compile] PyTorch 2.6 and nightly compatibility #12393
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
👋 Hi! Thank you for contributing to the vLLM project. Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can do one of these:
🚀 |
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
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.
Do we need bump up the torch version in the dep config?
You can test it following "Use an existing PyTorch installation" in https://docs.vllm.ai/en/latest/getting_started/installation/gpu/index.html . |
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.
Internally, we still hit similar issues before this PR. I will dig a bit and see what's going on.
@@ -53,6 +64,9 @@ def add(self, pass_: InductorPass): | |||
assert isinstance(pass_, InductorPass) | |||
self.passes.append(pass_) | |||
|
|||
def uuid(self): | |||
return self.__getstate__() | |||
|
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.
Actually, it failed on the unpickling of this class...
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.
is it still relevant? do we need any change for this function?
Btw, @chenyang78 is one of our Inductor expert. If @zou3519 or @zhxchen17 can give a pass, that will be great! |
An interesting point is that, to use PT 2.6, we previously had a compatibility issue with |
Signed-off-by: youkaichao <[email protected]>
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.
I'm reading through the PR now, but a bit of context would make it easier to follow. Could you say a bit about why the backend and cache changes were needed to support PyTorch >= 2.6?
because pytorch's internal function changed. |
if torch.__version__.startswith("2.5"): | ||
original_load = FxGraphCache.load | ||
original_load_name = "torch._inductor.codecache.FxGraphCache.load" | ||
|
||
def hijack_load(*args, **kwargs): | ||
inductor_compiled_graph = original_load(*args, **kwargs) | ||
nonlocal file_path | ||
file_path = inductor_compiled_graph.current_callable.__code__.co_filename # noqa | ||
return inductor_compiled_graph | ||
|
||
hijacked_compile_fx_inner = torch._inductor.compile_fx.compile_fx_inner # noqa | ||
elif torch.__version__ >= "2.6": | ||
# function renamed in 2.6 | ||
original_load_name = None | ||
|
||
def hijacked_compile_fx_inner(*args, **kwargs): | ||
output = torch._inductor.compile_fx.compile_fx_inner( | ||
*args, **kwargs) | ||
nonlocal hash_str | ||
inductor_compiled_graph = output | ||
if inductor_compiled_graph is not None: | ||
nonlocal file_path | ||
file_path = inductor_compiled_graph.current_callable.__code__.co_filename # noqa | ||
hash_str = inductor_compiled_graph._fx_graph_cache_key | ||
return output |
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.
e.g. here, @tlrmchlsmth
Manually tested for
2.7.0.dev20250121+cu126