Benchmark and Bugfix for GLM-Image (#3024)

Signed-off-by: JaredforReal <w13431838023@gmail.com>
Signed-off-by: Hongsheng Liu <liuhongsheng4@huawei.com>
Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
Jared WenandHongsheng Liu authored and GitHub committed 2026-04-25 20:49:19 +08:00
1 parent 6b52db9e2b
commit 6e35bfbbae
18 files changed
+1836 -381

No files matched your search

+17
View File
@@ -1032,6 +1032,7 @@ class AsyncOmniEngine:
original_prompt = prompt
stage_type = self.stage_metadata[0].get("stage_type")
_preprocess_ms = 0.0
if stage_type != "diffusion" and not isinstance(prompt, EngineCoreRequest):
# Inject global_request_id into the raw prompt.
if isinstance(prompt, dict):
@@ -1041,6 +1042,7 @@ class AsyncOmniEngine:
_inject_global_id(item, request_id)
# Full input processing (tokenization, multimodal, etc.)
_t_preprocess = time.perf_counter()
request = self.input_processor.process_inputs(
request_id=request_id,
prompt=prompt,
@@ -1054,6 +1056,7 @@ class AsyncOmniEngine:
data_parallel_rank=data_parallel_rank,
resumable=resumable,
)
_preprocess_ms = (time.perf_counter() - _t_preprocess) * 1000.0
# TODO (Peiqi): add this for Qwen3-TTS only. Other models don't have
# additional_information field in the prompt.
request = _upgrade_to_omni_request(request, prompt)
@@ -1090,6 +1093,8 @@ class AsyncOmniEngine:
"original_prompt": original_prompt,
"sampling_params_list": effective_sampling_params_list,
"final_stage_id": final_stage_id,
"preprocess_ms": _preprocess_ms,
"enqueue_ts": time.perf_counter(),
}
def _enqueue_cfg_companions(
@@ -1316,6 +1321,7 @@ class AsyncOmniEngine:
"num_weight_load_threads": kwargs.get("num_weight_load_threads", 4),
"quantization": kwargs.get("quantization", None),
"enable_diffusion_pipeline_profiler": kwargs.get("enable_diffusion_pipeline_profiler", False),
"enable_ar_profiler": kwargs.get("enable_ar_profiler", False),
**(
{
"profiler_config": asdict(kwargs["profiler_config"])
@@ -1458,6 +1464,17 @@ class AsyncOmniEngine:
or cfg.engine_args.quantization_config is None
):
cfg.engine_args.quantization_config = quantization_config
# Inject profiler flags for diffusion stages
for profiler_key in (
"enable_diffusion_pipeline_profiler",
"enable_ar_profiler",
):
val = kwargs.get(profiler_key)
if val:
if not hasattr(cfg.engine_args, profiler_key) or not getattr(
cfg.engine_args, profiler_key, False
):
setattr(cfg.engine_args, profiler_key, val)
quantization = kwargs.get("quantization")
if quantization is not None:
if not hasattr(cfg.engine_args, "quantization") or cfg.engine_args.quantization is None:
+14
View File
@@ -114,6 +114,9 @@ class OrchestratorRequestState:
streaming: StreamingInputState = field(default_factory=lambda: StreamingInputState())
# Per-request pipeline timing accumulator (milliseconds)
pipeline_timings: dict[str, float] = field(default_factory=dict)
@dataclass
class StreamingInputState:
@@ -625,6 +628,7 @@ class Orchestrator:
total_token=self._agg_total_tokens[stage_id],
total_gen_time_ms=self._agg_total_gen_time_ms[stage_id],
),
pipeline_timings=dict(req_state.pipeline_timings),
)
def _build_kv_sender_info(self, sender_stage_ids: list[int]) -> dict[int, dict[str, Any]] | None:
@@ -682,6 +686,7 @@ class Orchestrator:
False,
)
_dt_ar2d = (_time.perf_counter() - _t_ar2d) * 1000
req_state.pipeline_timings["ar2diffusion_ms"] = _dt_ar2d
logger.info(
"[Orchestrator] ar2diffusion req=%s wall_time=%.3fms stage=%d->%d",
req_id,
@@ -911,6 +916,15 @@ class Orchestrator:
)
req_state.streaming.enabled = is_streaming
req_state.stage_submit_ts[stage_id] = _time.time()
# Per-request pipeline timings from caller thread
_enqueue_ts = msg.get("enqueue_ts", 0.0)
if _enqueue_ts > 0:
req_state.pipeline_timings["queue_wait_ms"] = (_time.perf_counter() - _enqueue_ts) * 1000.0
_preprocess_ms = msg.get("preprocess_ms", 0.0)
if _preprocess_ms > 0:
req_state.pipeline_timings["preprocess_ms"] = _preprocess_ms
self.request_states[request_id] = req_state
# Stage-0 prompt is already a fully-formed OmniEngineCoreRequest