Sglang diffusion benchmark profile

From HYGON-AI/sglang-das · View interactive version

Sglang diffusion benchmark profile is an AI agent skill from the GitHub repository HYGON-AI/sglang-das. Use when benchmarking denoise latency or profiling a diffusion bottleneck in SGLang.

How to use this skill

Skill file

SGLang Diffusion Benchmark and Profile

Use this skill when measuring denoise performance, finding the slow op, checking whether an existing fast path can solve it, or verifying that a hotspot is real before any kernel work in sglang.multimodal_gen.

This skill is diagnosis-first. It owns:

This skill does not own low-level kernel authoring or standalone Nsight workflows.

Preflight

Before running any benchmark, profiler, or kernel-validation command:

denoise/decode timings; the preset helper sets it by default unless the

caller explicitly overrides it

--model-cache-root together with --cleanup-model-cache; verify the JSONL

ledger reports zero residual weight files before moving to the next model

the same GPU set and verify it has no foreign process at every run boundary

Native Backend Gate

All diffusion benchmark and profiling results owned by this skill must come from the native SGLang diffusion backend.

Treat any of the following as a hard stop condition:

If any benchmark, perf-dump, or torch.profiler command prints one of those signals:

Main Reference

Opportunity Discovery Rule

Before calling a diffusion hotspot "new", first classify it with existing-fast-paths.md.

Always rule out these existing families first:

attention at quality=lossless or quality=high; keep the second attention GEMM in FP32 and

compare against quality=exact before changing its precision further

LayerNorm-modulation fast paths before adding video-only kernels

USP relayout, and batched TP AdaLN collectives

FLUX.1, GLM-Image, and SANA

treating its router's topk/mask/gather chain as a new hotspot

FlexAttention fallback trace

The checked-in helper defaults to eager. Use --torch-compile only for a

controlled comparator, never for the eager ground truth. The legacy

--no-torch-compile spelling remains accepted but is redundant.

For kernel/BCG discovery, run --quality-bcg-matrix. It executes Eager/BCG as

A-B-B-A at exact, then repeats the pair at lossless and high, on

one locked GPU set and one isolated checkpoint cache. The lossless/high+BCG

rows are applicability checks, not presumed-valid performance cells. A BCG row is invalid unless the log

contains [Diffusion BCG] captured and contains no support-disable,

capture-failure, serving-signature-miss, or late quality-fusion marker. In

particular, a request-scoped DiT fusion mounted after exact warmup capture

would be bypassed by replay; reject that row even when capture and signature

checks pass. For video presets, the helper declares both the request resolution

and --warmup-num-frames so the synthetic BCG warmup captures the requested

temporal shape. Treat any remaining temporal or conditioning signature miss as

Eager fallback, not as a valid BCG measurement.

A zero process exit is not sufficient evidence: every accepted row must also

contain its requested perf dump and a generated image, video, audio, or 3D mesh

file.

The helper gives every cell a unique output name and rejects missing artifacts.

On machines with a read-only Hugging Face cache, combine

--model-cache-root <task-owned-dir> with one or more

--seed-model-cache-root <read-only-HF-home-or-hub> options. The helper exposes

cached repos through a task-owned copy-on-write directory overlay, downloads

misses only into the isolated cache, and removes links plus new downloads in

its normal cleanup finally block without modifying the seed cache.

Keep prompt, negative prompt, seed, shape, steps, guidance, dtype, topology,

and residency fixed. Lossless comparisons require byte-identical artifacts.

For quality=lossless and quality=high, report aggregate and worst-frame SSIM/PSNR; the repository

defaults are 0.95/28 dB for images and 0.92/24 dB for video unless the model's

checked-in consistency metadata defines a different threshold. A performance

PR needs repeated saved-request e2e improvement of at least 1.5%, a

representative profile, and before/after image or video evidence.

MiniMax-H3 is always an eager consistency case on current main. Use

--model minimax-h3-t2va; its preset writes the H3 request fields through a

generated config and suppresses the helper's global compile default. Do not

turn the model's nominal BCG support gate into a performance claim: prompt-

dependent packed-sequence host boundaries can differ between warmup and the

serving request. A valid H3 BCG experiment must prove that every captured

segment replays, keeps the MP4 byte-identical, and does not trade latency for

the extra graph memory.

For FLUX-family manual profiling runs with a quantized transformer override:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.