Skip to content

[BugFix][CPU] Fix x86 SHM distributed module initialization #18536

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

Merged
merged 1 commit into from
May 22, 2025
Merged
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
8 changes: 6 additions & 2 deletions vllm/distributed/device_communicators/cpu_communicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ def __init__(self,
super().__init__(cpu_group, device, device_group, unique_name)
self.dist_module = torch.distributed

if (current_platform.get_cpu_architecture() == CpuArchEnum.X86) \
and hasattr(torch.ops._C, "init_shm_manager"):
if (current_platform.get_cpu_architecture()
== CpuArchEnum.X86) and hasattr(
torch.ops._C,
"init_shm_manager") and unique_name.startswith("tp"):
self.dist_module = _CPUSHMDistributed(self)

def all_reduce(self, input_):
Expand Down Expand Up @@ -96,6 +98,8 @@ class _CPUSHMDistributed:

def __init__(self, communicator: CpuCommunicator):
instance_identifier = os.environ["VLLM_DIST_IDENT"]
unique_name = communicator.unique_name
instance_identifier = f"{instance_identifier}-{unique_name}"
self.communicator = communicator

group_ranks = [str(rank) for rank in self.communicator.ranks]
Expand Down