Skip to content
Closed
Changes from all commits
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: 8 additions & 2 deletions vllm/distributed/device_communicators/pynccl_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from torch.distributed import ReduceOp

from vllm.logger import init_logger
from vllm.platforms import current_platform
from vllm.utils import find_nccl_library

logger = init_logger(__name__)
Expand Down Expand Up @@ -223,6 +224,9 @@ class NCCLLibrary:
Function("ncclGroupStart", ncclResult_t, []),
# ncclResult_t ncclGroupEnd();
Function("ncclGroupEnd", ncclResult_t, []),
]

exported_functions_cuda_specific = [
# ncclResult_t ncclCommWindowRegister(
# ncclComm_t comm, void* buff, size_t size,
# ncclWindow_t* win, int winFlags);
Expand Down Expand Up @@ -271,10 +275,12 @@ def __init__(self, so_file: Optional[str] = None):
" to point to the correct nccl library path.", so_file,
platform.platform())
raise e

function_specs = list(NCCLLibrary.exported_functions)
if current_platform.is_cuda():
Copy link
Collaborator

Choose a reason for hiding this comment

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

These functions should exist on both platforms in NCCL >= 2.27.03.
The original issue was that on ROCm trying to import a non-existent symbol causes a crash, while on CUDA (apparently) it does not.

function_specs.extend(NCCLLibrary.exported_functions_cuda_specific)
if so_file not in NCCLLibrary.path_to_dict_mapping:
_funcs: dict[str, Any] = {}
for func in NCCLLibrary.exported_functions:
for func in function_specs:
f = getattr(self.lib, func.name)
f.restype = func.restype
f.argtypes = func.argtypes
Expand Down