Unverified Commit 41088695 authored by Gregory Shtrasberg's avatar Gregory Shtrasberg Committed by GitHub
Browse files

[ROCm] Avoid using the default stream on ROCm (#13238)


Signed-off-by: default avatarGregory Shtrasberg <Gregory.Shtrasberg@amd.com>
parent e38be640
...@@ -942,11 +942,16 @@ def current_stream() -> torch.cuda.Stream: ...@@ -942,11 +942,16 @@ def current_stream() -> torch.cuda.Stream:
the underlying hypothesis is that we do not call `torch._C._cuda_setStream` the underlying hypothesis is that we do not call `torch._C._cuda_setStream`
from C/C++ code. from C/C++ code.
""" """
from vllm.platforms import current_platform
global _current_stream global _current_stream
if _current_stream is None: if _current_stream is None:
# when this function is called before any stream is set, # when this function is called before any stream is set,
# we return the default stream. # we return the default stream.
_current_stream = torch.cuda.current_stream() # On ROCm using the default 0 stream in combination with RCCL
# is hurting performance. Therefore creating a dedicated stream
# per process
_current_stream = torch.cuda.Stream() if current_platform.is_rocm(
) else torch.cuda.current_stream()
return _current_stream return _current_stream
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment