You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Per-request media_io_kwargs let one small video request allocate gigabytes in trtllm-serve #20988
TensorRT-LLM main (687359e), trtllm-serve with a video-capable multimodal model. CPU-side decode, no GPU needed to reproduce.
Who can help?
@NVIDIA/trt-llm-runtime-devs (CODEOWNERS for tensorrt_llm/serve and tensorrt_llm/inputs)
Reproduction
ChatCompletionRequest.media_io_kwargs (openai_protocol.py, "Per-request override for the server's --media_io_kwargs") is merged into VideoMediaIO with no bounds. _load_video_by_cv2 samples min(num_frames, frame_count, duration * fps) frames and stacks them, then converts to float32 for format="pt".
Encode 1000 black 1280x720 frames with OpenCV mp4v (1.2 MB file).
Send it as a video_url data URI with "media_io_kwargs": {"video": {"num_frames": 500, "fps": 1000}}.
Expected behavior
The server bounds the number of decoded frames (or the decoded byte size) independently of what the client asks for.
Actual behavior
Measured with the real chat_utils.parse_chat_messages_coroutines and VideoMediaIO:
num_frames requested
Decoded
Peak RSS
Wall time
10 (default)
0.10 GiB
0.85 GiB
5.5 s
500
5.15 GiB float32
12.2 GiB
195 to 264 s
1000
tried to allocate (1000, 720, 1280, 3) float32 = 11 GiB, stopped only by the test's 24 GiB address-space cap
165 to 247 s
The 200 MiB limit on the encoded video does not bound the decoded size, and the client controls the frame count.
Additional notes
The right bound is a policy choice for maintainers, so this issue comes without a PR. Possible fixes: cap request-supplied num_frames at the server's configured value or a hard maximum, and/or cap frames x height x width before stacking.
Activity
[NVIDIA#20988][fix] Bound decoded video memory per request in trtllm-…
[NVIDIA#20988][fix] Bound decoded video memory per request in trtllm-…
[NVIDIA#20988][fix] Bound decoded video memory per request in trtllm-…