From 21156ff1999f180c95176d4be9b9efb16dcb8473 Mon Sep 17 00:00:00 2001 From: kzwrime <66299956+kzwrime@users.noreply.github.com> Date: Tue, 6 Jan 2026 01:26:09 +0800 Subject: [PATCH] =?UTF-8?q?[Bugfix]=20Add=20missing=20extra=5Ftensors=20ar?= =?UTF-8?q?g=20to=20DeviceCommunicatorBase.disp=E2=80=A6=20(#31644)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: kunzh --- .../base_device_communicator.py | 1 + .../device_communicators/xpu_communicator.py | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/vllm/distributed/device_communicators/base_device_communicator.py b/vllm/distributed/device_communicators/base_device_communicator.py index caeff54406..4a2a7ec5b7 100644 --- a/vllm/distributed/device_communicators/base_device_communicator.py +++ b/vllm/distributed/device_communicators/base_device_communicator.py @@ -285,6 +285,7 @@ class DeviceCommunicatorBase: hidden_states: torch.Tensor, router_logits: torch.Tensor, is_sequence_parallel: bool = False, + extra_tensors: list[torch.Tensor] | None = None, ) -> tuple[torch.Tensor, torch.Tensor]: """ Dispatch the hidden states and router logits to the appropriate device. diff --git a/vllm/distributed/device_communicators/xpu_communicator.py b/vllm/distributed/device_communicators/xpu_communicator.py index ad61fdfb8e..f3d9262d20 100644 --- a/vllm/distributed/device_communicators/xpu_communicator.py +++ b/vllm/distributed/device_communicators/xpu_communicator.py @@ -23,11 +23,11 @@ class XpuCommunicator(DeviceCommunicatorBase): ): super().__init__(cpu_group, device, device_group, unique_name) if self.use_all2all: - if self.all2all_backend != "naive": + if self.all2all_backend != "naive": # type: ignore[has-type] logger.warning( "`%s` all2all manager is not supported on XPU. " "Falling back to `naive` all2all manager for XPU.", - self.all2all_backend, + self.all2all_backend, # type: ignore[has-type] ) self.all2all_backend = "naive" if self.all2all_backend == "naive": @@ -78,12 +78,15 @@ class XpuCommunicator(DeviceCommunicatorBase): hidden_states: torch.Tensor, router_logits: torch.Tensor, is_sequence_parallel: bool = False, + extra_tensors: list[torch.Tensor] | None = None, ) -> tuple[torch.Tensor, torch.Tensor]: assert self.all2all_manager is not None - hidden_states, router_logits = self.all2all_manager.dispatch( - hidden_states, router_logits, is_sequence_parallel + return self.all2all_manager.dispatch( + hidden_states, + router_logits, + is_sequence_parallel, + extra_tensors, # type: ignore[call-arg] ) - return hidden_states, router_logits def combine( self, hidden_states: torch.Tensor, is_sequence_parallel: bool = False