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
4157f563
Unverified
Commit
4157f563
authored
Mar 25, 2025
by
Siyuan Liu
Committed by
GitHub
Mar 25, 2025
Browse files
[Hardware][TPU][Bugfix] Fix v1 mp profiler (#15409)
Signed-off-by:
Siyuan Liu
<
lsiyuan@google.com
>
parent
051da7ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
vllm/v1/worker/tpu_worker.py
vllm/v1/worker/tpu_worker.py
+8
-2
No files found.
vllm/v1/worker/tpu_worker.py
View file @
4157f563
...
...
@@ -66,14 +66,18 @@ class TPUWorker:
from
vllm.utils
import
init_cached_hf_modules
init_cached_hf_modules
()
# Delay profiler initialization to the start of the profiling.
# This is because in vLLM V1, MP runtime is initialized before the
# TPU Worker is initialized. The profiler server needs to start after
# MP runtime is initialized.
self
.
profiler
=
None
self
.
profile_dir
=
None
if
envs
.
VLLM_TORCH_PROFILER_DIR
and
self
.
rank
<
1
:
# For TPU, we can only have 1 active profiler session for 1 profiler
# server. So we only profile on rank0.
self
.
profile_dir
=
envs
.
VLLM_TORCH_PROFILER_DIR
logger
.
info
(
"Profiling enabled. Traces will be saved to: %s"
,
self
.
profile_dir
)
self
.
profiler
=
xp
.
start_server
(
9012
)
if
self
.
model_config
.
seed
is
None
:
self
.
model_config
.
seed
=
0
...
...
@@ -168,9 +172,11 @@ class TPUWorker:
def
profile
(
self
,
is_start
:
bool
=
True
):
if
self
.
rank
<
1
:
if
self
.
profiler
is
None
:
if
self
.
profile
_di
r
is
None
:
raise
RuntimeError
(
"Profiler is not enabled."
)
if
is_start
:
if
self
.
profiler
is
None
:
self
.
profiler
=
xp
.
start_server
(
9012
)
xp
.
start_trace
(
self
.
profile_dir
)
else
:
xp
.
stop_trace
()
...
...
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