minimax_h3_fusions ¶
Inference-only MiniMax H3 fusions adapted from NVlabs/Sana Sol-Engine.
Source: https://github.com/NVlabs/Sana/tree/sol-engine/models/minimax_h3/GB200
Functions:¶
fastvideo.models.dits.minimax_h3_fusions.fused_qknorm_rope ¶
fused_qknorm_rope(x: Tensor, weight: Tensor, cos: Tensor, sin: Tensor, eps: float) -> Tensor
Run per-head RMSNorm and partial RoPE in one Sol-Engine-style kernel.
RMSNorm reduction and RoPE arithmetic stay in FP32 registers until the final store. Triton's reduction order and the absence of eager's BF16 intermediate materializations can produce small, expected rounding drift.
Row offsets are computed in int64, so inputs beyond 2**31 total elements (about 300k tokens per rank at H3's 56 heads x 128 head_dim) address correctly.
Source code in fastvideo/models/dits/minimax_h3_fusions/qknorm_rope.py
fastvideo.models.dits.minimax_h3_fusions.fused_residual_gate_rmsnorm_modulate ¶
fused_residual_gate_rmsnorm_modulate(residual: Tensor, branch: Tensor, gate: Tensor, weight: Tensor, scale: Tensor, shift: Tensor, index: Tensor, eps: float) -> tuple[Tensor, Tensor]
Fuse residual update, row-indexed gate, RMSNorm, and modulation.
index values must lie in [0, table_rows); see :func:fused_rmsnorm_modulate for why the wrapper does not check them.
Source code in fastvideo/models/dits/minimax_h3_fusions/modulation.py
fastvideo.models.dits.minimax_h3_fusions.fused_rmsnorm_modulate ¶
fused_rmsnorm_modulate(x: Tensor, weight: Tensor, scale: Tensor, shift: Tensor, index: Tensor, eps: float) -> Tensor
Run RMSNorm and row-indexed modulation in one strict Triton kernel.
index values must lie in [0, table_rows). Unlike eager index_select, the kernel does not raise on out-of-range values (a device-side bounds check would synchronize); callers are safe by construction (timestep_indices * 3 + token_tags, SP pads with 0).
Source code in fastvideo/models/dits/minimax_h3_fusions/modulation.py
fastvideo.models.dits.minimax_h3_fusions.minimax_h3_swiglu ¶
Run the forward-only Triton fusion over an H3 (..., 2 * ffn_dim) input.
This is intentionally a strict kernel wrapper: callers own fallback policy and must only invoke it for a supported CUDA inference path.