Skip to content

minimax_h3_vsa_simd

SIMD-group block-sparse attention for MiniMax H3 VSA.

This backend is an explicit opt-in. It supports tile size 64 and head dimension 128, evaluates the tile map selected by the reference router, and leaves unsupported shapes to the reference implementation.

Functions:

fastvideo.mlx_runtime.minimax_h3_vsa_simd.disable_simd_kernel

disable_simd_kernel(error: Exception) -> None

Remember a failed compile or execution so subsequent blocks use reference.

Source code in fastvideo/mlx_runtime/minimax_h3_vsa_simd.py
def disable_simd_kernel(error: Exception) -> None:
    """Remember a failed compile or execution so subsequent blocks use reference."""
    global _SIMD_KERNEL, _SIMD_KERNEL_ERROR
    _SIMD_KERNEL_ERROR = str(error)
    _SIMD_KERNEL = None

fastvideo.mlx_runtime.minimax_h3_vsa_simd.simd_block_sparse

simd_block_sparse(q_tiled, k_tiled, v_tiled, block_idx, block_num, geometry, scale: float)

Block-sparse attention over tiled [S, H, D] using the reference tile map.

Source code in fastvideo/mlx_runtime/minimax_h3_vsa_simd.py
def simd_block_sparse(
    q_tiled,
    k_tiled,
    v_tiled,
    block_idx,
    block_num,
    geometry,
    scale: float,
):
    """Block-sparse attention over tiled ``[S, H, D]`` using the reference tile map."""

    kernel = _simd_kernel()
    if kernel is None:
        raise RuntimeError(_SIMD_KERNEL_ERROR or "SIMD-group VSA kernel is unavailable")
    return _launch_simd_block_sparse(kernel, q_tiled, k_tiled, v_tiled, block_idx, block_num, geometry, scale)