Skip to content

[Bugfix] tpu_model_runner: set vllm config context when calling reset_dynamo_cache()#30331

Merged
vllm-bot merged 1 commit intovllm-project:mainfrom
dtrifiro:fix-tpu-worker
Dec 10, 2025
Merged

[Bugfix] tpu_model_runner: set vllm config context when calling reset_dynamo_cache()#30331
vllm-bot merged 1 commit intovllm-project:mainfrom
dtrifiro:fix-tpu-worker

Conversation

@dtrifiro
Copy link
Copy Markdown
Contributor

@dtrifiro dtrifiro commented Dec 9, 2025

The switch to TorchCompileWithNoGuardsWrapper.__init__(compiled_model) in #25110 causes a startup crash
due to an attempt to access VllmConfig too early.

See https://github.com/vllm-project/vllm/pull/25110/files#r2593461144

@dtrifiro dtrifiro requested a review from NickLucche as a code owner December 9, 2025 11:08
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.

@dtrifiro dtrifiro changed the title [Bug] tpu_model_runner: set vllm config context in reset_dynamo_cache() [Bugfix] tpu_model_runner: set vllm config context in reset_dynamo_cache() Dec 9, 2025
@mergify mergify bot added v1 tpu Related to Google TPUs labels Dec 9, 2025
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 addresses a startup crash in the tpu_model_runner by correctly setting the VllmConfig context. The issue stemmed from an attempt to access the configuration too early during the re-initialization of TorchCompileWithNoGuardsWrapper. The fix, which involves wrapping the __init__ call with the set_current_vllm_config context manager, is a direct and effective solution to the problem. The change is well-targeted and correctly applies the established pattern for managing configuration context within the codebase. I find the fix to be correct and necessary.

@dtrifiro
Copy link
Copy Markdown
Contributor Author

dtrifiro commented Dec 9, 2025

cc @LucasWilkinson @mgoin

@mergify
Copy link
Copy Markdown

mergify bot commented Dec 9, 2025

Hi @dtrifiro, the pre-commit checks have failed. Please run:

uv pip install pre-commit
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy or markdownlint failing?
mypy and markdownlint are run differently in CI. If the failure is related to either of these checks, please use the following commands to run them locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10
# For markdownlint
pre-commit run --hook-stage manual markdownlint

Copy link
Copy Markdown
Collaborator

@NickLucche NickLucche left a comment

Choose a reason for hiding this comment

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

Thanks for the fix @dtrifiro , this makes sense to me!

One suggestion: what about moving the set_current_vllm_config call to tpu_worker.py, so that it better matches the use of it we're doing in gpu_worker.py?

@dtrifiro dtrifiro changed the title [Bugfix] tpu_model_runner: set vllm config context in reset_dynamo_cache() [Bugfix] tpu_model_runner: set vllm config context when calling reset_dynamo_cache() Dec 9, 2025
…ache()

switching over to `TorchCompileWithNoGuardsWrapper.__init__(compiled_model)` causes a startup crash
due to an attempt to access `VllmConfig` too early.

See https://github.com/vllm-project/vllm/pull/25110/files#r2593461144

Signed-off-by: Daniele Trifirò <dtrifiro@redhat.com>
@dtrifiro
Copy link
Copy Markdown
Contributor Author

dtrifiro commented Dec 9, 2025

Thanks @NickLucche, excellent point. Updated as suggested and verified that it actually works.

Copy link
Copy Markdown
Collaborator

@NickLucche NickLucche left a comment

Choose a reason for hiding this comment

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

LGTM

@NickLucche NickLucche enabled auto-merge (squash) December 9, 2025 16:28
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Dec 9, 2025
@dtrifiro
Copy link
Copy Markdown
Contributor Author

Test failures look unrelated, can this be merged?

Failures:

  • [2025-12-09T18:25:18Z] E ModuleNotFoundError: No module named 'lmcache.v1.plugin.plugin_launcher'
  • test_suffix_decoding_acceptance (?)

@vllm-bot vllm-bot merged commit 53d2420 into vllm-project:main Dec 10, 2025
44 of 48 checks passed
@dtrifiro dtrifiro deleted the fix-tpu-worker branch December 10, 2025 15:00
Majid-Taheri pushed a commit to Majid-Taheri/vllm that referenced this pull request Dec 23, 2025
…_dynamo_cache() (vllm-project#30331)

Signed-off-by: Daniele Trifirò <dtrifiro@redhat.com>
Signed-off-by: Ubuntu <mjtaheri68@gmail.com>
dsuhinin pushed a commit to dsuhinin/vllm that referenced this pull request Jan 21, 2026
…_dynamo_cache() (vllm-project#30331)

Signed-off-by: Daniele Trifirò <dtrifiro@redhat.com>
Signed-off-by: dsuhinin <suhinin.dmitriy@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready ONLY add when PR is ready to merge/full CI is needed tpu Related to Google TPUs v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants