[Bugfix] Report stepwise Qwen-Image profiler metrics (#4517)
Signed-off-by: akshatvishu <akshatnayak197@gmail.com>
This commit is contained in:
1 parent
0b59dfb94a
commit
04f400d36c
4 files changed
+200
-8
No files matched your search
@@ -15,6 +15,41 @@ if TYPE_CHECKING:
|
||||
from vllm_omni.inputs.data import OmniDiffusionSamplingParams, OmniPromptType
|
||||
|
||||
|
||||
def clear_pipeline_stage_durations(pipeline: Any) -> None:
|
||||
clear_records = getattr(pipeline, "clear_profiler_records", None)
|
||||
if getattr(pipeline, "enable_diffusion_pipeline_profiler", False) and callable(clear_records):
|
||||
clear_records()
|
||||
|
||||
|
||||
def consume_pipeline_stage_durations(pipeline: Any) -> dict[str, float]:
|
||||
if not getattr(pipeline, "enable_diffusion_pipeline_profiler", False):
|
||||
return {}
|
||||
stage_durations = getattr(pipeline, "stage_durations", None)
|
||||
if not isinstance(stage_durations, dict):
|
||||
return {}
|
||||
result = {stage: float(duration) for stage, duration in stage_durations.items()}
|
||||
clear_pipeline_stage_durations(pipeline)
|
||||
return result
|
||||
|
||||
|
||||
def merge_stage_durations(
|
||||
state: DiffusionRequestState,
|
||||
stage_durations: dict[str, float],
|
||||
) -> None:
|
||||
if not stage_durations:
|
||||
return
|
||||
for stage, duration in stage_durations.items():
|
||||
state.stage_durations[stage] = float(state.stage_durations.get(stage, 0.0)) + float(duration)
|
||||
|
||||
|
||||
def attach_stage_durations(
|
||||
state: DiffusionRequestState,
|
||||
output: DiffusionOutput,
|
||||
) -> None:
|
||||
if state.stage_durations:
|
||||
output.stage_durations = dict(state.stage_durations)
|
||||
|
||||
|
||||
@dataclass
|
||||
class DiffusionRequestState:
|
||||
"""Per-request mutable state across all pipeline stages.
|
||||
@@ -79,6 +114,9 @@ class DiffusionRequestState:
|
||||
# For example: Wan condition tensors / masks, or Bagel KV contexts.
|
||||
extra: dict[str, Any] = field(default_factory=dict)
|
||||
|
||||
# ── Runner-owned profiling metadata ──
|
||||
stage_durations: dict[str, float] = field(default_factory=dict)
|
||||
|
||||
# Peak device memory observed while this request is active in step mode.
|
||||
peak_memory_mb: float = 0.0
|
||||
|
||||
|
||||
Reference in new issue
Block a user