Skip to content

[TRTLLM-14268][feat] Add VisualGen serving benchmark - #18672

Draft
ishovkun wants to merge 22 commits into
NVIDIA:mainfrom
ishovkun:cosmos3-benchmark-visual-gen
Draft

[TRTLLM-14268][feat] Add VisualGen serving benchmark#18672
ishovkun wants to merge 22 commits into
NVIDIA:mainfrom
ishovkun:cosmos3-benchmark-visual-gen

Conversation

@ishovkun

@ishovkun ishovkun commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai summary

Description

Add a portable online-serving benchmark for VisualGen, with one combined
server/client lifecycle wrapper and independently usable server and client
scripts.

The benchmark:

  • covers Cosmos3 text-to-image, text-to-video, image-to-video,
    video-to-video, Transfer, text-to-audio-video,
    text-and-image-to-audio-video, and Action policy/forward/inverse dynamics;
  • refuses to reuse an occupied server port and verifies the model exposed by a
    standalone server before sending requests;
  • preserves checkpoint generation defaults unless an option is explicitly
    supplied;
  • reports request throughput, per-GPU throughput, latency and generation
    distributions, diffusion time, denoising-step timing, vision decode time,
    and total pipeline time when the server exposes them;
  • retains the complete run, server, health, client command, benchmark,
    metrics, result, and metadata artifacts;
  • optionally saves one generated media file per measured request on the
    client while keeping server-side temporary media isolated and disposable;
  • supports one or more Cosmos3 Transfer controls through a single
    TRANSFER_CONTROLS JSON mapping, including client-derived edge/blur and
    precomputed depth/segmentation/world-space-map controls;
  • sends current typed image_reference and video_reference multipart
    fields while keeping INPUT_REFERENCE as the shell file-path interface;
  • includes tuned Cosmos3 Super 4-GPU and 8-GPU serving configurations.

End-to-end Action validation also exposed and fixes two integration issues:

  • standalone clients now accept the basename reported by /v1/models when
    the requested model is an equivalent local checkpoint path;
  • Cosmos3 Action preprocessing now decodes uploaded image bytes instead of
    rejecting the typed multipart image_reference payload.

The runtime change is internal to Cosmos3 Action preprocessing. This PR does
not change the public VisualGen API, model equations, or runtime dependencies.

Test Coverage

  • tests/unittest/scripts/test_benchmark_visual_gen.py
    • request payloads and typed multipart reference fields
    • all benchmark modes, Action trajectories, and Transfer controls
    • server/client standalone behavior and combined lifecycle behavior
    • occupied-port rejection and benchmark-owned media cleanup
    • metrics extraction, retained artifacts, and shell argument validation
  • tests/unittest/_torch/visual_gen/test_cosmos3_action.py
    • uploaded image-byte decoding and corrupt-upload rejection
    • Action modes, embodiment defaults, conditioning, and output contracts
  • tests/integration/defs/visual_gen/test_visual_gen_benchmark.py
    • reported GPU count in the online benchmark result
  • tests/integration/defs/perf/test_visual_gen_perf_sanity.py
    • VisualGen performance database fields and generation-mode bucketing
  • Current tip validation:
    • merged upstream/main at 3503e3f9bb; the latest upstream delta has no
      Cosmos3 or VisualGen overlap
    • native post-merge build passed (7,615 Ninja tasks)
    • focused benchmark unit suite: 77 passed
    • complete Cosmos3 Action unit suite: 126 passed
    • focused pre-commit hooks pass
    • one-request Cosmos3-Nano Action policy benchmark passed on 1x B300:
      1/1 requests, 0.8446 s diffusion, 1.1406 s generation, 1.3889 s latency
    • retained Action output verified as request-0001.safetensors containing
      video (17, 480, 832, 3), action (16, 10), and scalar frame_rate

The one-request Action run is functional validation, not an official
performance baseline.

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • If PR introduces API changes, an appropriate PR label is added - either api-compatible or api-breaking. For api-breaking, include BREAKING in the PR title.

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

To see a list of available CI bot commands, please comment /bot help.

Signed-off-by: Igor Shovkun <igshov@gmail.com>
Measured the parallel layouts against each other on B300 with
Cosmos3-Super at 1280x720 x 189 frames, comparing engine-side generation
time from the Server-Timing header.

4 GPU (mean generation, 3 requests each):
  cfg2 x ulysses2, vae4                28.75 s   (was shipped)
  cfg2 x ulysses2, vae4, async         28.68 s   (now shipped)
  cfg1 x ulysses4, vae4                29.73 s   +3.4%
  cfg2 x ulysses2, vae1                32.93 s  +14.6%
  cfg2 x ring2                         unsupported for Cosmos3 cross-attention

8 GPU:
  cfg2 x ulysses4, vae8, async         15.10 s   (new config, 1.90x over 4 GPU)
  cfg1 x ulysses8, vae8                15.79 s   +4.5%

So cfg_size=2 is worth its two ranks at both sizes, and parallel VAE is the
single largest contributor at 4 GPUs. async_ulysses is within noise here but
matches what ltx2-4gpu and wan2.2-t2v-fp4-4gpu already set, so both Cosmos3
configs now enable it.

Also drop the "launch with torchrun --nproc_per_node=4" note from the 4-GPU
config: trtllm-serve spawns the workers itself, verified by the server
reporting "Launching 4 workers / World size: 4 / CFG size: 2 / Ulysses size: 2"
with no launcher wrapper.

Signed-off-by: Igor Shovkun <ishovkun@nvidia.com>
Trading two Ulysses ranks for tensor parallel is 2.2x faster and uses 42% less
memory per rank. Measured on 4xH200 with Cosmos3-Super-Image2Video at
1280x720 x 189 frames, 10 steps, 3 sequential requests, comparing engine-side
generation time from the Server-Timing header:

  cfg1 x tp2 x ulysses2    30.77 s    78 GB/rank
  cfg2 x ulysses2          67.85 s   134 GB/rank
  cfg1 x ulysses4          68.67 s   134 GB/rank

cfg_size=1 is not the cause of the speedup: cfg1 x ulysses4 also runs cfg1 and
is slow. The difference is spending two ranks on tensor parallel instead of on
Ulysses, which shards the weight matrices rather than replicating them.

parallel_vae_size stays at 4. Dropping it to 1 costs 14.6% on B300 and OOMs
outright on H200, where a single rank cannot hold the full 720p x 189-frame
decode in 139.8 GiB.

Also drop the measurement tables that had accumulated in both config headers;
that detail belongs in commit messages, not in shipped config files.

Signed-off-by: Igor Shovkun <ishovkun@nvidia.com>
Signed-off-by: Igor Shovkun <igshov@gmail.com>
Signed-off-by: Igor Shovkun <igshov@gmail.com>
Signed-off-by: Igor Shovkun <igshov@gmail.com>
Signed-off-by: Igor Shovkun <igshov@gmail.com>
Signed-off-by: Igor Shovkun <igshov@gmail.com>
Signed-off-by: Igor Shovkun <igshov@gmail.com>
Signed-off-by: Igor Shovkun <igshov@gmail.com>
Signed-off-by: Igor Shovkun <igshov@gmail.com>
Signed-off-by: Igor Shovkun <igshov@gmail.com>
Signed-off-by: Igor Shovkun <igshov@gmail.com>
Signed-off-by: Igor Shovkun <ishovkun@nvidia.com>
Signed-off-by: Igor Shovkun <ishovkun@nvidia.com>
…isual-gen

Signed-off-by: Igor Shovkun <ishovkun@nvidia.com>
Signed-off-by: Igor Shovkun <ishovkun@nvidia.com>
Signed-off-by: Igor Shovkun <ishovkun@nvidia.com>
@ishovkun
ishovkun force-pushed the cosmos3-benchmark-visual-gen branch from 7f56909 to 4e7cd90 Compare September 3, 2026 23:05
Signed-off-by: Igor Shovkun <ishovkun@nvidia.com>
Signed-off-by: Igor Shovkun <ishovkun@nvidia.com>
…isual-gen

Signed-off-by: Igor Shovkun <ishovkun@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant