Skip to content

[Multimodal] Use GPU NVDEC for EPD encoder-only instance video media IO - #53675

Merged
DarkLight1337 merged 15 commits into
vllm-project:mainfrom
Isotr0py:epd-nvdec-io
Sep 11, 2026
Merged

DarkLight1337 merged 15 commits into
vllm-project:mainfrom
Isotr0py:epd-nvdec-io

Conversation

@Isotr0py

@Isotr0py Isotr0py commented Aug 25, 2026

Copy link
Copy Markdown
Member

Purpose

  • Given that ec_producer doesn't need to manage kv cache, it's safe to move media io to use NVDEC.

Test Plan

  • Hardware: one GB200 node per run (4x GB200 GPUs, 140 Grace cores)
  • Topology: 1 encoder (ec_producer, GPU0) + 3 colocated PD instances (ec_consumer, GPU1-3) behind disagg_epd_proxy.py; ECExampleConnector with node-local shared storage
  • Model: Qwen/Qwen3.5-35B-A3B (bf16), --enforce-eager, PD --gpu-memory-utilization 0.8, --enable-mm-embeds
  • Workload: vllm bench serve --dataset-name hf --dataset-path yale-nlp/MMVU, burst mode (--request-rate inf), --max-concurrency 64, seed 0
    • fps=2 tier: serving-default sampling, 30 frames per 15s 360p video, 400 prompts
    • fps=4 tier: 2x frames (60 per video, ~26k video tokens), 200 prompts
  • Repeat benchmark on three different compute nodes to avoid hardware difference

Test Result

fps=2 tier (30 frames/video)

Run Node baseline req/s tc_cuda req/s Speedup Mean TTFT baseline Mean TTFT tc_cuda
Run 1 Node A 1.945 3.782 +94% 18.9 s 2.17 s (-89%)
Run 2 Node B 1.978 4.183 +111% 17.3 s 2.40 s (-86%)
Run 3 Node C 2.054 4.420 +115% 14.5 s 2.32 s (-84%)

fps=4 tier (60 frames/video)

Run Node baseline req/s tc_cuda req/s Speedup Mean TTFT baseline Mean TTFT tc_cuda
Run 1 Node A 1.244 3.239 +160% 31.4 s 4.27 s (-86%)
Run 2 Node B 1.171 3.620 +209% 33.4 s 4.20 s (-87%)
Run 3 Node C 1.185 3.157 +166% 31.5 s 4.07 s (-87%)

All 1600/1600 requests succeeded in each run; zero NVDEC fallbacks (no cpu_fallback warnings in encoder logs).

Per-stage breakdown (proxy logs, per-request averages, run 1)

Stage baseline f2 tc_cuda f2 baseline f4 tc_cuda f4
encode 18.5 s 1.3 s (-93%) 31.0 s 2.7 s (-91%)
decode_ttfb 0.40 s 0.82 s 0.43 s 1.55 s
decode_total 11.4 s 14.0 s 12.2 s 14.5 s

Attribution: NVDEC decode vs GPU preprocessing

Ablation on an isolated encode-only instance (same clean node, back-to-back runs; MMVU, 256 prompts, concurrency 64):

Config Decode Preprocess req/s Step gain Mean TTFT
A (status quo) opencv CPU CPU 2.17 26.4 s
B opencv CPU GPU (frames H2D'd into the processor) 6.95 +220% vs A 8.4 s (-68%)
D (full feature) torchcodec NVDEC GPU (zero-copy) 10.71 +54% vs B 5.4 s (-36%)

Total A→D: 4.9x encoder-side. In the full 1E3PD pipeline this dilutes to +94-115% because the PD replicas become the bottleneck.

The encode stage (fetch + decode + HF preprocess + ViT + EC publish) dominates the baseline. With tc_cuda it shrinks ~14x, and the PD side becomes the system bottleneck (decode_ttfb/total rise as PD replicas saturate) — i.e., the encoder is no longer the limiter, which is the intended operating point for EPD scaling.


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

Signed-off-by: Isotr0py <Isotr0py@outlook.com>
Signed-off-by: Isotr0py <Isotr0py@outlook.com>
@Isotr0py Isotr0py changed the title [Multimodal] Use GPU NVDEC for EPD encoder-only instance media IO [Multimodal] Use GPU NVDEC for EPD encoder-only instance video media IO Aug 25, 2026
@mergify

mergify Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Documentation preview: https://vllm--53675.org.readthedocs.build/en/53675/

@mergify mergify Bot added documentation Improvements or additions to documentation frontend multi-modality Related to multi-modality (#4194) qwen Related to Qwen models kv-connector labels Aug 25, 2026
@mergify

mergify Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @Isotr0py.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Aug 31, 2026
# Conflicts:
#	examples/disaggregated/disaggregated_encoder/disagg_epd_proxy.py

Signed-off-by: Isotr0py <Isotr0py@outlook.com>
video_embeds support is already upstream; restore qwen3_vl.py and
test_audio.py to the upstream versions so this branch only carries the
torchcodec NVDEC device feature.

Signed-off-by: Isotr0py <Isotr0py@outlook.com>
Signed-off-by: Isotr0py <Isotr0py@outlook.com>
@mergify mergify Bot removed the needs-rebase label Aug 31, 2026
Signed-off-by: Isotr0py <Isotr0py@outlook.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

Signed-off-by: Isotr0py <Isotr0py@outlook.com>
Signed-off-by: Isotr0py <Isotr0py@outlook.com>
Comment thread vllm/config/vllm.py
device_type,
)

def _resolve_mm_video_decode_device(self) -> None:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I missing something? Where does the check for encode-only instance occur?

@Isotr0py Isotr0py Sep 1, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I missed this one, fixed in https://github.com/vllm-project/vllm/pull/53675/changes/84b1d07d55e22bdfa0980b3905a8ab147e03c9e8..62adfadc317bc604e5f4d87e64a6cfad8353e86b

(I think we should clean the processor/mediaio device resolver function in followup PR, it's a bit messy 😅)

@Isotr0py Isotr0py Sep 1, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, after second thought, I think we should tie video decode device with mm processor device instead, otherwise it will cause duplicated d2h/h2d transfer. 🤔

@mergify

mergify Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @Isotr0py.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Sep 1, 2026
Signed-off-by: Isotr0py <Isotr0py@outlook.com>
# Conflicts:
#	tests/multimodal/test_parse.py
#	vllm/multimodal/parse.py

Signed-off-by: Isotr0py <Isotr0py@outlook.com>
Signed-off-by: Isotr0py <Isotr0py@outlook.com>
@mergify mergify Bot removed the needs-rebase label Sep 1, 2026
Signed-off-by: Isotr0py <Isotr0py@outlook.com>
runtime_kwargs.pop("pool_size", None)
# The decode device determines which device the decoded frames
# (and thus the processor pipeline) live on; startup-only.
runtime_kwargs.pop("device", None)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When an encoder defaults to {"backend": "torchcodec", "device": "cuda"}, a request overriding backend to "opencv" retains device="cuda". This fails with ValueError: device is not supported by the 'opencv' backend.

Could we clear the automatically injected codec-specific options when the request switches backends?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 8effb2c. We will further clean up current kwargs resolving in following PR, current dictionary is not flexible and clear enough.

Signed-off-by: Isotr0py <Isotr0py@outlook.com>
@Isotr0py Isotr0py added the ready ONLY add when PR is ready to merge/full CI is needed label Sep 11, 2026
@Isotr0py

Copy link
Copy Markdown
Member Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #88285 for commit 8effb2c241cb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation frontend kv-connector multi-modality Related to multi-modality (#4194) qwen Related to Qwen models ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants