[Edge][CPU] KV-cached code predictor, int8-dynamic CPU fast path, model-side CPU sampler
Measured on a Xeon 8480C (12+4 threads, 0.6B): the 15 residual-codebook sub-steps re-ran the 5-layer predictor over the whole prefix each time (97 ms per frame of the 134 ms talker step) and vLLM's stock sampler spent 9 ms per step in its torch.compile'd random-sample kernel on CPU. - code predictor: forward_cached (KV cache per layer, 2-token prefill then one token per sub-step) and a shape-static forward_static_step (tensor position + boolean mask) that torch.compile handles as one graph; incremental decoding is the default on CPU (VLLM_OMNI_PREDICTOR_INCREMENTAL), optional compile (VLLM_OMNI_PREDICTOR_COMPILE=step), optional thread cap. - CPU fast path: dynamic int8 Linear layers (fp32 activations) for the predictor and its lm heads (VLLM_OMNI_PREDICTOR_INT8, default on; micro-benchmark 70 -> 36 ms per frame for the 15 sub-steps); VLLM_OMNI_PREDICTOR_PARITY_CHECK=1 records top-1 agreement / max logit diff against the bf16 model in situ. - Qwen3-TTS talker: prefer_model_sampler on CPU with a sample() that mirrors vLLM's Sampler (logits processors + penalties, temperature, top-k/top-p, exponential-noise sampling with per-request generators) without the compiled kernel (VLLM_OMNI_CPU_FAST_SAMPLER, default on). - step_stats: sampler phase timers and sample-metadata timers. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
936c10be4b
commit
6ce8de1b28
6 files changed
+604
-8
No files matched your search
@@ -212,6 +212,28 @@ def instrument_engine_core(engine_core: Any) -> None:
|
||||
engine_core.step_fn = stats.wrap("core.step_ms", step_fn)
|
||||
|
||||
|
||||
def instrument_sampler(sampler: Any) -> None:
|
||||
"""Time the phases of vLLM's v1 ``Sampler`` in place (idempotent, no-op when disabled)."""
|
||||
stats = StepStats.get()
|
||||
if not stats.enabled or sampler is None or getattr(sampler, "_omni_step_stats_instrumented", False):
|
||||
return
|
||||
for name in (
|
||||
"apply_logits_processors",
|
||||
"apply_penalties",
|
||||
"apply_temperature",
|
||||
"sample",
|
||||
"compute_logprobs",
|
||||
"gather_logprobs",
|
||||
):
|
||||
fn = getattr(sampler, name, None)
|
||||
if callable(fn):
|
||||
setattr(sampler, name, stats.wrap(f"sampler.{name}_ms", fn))
|
||||
tk = getattr(sampler, "topk_topp_sampler", None)
|
||||
if tk is not None and callable(getattr(tk, "forward", None)):
|
||||
tk.forward = stats.wrap("sampler.topk_topp_ms", tk.forward)
|
||||
sampler._omni_step_stats_instrumented = True
|
||||
|
||||
|
||||
def shm_lockfile_age_ms(key: str, now: float | None = None) -> float | None:
|
||||
"""Age of the SharedMemoryConnector lock file for ``key`` (written at put time)."""
|
||||
try:
|
||||
|
||||
Reference in new issue
Block a user