IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).

Mojo module

matmul_swiglu_kernels

SM100 fused GEMM+SwiGLU kernel (monolithic warp-specialized).

Follows the same monolithic structure as the BF16/FP8 dense kernel: free functions for each phase (load, MMA, epilogue) and a single top-level kernel function that dispatches to them via WarpRole checks.

Two epilogue modes controlled by register_swiglu:

  • False (default): TMEM β†’ FP32 SwiGLU β†’ half SMEM β†’ TMA store to GMEM.
  • True: TMEM β†’ FP32 SwiGLU β†’ BF16 stores directly to GMEM.

Weight layout: natural row-interleaved (gate, up) pairs in both swap modes.

  • non-swap (AB_swapped=False): (gate, up) at adjacent N positions.
  • swap (AB_swapped=True): (gate, up) at adjacent M positions; warp.shuffle_xor(_, 4) brings the up value into the gate-owner lane.

Structs​

Functions​

Was this page helpful?