[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

@@ -16,6 +16,7 @@ from vllm.v1.request import Request, RequestStatus
from vllm.v1.utils import ConstantList
from vllm_omni.data_entry_keys import MetaStruct, OmniPayloadStruct, unflatten_payload
from vllm_omni.edge.step_stats import StepStats, shm_lockfile_age_ms
from ..adapter import construct_next_stage_streaming_input_prompt
from ..factory import OmniConnectorFactory
@@ -388,6 +389,7 @@ class OmniChunkTransferAdapter(OmniTransferAdapterBase):
"is_segment_finished": is_segment_finished,
"new_token_ids": tuple(int(token_id) for token_id in (new_token_ids or ())),
"segment_generation": generation,
"enqueued_at": time.perf_counter(),
}
reject_reason = None
@@ -447,12 +449,23 @@ class OmniChunkTransferAdapter(OmniTransferAdapterBase):
connector_get_key = f"{external_req_id}_{target_stage_id}_{chunk_id}"
# Use timeout=0 for non-blocking poll
_stats = StepStats.get()
try:
_t_get = time.perf_counter()
result = self.connector.get(
str(target_stage_id),
str(stage_id),
connector_get_key,
)
if _stats.enabled:
_now = time.time()
_stats.add(
"hop.get_ms" if result is not None else "hop.poll_miss_ms", (time.perf_counter() - _t_get) * 1000.0
)
if result is not None:
age = shm_lockfile_age_ms(connector_get_key, _now)
if age is not None:
_stats.add("hop.put_to_get_ms", age)
except Exception as e:
logger.error(f"SharedMemoryConnector get failed for req {connector_get_key}: {e}")
with self._receiver_state_lock:
@@ -716,12 +729,16 @@ class OmniChunkTransferAdapter(OmniTransferAdapterBase):
logger.debug("Skipping cancelled chunk for request %s before connector put", external_req_id)
return
success, size, metadata = self.connector.put(
from_stage=str(stage_id),
to_stage=str(next_stage_id),
put_key=connector_put_key,
data=payload_data,
)
_stats = StepStats.get()
if _stats.enabled and task.get("enqueued_at") is not None:
_stats.add("hop.enqueue_to_put_ms", (time.perf_counter() - task["enqueued_at"]) * 1000.0)
with _stats.timed("hop.put_ms"):
success, size, metadata = self.connector.put(
from_stage=str(stage_id),
to_stage=str(next_stage_id),
put_key=connector_put_key,
data=payload_data,
)
if sender_token is not None and not self._sender_generation_is_active(external_req_id, sender_token):
# cleanup_sender() may cancel this generation while put() is