From 5b3eeaf5045f1105ff8378f2a0164a12b3bda3ea Mon Sep 17 00:00:00 2001 From: pure water <102280098+Zhangpch2021@users.noreply.github.com> Date: Sun, 21 Jun 2026 08:51:06 +0800 Subject: [PATCH] [Fix] MM pool GPU alloc with base_gpu_id (#23377) --- python/sglang/srt/multimodal/processors/base_processor.py | 1 + python/sglang/srt/utils/cuda_ipc_transport_utils.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/python/sglang/srt/multimodal/processors/base_processor.py b/python/sglang/srt/multimodal/processors/base_processor.py index 761ba4dae..52951b226 100644 --- a/python/sglang/srt/multimodal/processors/base_processor.py +++ b/python/sglang/srt/multimodal/processors/base_processor.py @@ -277,6 +277,7 @@ class BaseMultimodalProcessor(ABC): self.cudaipc_mmfeature_pool = MmItemMemoryPool( per_worker_pool_size, MM_ITEM_MEMORY_POOL_RECYCLE_INTERVAL, + self.server_args.base_gpu_id, ) def compute_mrope_positions(self, input_ids, mm_items): diff --git a/python/sglang/srt/utils/cuda_ipc_transport_utils.py b/python/sglang/srt/utils/cuda_ipc_transport_utils.py index c4d2d87f3..ff4ed24fc 100644 --- a/python/sglang/srt/utils/cuda_ipc_transport_utils.py +++ b/python/sglang/srt/utils/cuda_ipc_transport_utils.py @@ -122,9 +122,9 @@ class MmItemMemoryChunk: class MmItemMemoryPool: - def __init__(self, memory_size, recycle_interval): + def __init__(self, memory_size, recycle_interval, base_gpu_id): self.memory_pool = torch.empty( - memory_size, dtype=torch.int8, device="cuda" + memory_size, dtype=torch.int8, device=f"cuda:{base_gpu_id}" ).contiguous() storage = self.memory_pool.untyped_storage() self._pool_ipc_handle = storage._share_cuda_()