home/ atoms/ warmup-for-gpu-pipeline

A warmup phase fills the pipeline's latent buffer and JIT-compiles kernels before timing starts

StreamDiffusion’s ring buffer (x_t_latent_buffer) starts empty and requires at least len(t_index_list) × frame_buffer_size forward passes before it reaches steady-state. During those initial frames, output quality is lower because the pipeline is operating on zero-initialised latents. Additionally, CUDA kernels undergo JIT compilation and GPU memory allocation on first use, making the first few frames dramatically slower. The warmup parameter in StreamDiffusionWrapper runs this many dummy passes before returning control. Benchmarks measure only post-warmup frames. The README specifies: # Warmup >= len(t_index_list) x frame_buffer_size.

Examples

# Manual warmup in raw StreamDiffusion:
for _ in range(len(t_index_list)):   # e.g. 2 iterations
    stream(init_image)

# Automatic warmup via wrapper:
StreamDiffusionWrapper(..., warmup=10)

Assessment

With t_index_list=[0, 16, 32, 45] and frame_buffer_size=2, what is the minimum warmup count before the output buffer is reliably filled? Why might you still use a higher warmup count in production?

“Warmup >= len(t_index_list) x frame_buffer_size”
corpus · streamdiffusion-pipeline-for-real-time-interactive-image-gen · chunk 6