Skip to content

[vla, data] perf: pin pyav decoder to single thread - #135

Merged
nullnonenilNULL merged 1 commit into
baidu-baige:masterfrom
XueSongTap:master
Jul 30, 2026
Merged

[vla, data] perf: pin pyav decoder to single thread#135
nullnonenilNULL merged 1 commit into
baidu-baige:masterfrom
XueSongTap:master

Conversation

@XueSongTap

@XueSongTap XueSongTap commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Pin the PyAV video decoder to single-threaded decode (stream.thread_count = 1) in _decode_pyav, leaving all CPU parallelism to --num-workers.

PyAV defaults to thread_count=0 ("auto"), which sizes libav's thread pool to the host core count. Because the dataloader already provides process-level parallelism, this is a second parallelism knob layered over the same cores, and the two multiply: at 8 ranks x 16 workers on a 128-core host, 128 loader processes each spinning up ~128 decode threads oversubscribes the machine by orders of magnitude. The pool is also built and torn down on every av.open(), a cost that a handful of decoded frames never amortizes.

Thread-level decode is the worse knob for this access pattern in any case. Our workload is many small, independent seek-and-grab decodes; worker processes scale near-linearly across them, while libav slice threading yields ~1.6x at best on a single stream.

Impact

  • +19% end-to-end training throughput
  • Throughput curve is materially more stable. Previously, at --num-workers 16, throughput dipped once every 16 iterations as the dataloader round-robin came back around to a stalled worker; that periodic dip is gone.
af39e8c72599a94268d4853b959c19b8

@nullnonenilNULL
nullnonenilNULL merged commit a17058e into baidu-baige:master Jul 30, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants