minimax_h3_parallel ¶
Sequence-parallel chunk scheduling for the MiniMax-H3 video VAE.
The H3 video VAE decodes a video as a series of temporal-chunk decoder forwards whose outputs are joined by a short deterministic frame blend (AutoencoderKLMiniMaxH3._decode_chunks), and encodes videos as fully independent clip_length-frame encoder forwards. Neither the chunk decode nor the clip encode has any cross-chunk data dependency — only the joining of decoded chunks (overlap blending, frame trimming) is sequential. This module round-robins the chunk/clip forwards across the ranks of a sequence-parallel group and replays the serial joining logic on the assembling rank, reproducing the serial result bit for bit.
Bit-exactness contract: - every rank holds an identical copy of the inputs (the H3 DiT all-gathers its outputs, and reference pixels are prepared identically on all ranks); - a chunk decoded on any rank is bitwise the tensor the serial loop would produce (identical weights, inputs, and deterministic kernels on identical GPUs), and NCCL transports it bitwise; - every serialization point of the serial algorithm (overlap blending, frame trimming, pixel denormalization, output-buffer copies, moment concatenation and token-drop trimming) runs on the assembling rank in serial order via the same VAE methods the serial path uses.
Collective safety: all group ranks must call these functions together with identically shaped inputs. Work proceeds in rounds of one collective each; ranks without a chunk in the final round contribute a placeholder tensor, so participation is uniform by construction and no rank-dependent branch guards a collective.
Caveat — compiled decoders (enable_torch_compile_vae): inductor autotunes kernel configs per process at first call, so a compiled decoder is only deterministic WITHIN a process, not across processes. Chunks decoded on other ranks then differ from the serial rank's decode of the same chunk exactly as two serial runs in different processes would. Direct decoder tensors measured on GB200 at 124f had max absolute error 0.00268358 (0.684/255), mean absolute error 4.213e-05 (0.0107/255), and 24.59% nonzero values; the first chunk was bit-identical. A separate decoded-MP4 comparison reached 63/255 on <0.5% of pixels, but that includes lossy MP4 encoding and is not the decoder-tensor error envelope. With the eager decoder — the pipeline default — parallel output is bitwise equal to serial decode_to_pixels.
Classes¶
Functions:¶
fastvideo.models.vaes.minimax_h3_parallel.decode_to_pixels_parallel ¶
decode_to_pixels_parallel(vae: AutoencoderKLMiniMaxH3, z: Tensor, output: Tensor | None, group: 'GroupCoordinator', strategy: str = DEFAULT_DECODE_GATHER_STRATEGY) -> Tensor | None
Chunk-parallel decode_to_pixels across a sequence-parallel group.
All group ranks call this together with identical z. Temporal chunks are decoded round-robin across the group and their segments move to the group's first rank, which assembles bitwise the serial decode_to_pixels result into output. Only the first rank passes output (validated exactly like the serial API); other ranks pass None and receive None.
Source code in fastvideo/models/vaes/minimax_h3_parallel.py
fastvideo.models.vaes.minimax_h3_parallel.encode_pixels_parallel ¶
encode_pixels_parallel(vae: AutoencoderKLMiniMaxH3, pixels: Tensor, group: 'GroupCoordinator') -> AutoencoderKLOutput
Clip-parallel encode_pixels across a sequence-parallel group.
Encoder clips have no cross-clip dependency (no overlap, no blending), so ranks encode disjoint clips and all-gather the per-clip moment tensors. Every rank returns the identical full posterior — preserving the serial contract that all ranks hold the same encoded latents — bitwise equal to vae.encode_pixels(pixels). Moments are latent-sized (a few MB per clip), so the all-gather is negligible next to the clip forwards.
Source code in fastvideo/models/vaes/minimax_h3_parallel.py
fastvideo.models.vaes.minimax_h3_parallel.parallel_chunk_indices ¶
Round-robin chunk ownership: chunk i belongs to rank i % world_size.