Skip to content

[BugFix] fix VLLM_USE_STANDALONE_COMPILE=0#38015

Merged
zou3519 merged 1 commit intovllm-project:mainfrom
zou3519:fix_no_standalone_compile
Mar 24, 2026
Merged

[BugFix] fix VLLM_USE_STANDALONE_COMPILE=0#38015
zou3519 merged 1 commit intovllm-project:mainfrom
zou3519:fix_no_standalone_compile

Conversation

@zou3519
Copy link
Copy Markdown
Collaborator

@zou3519 zou3519 commented Mar 24, 2026

I broke this in one of the refactors, this fixes it and adds some testing

I broke this in one of the refactors, this fixes it and adds some
testing

Signed-off-by: Richard Zou <zou3519@gmail.com>
@zou3519
Copy link
Copy Markdown
Collaborator Author

zou3519 commented Mar 24, 2026

cc @zhxchen17 @gmagogsfm

@mergify mergify bot added the bug Something isn't working label Mar 24, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new test to validate the correctness of standalone compilation and implements a fix in vllm/compilation/compiler_interface.py to resolve a FakeTensorMode mismatch when compile_fx is used within Dynamo's tracing context. The review feedback highlights that the implemented fix relies on a private PyTorch API, torch._guards._TLS.tracing_context, which could lead to fragility and future breakage. It is recommended to add a comment explaining this dependency and to consider filing an issue with PyTorch to request a public API for this functionality.

Comment on lines +643 to +650
saved_tracing_context = torch._guards.TracingContext.try_get()
if saved_tracing_context is not None:
torch._guards._TLS.tracing_context = None

def _restore_tracing_context():
torch._guards._TLS.tracing_context = saved_tracing_context

stack.callback(_restore_tracing_context)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This fix relies on torch._guards._TLS.tracing_context, which is a private, undocumented PyTorch API. This makes the code fragile and likely to break in future PyTorch versions.

To improve maintainability, please add a comment to this block explaining that this uses a private PyTorch API and could break in the future. It would also be beneficial to file an issue with PyTorch to request a public API for this functionality and link it in the comment.

References
  1. Avoid using private, undocumented APIs from third-party libraries, as they are not part of the public contract and can change or be removed without notice, leading to future breakage.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're going to deprecate and delete this path (USE_STANDALONE_COMPILE=0) so I'm not worried about it

Copy link
Copy Markdown
Contributor

@zhxchen17 zhxchen17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. but is InductorAdapter still actively used by default? I didn't remember hitting this one in most testing

@zou3519
Copy link
Copy Markdown
Collaborator Author

zou3519 commented Mar 24, 2026

StandaloneInductorAdaptor is used by default, InductorAdaptor hasn't been used by default in a while (which is why it has bitrotted). I wanted this to work because I was experimenting with it

@zou3519 zou3519 added the ready ONLY add when PR is ready to merge/full CI is needed label Mar 24, 2026
@zou3519 zou3519 enabled auto-merge (squash) March 24, 2026 16:57
@zou3519 zou3519 merged commit 89f572d into vllm-project:main Mar 24, 2026
61 checks passed
RhizoNymph pushed a commit to RhizoNymph/vllm that referenced this pull request Mar 26, 2026
Signed-off-by: Richard Zou <zou3519@gmail.com>
HenryTangDev pushed a commit to HenryTangMain/vllm that referenced this pull request Mar 27, 2026
Signed-off-by: Richard Zou <zou3519@gmail.com>
malaiwah pushed a commit to malaiwah/vllm that referenced this pull request Mar 27, 2026
Signed-off-by: Richard Zou <zou3519@gmail.com>
Signed-off-by: Michel Belleau <michel.belleau@malaiwah.com>
khairulkabir1661 pushed a commit to khairulkabir1661/vllm that referenced this pull request Mar 27, 2026
Signed-off-by: Richard Zou <zou3519@gmail.com>
Monishver11 pushed a commit to Monishver11/vllm that referenced this pull request Mar 27, 2026
Signed-off-by: Richard Zou <zou3519@gmail.com>
Signed-off-by: Monishver Chandrasekaran <monishverchandrasekaran@gmail.com>
nithinvc pushed a commit to nithinvc/vllm that referenced this pull request Mar 27, 2026
Signed-off-by: Richard Zou <zou3519@gmail.com>

Signed-off-by: Nithin Chalapathi <nithin.ch10@gmail.com>
JiantaoXu pushed a commit to JiantaoXu/vllm that referenced this pull request Mar 28, 2026
Signed-off-by: Richard Zou <zou3519@gmail.com>
vrdn-23 pushed a commit to vrdn-23/vllm that referenced this pull request Mar 30, 2026
Signed-off-by: Richard Zou <zou3519@gmail.com>
Signed-off-by: Vinay Damodaran <vrdn@hey.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants