Skip to content
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] force inductor threads #10620

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion vllm/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
plugins_loaded = False


def _force_torch_inductor_compile_threads(thread_num: int):
import torch
jeejeelee marked this conversation as resolved.
Show resolved Hide resolved

# see https://github.com/vllm-project/vllm/issues/10619
# A hacky way to limit the number of threads
torch._inductor.config.compile_threads = thread_num


def load_general_plugins():
"""WARNING: plugins can be loaded for multiple times in different
processes. They should be designed in a way that they can be loaded
Expand All @@ -26,7 +34,7 @@ def load_general_plugins():

# see https://github.com/vllm-project/vllm/issues/10480
os.environ['TORCHINDUCTOR_COMPILE_THREADS'] = '1'

_force_torch_inductor_compile_threads(thread_num=1)
global plugins_loaded
if plugins_loaded:
return
Expand Down