[Edge][WP8] Model-level step timers: talker forward, sampling, talker-MTP, code-predictor sub-steps

Counters model.forward_ms / model.sample_ms / model.talker_mtp_ms and
predictor.substep_ms / predictor.loop_ms (VLLM_OMNI_STEP_STATS_DIR); with
VLLM_OMNI_STEP_STATS_SYNC=1 the accelerator is synchronized around the model
timers so async kernels are attributed (attribution runs only).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1ax5wYLA6XbqEL1i8L9gZ
This commit is contained in:
tzhouamandClaude Fable 5.1 committed 2026-09-09 21:32:15 +08:00
1 parent f9d2cab3bc
commit abf81f4114
3 files changed
+46 -12

No files matched your search

@@ -15,6 +15,7 @@ Shared by Qwen3-Omni and Qwen3-TTS talker models.
from __future__ import annotations
import dataclasses
import time
from collections.abc import Iterable, Sequence
import torch
@@ -1062,7 +1063,12 @@ class CodePredictorWrapper(nn.Module):
all_codes[:, 0] = layer0_code.reshape(bsz)
# Autoregressive loop: predict layers 1..G-1
from vllm_omni.edge.step_stats import StepStats
_stats = StepStats.get()
_t_loop = time.perf_counter() if _stats.enabled else 0.0
for step in range(1, num_groups):
_t_sub = time.perf_counter() if _stats.enabled else 0.0
graph_key: int | tuple[int, int] = padded_bsz
seq_len = max_seq
if self._prefix_graphs_enabled:
@@ -1136,6 +1142,10 @@ class CodePredictorWrapper(nn.Module):
if step < num_groups - 1 or self._wrapper_config.return_proj_buf:
new_embed = codec_embeds[step - 1](code)
proj_buf[:bsz, step + 1, :] = projection(new_embed.reshape(bsz, 1, -1)).reshape(bsz, -1)
if _stats.enabled:
_stats.add("predictor.substep_ms", (time.perf_counter() - _t_sub) * 1000.0)
if _stats.enabled:
_stats.add("predictor.loop_ms", (time.perf_counter() - _t_loop) * 1000.0)
if self._wrapper_config.return_proj_buf:
return all_codes, proj_buf[:bsz].clone()