[Bugfix][CPU] Fix macOS multimodal SHM cache initialization (#57142)

Signed-off-by: 子华 <huaxi.shx@alibaba-inc.com>
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
shaohuaxi
2026-09-18 09:05:13 +00:00
committed by GitHub
co-authored by Codex
parent 32636580a6
commit 67a8a3f926
2 changed files with 14 additions and 1 deletions
+5
View File
@@ -18,6 +18,11 @@ from vllm.envs import (
from vllm.exceptions import VLLMValidationError
def test_object_storage_shm_default_name():
"""The generated name must fit macOS's shared-memory name limit."""
assert len(envs._generate_shm_name()) <= 30
def test_getattr_without_cache(monkeypatch: pytest.MonkeyPatch):
assert envs.VLLM_HOST_IP == ""
assert envs.VLLM_PORT is None
+9 -1
View File
@@ -535,6 +535,14 @@ def get_vllm_port() -> int | None:
raise ValueError(f"VLLM_PORT '{port}' must be a valid integer") from err
def _generate_shm_name() -> str:
import pybase64
# Fit macOS's 30-character limit without truncating the UUID.
encoded_uuid = pybase64.urlsafe_b64encode(uuid.uuid4().bytes).decode("ascii")
return "vllm_mm_" + encoded_uuid.rstrip("=")
def get_env_or_set_default(
env_name: str,
default_factory: Callable[[], str],
@@ -1943,7 +1951,7 @@ environment_variables: dict[str, Callable[[], Any]] = {
# if not explicitly set.
"VLLM_OBJECT_STORAGE_SHM_BUFFER_NAME": get_env_or_set_default(
"VLLM_OBJECT_STORAGE_SHM_BUFFER_NAME",
lambda: f"VLLM_OBJECT_STORAGE_SHM_BUFFER_{uuid.uuid4().hex}",
_generate_shm_name,
),
# The size in MB of the buffers (NVL and RDMA) used by DeepEP
"VLLM_DEEPEP_BUFFER_SIZE_MB": lambda: int(