[Edge][WP3] Add CPU OmniPlatform (AR + generation stages on vLLM's CPU backend)

* vllm_omni/platforms/cpu/platform.py: CPUOmniPlatform(OmniPlatform, CpuPlatform)
  selected when VLLM_TARGET_DEVICE=cpu or a +cpu vLLM wheel is installed
  (builtin plugin "cpu"; explicit CPU target short-circuits accelerator probes
  like vLLM does). NUMA-based memory queries, one logical device, no graph
  wrapper (sentinel type for isinstance checks), inductor opt-in via
  VLLM_OMNI_CPU_INDUCTOR=1, diffusion stages unsupported.
* vllm_omni/platforms/cpu/worker: CPUARWorker / CPUGenerationWorker compose
  vLLM's CPUWorker with the Omni mixin (XPU pattern); CPUARModelRunner /
  CPUGenerationModelRunner compose the Omni runners with CPUModelRunner
  (no graphs, no async omni output; sleep/wake return error ACKs).
* patch.py skips the CuMem patch on CPU-only torch; Qwen3-TTS speaker encoder
  and prompt-embeds dtype follow the model dtype (float32/float16 on CPU).
* vllm_omni/deploy/qwen3_tts.yaml: `platforms: cpu:` overlay (eager, no async
  scheduling, absolute kv_cache_memory_bytes, disjoint OMP thread ranges).
* requirements/cpu.txt (+psutil, intel-openmp), docs/getting_started/installation/cpu.md.

Measured (this x86 Xeon 8480C host, vllm 0.28.0+cpu, bf16, 12+4 threads):
Qwen3-TTS 0.6B CustomVoice end-to-end on CPU, 12 prompts: TTFA p50 292 ms,
RTF ~1.7 (25-frame chunk ~4.6 s), init 185 s. Result JSON + init timeline
committed under benchmarks/tts/edge_results/.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
tzhouamandClaude Fable 5.1 committed 2026-09-09 11:02:14 +08:00
1 parent 55192de984
commit 35e43b9983
18 files changed
+1740 -7

No files matched your search

+38
View File
@@ -120,17 +120,55 @@ def musa_omni_platform_plugin() -> str | None:
return "vllm_omni.platforms.musa.platform.MUSAOmniPlatform" if is_musa else None
_CPU_OMNI_PLATFORM = "vllm_omni.platforms.cpu.platform.CPUOmniPlatform"
def _cpu_target_requested() -> bool:
"""True when vLLM itself would select its CPU platform (env or ``+cpu`` wheel)."""
try:
import vllm.envs as envs
if getattr(envs, "VLLM_TARGET_DEVICE", None) == "cpu":
return True
except Exception: # pragma: no cover - envs import never fails in practice
pass
try:
from vllm.platforms import vllm_version_matches_substr
return bool(vllm_version_matches_substr("cpu"))
except Exception:
return False
def cpu_omni_platform_plugin() -> str | None:
"""Check if the CPU OmniPlatform should be activated.
Mirrors vLLM's own ``cpu_platform_plugin``: active when
``VLLM_TARGET_DEVICE=cpu`` or a ``+cpu`` vLLM wheel is installed.
"""
logger.debug("Checking if CPU OmniPlatform is available.")
return _CPU_OMNI_PLATFORM if _cpu_target_requested() else None
builtin_omni_platform_plugins = {
"cuda": cuda_omni_platform_plugin,
"rocm": rocm_omni_platform_plugin,
"npu": npu_omni_platform_plugin,
"xpu": xpu_omni_platform_plugin,
"musa": musa_omni_platform_plugin,
"cpu": cpu_omni_platform_plugin,
}
def resolve_current_omni_platform_cls_qualname() -> str:
"""Resolve the current OmniPlatform class qualified name."""
# Like vLLM (vllm/platforms/__init__.py), an explicit CPU target wins before
# any accelerator probe so a +cpu wheel on a GPU host does not activate two
# builtin platforms.
if _cpu_target_requested():
logger.debug("CPU target requested; activating CPU OmniPlatform.")
return _CPU_OMNI_PLATFORM
platform_plugins = load_omni_plugins_by_group(OMNI_PLATFORM_PLUGINS_GROUP)
activated_plugins = []