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
88016c37
Unverified
Commit
88016c37
authored
Aug 22, 2025
by
Li, Jiang
Committed by
GitHub
Aug 22, 2025
Browse files
[Bugfix] Fix pooling models on CPU backend (#23392)
Signed-off-by:
jiang1.li
<
jiang1.li@intel.com
>
parent
99872085
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
vllm/utils/__init__.py
vllm/utils/__init__.py
+18
-2
No files found.
vllm/utils/__init__.py
View file @
88016c37
...
...
@@ -1440,6 +1440,12 @@ def _patched_set_stream(stream: torch.cuda.Stream) -> None:
torch
.
cuda
.
set_stream
=
_patched_set_stream
class
_StreamPlaceholder
:
def
__init__
(
self
):
self
.
synchronize
=
lambda
:
None
def
current_stream
()
->
torch
.
cuda
.
Stream
:
"""
replace `torch.cuda.current_stream()` with `vllm.utils.current_stream()`.
...
...
@@ -1459,8 +1465,18 @@ def current_stream() -> torch.cuda.Stream:
# On ROCm using the default 0 stream in combination with RCCL
# is hurting performance. Therefore creating a dedicated stream
# per process
_current_stream_tls
.
value
=
torch
.
cuda
.
Stream
(
)
if
current_platform
.
is_rocm
()
else
torch
.
cuda
.
current_stream
()
if
current_platform
.
is_rocm
():
_current_stream_tls
.
value
=
torch
.
cuda
.
Stream
()
elif
current_platform
.
is_cpu
():
_current_stream_tls
.
value
=
_StreamPlaceholder
()
else
:
current_stream
=
current_platform
.
current_stream
if
current_stream
is
not
None
:
_current_stream_tls
.
value
=
current_stream
()
else
:
raise
ValueError
(
"Fail to set current stream, current platform "
"may not support current_stream with torch API"
)
return
_current_stream_tls
.
value
...
...
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