[Edge][WP8] Per-step overhead attribution, edge scheduling helpers, CPU thread sweep

- vllm_omni/edge/step_stats.py: process-local counters enabled by
  VLLM_OMNI_STEP_STATS_DIR (scheduler schedule/update_from_output, engine-core
  step, chunk hop enqueue->put / put->get / get, orchestrator dispatch), dumped
  per process and merged into an attribution table (share of the 80 ms frame).
  Hooks: stage_engine_core_proc (instrument after construction, dump at exit),
  chunk_transfer_adapter (put/get timing, put->get via the shm lock-file mtime),
  orchestrator dispatch loop. Bench: stream_latency_bench.py --step-stats.
- vllm_omni/edge/scheduling.py: playback slack, prefill-throttle decision and
  the no-preemption KV admission rule (exact bytes/token from the talker KV
  geometry); adapt.derive_overrides now sizes max_num_seqs with it and
  auto_profile passes the geometry read from the model config.
- Engine re-reads parallel_stage_init after apply_deploy_profile so the edge
  profile's orchestrator default takes effect (was read before the profile).
- benchmarks/tts/cpu_thread_sweep.py: CPU-only 8/16/32-thread sweep (+inductor)
  with per-step attribution.
- Tests: tests/core/test_edge_scheduling.py, tests/edge/test_step_stats.py,
  tests/benchmarks/test_cpu_thread_sweep.py, profile default test.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
tzhouamandClaude Fable 5.1 committed 2026-09-09 14:55:55 +08:00
1 parent 74acd66307
commit 37c0ea9a6b
16 files changed
+926 -16

No files matched your search

+3
View File
@@ -204,6 +204,9 @@ class AsyncOmniEngine:
from vllm_omni.entrypoints.utils import apply_deploy_profile
apply_deploy_profile(model, kwargs)
# A profile may carry orchestrator defaults (e.g. ``parallel_stage_init``);
# re-read the flag now that the profile has been applied.
self._parallel_stage_init = bool(kwargs.get("parallel_stage_init") or False)
# Stage resolution pops deploy_config, so get pipeline-wide settings beforehand.
deploy_config_path = kwargs.get("deploy_config")
+8
View File
@@ -36,6 +36,7 @@ from vllm.v1.metrics.stats import IterationStats
from vllm_omni.config.stage_config import DuplexSessionRuntimeConfig
from vllm_omni.distributed.omni_connectors.utils.config import stage_receives_chunks
from vllm_omni.edge.step_stats import StepStats
from vllm_omni.engine import OmniEngineCoreRequest
from vllm_omni.engine.cfg_companion_tracker import CfgCompanionTracker
from vllm_omni.engine.duplex.contracts import (
@@ -1383,7 +1384,12 @@ class Orchestrator:
pending_get: asyncio.Task | None = None
next_reconcile = _time.monotonic() + _ORCH_READER_RECONCILE_INTERVAL_S
try:
_stats = StepStats.get()
_dispatch_t0: float | None = None
while not self._shutdown_event.is_set():
if _dispatch_t0 is not None:
_stats.add("orch.dispatch_ms", (_time.perf_counter() - _dispatch_t0) * 1000.0)
_dispatch_t0 = None
if pending_get is None:
pending_get = asyncio.create_task(ready_q.get(), name="orch-dispatch-get")
done, _ = await asyncio.wait(
@@ -1406,6 +1412,8 @@ class Orchestrator:
continue
kind, stage_id, replica_id, payload = pending_get.result()
pending_get = None
if _stats.enabled:
_dispatch_t0 = _time.perf_counter()
if kind == "error":
# replica_id < 0 means the failure was raised by a poller
@@ -191,6 +191,10 @@ class StageEngineCoreProc(EngineCoreProc):
engine_index=dp_rank,
**kwargs,
)
# Steady-state overhead attribution (no-op unless VLLM_OMNI_STEP_STATS_DIR).
from vllm_omni.edge.step_stats import StepStats, instrument_engine_core
instrument_engine_core(engine_core)
# Each subprocess corresponds to exactly one omni replica with
# its own OmniMasterServer allocation, so the heartbeat client
@@ -241,6 +245,8 @@ class StageEngineCoreProc(EngineCoreProc):
engine_core._send_engine_dead()
raise
finally:
with contextlib.suppress(Exception):
StepStats.get().dump()
signal.signal(signal.SIGTERM, signal.SIG_DFL)
signal.signal(signal.SIGINT, signal.SIG_DFL)
if signal_callback is not None: