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 struct

MatmulKernelConfig

struct MatmulKernelConfig

Block/warp/MMA shape configuration for 4-wave kernels.

Shared by AMD4WaveMatmul's matmul and conv2d entry points β€” both use the same 4-warp 2Γ—2 quadrant layout and the same MFMA shape selection, so the per-call surface only needs the workgroup / warp / MMA tile shapes.

Fields​

  • ​block_shape (IndexList[3]): Workgroup tile shape (BM, BN, BK).
  • ​warp_shape (IndexList[3]): Per-warp tile shape (WM, WN, WK).
  • ​mma_shape (IndexList[3]): Single-MMA instruction shape (MMA_M, MMA_N, MMA_K).

Implemented traits​

AnyType, Copyable, ImplicitlyCopyable, ImplicitlyDeletable, Movable, Writable

Methods​

__init__​

def __init__(out self, *, block_shape: IndexList[3], warp_shape: IndexList[3], mma_shape: IndexList[3])

Constructs a MatmulKernelConfig from the three tile shapes.

Args:

  • ​block_shape (IndexList[3]): Workgroup tile shape (BM, BN, BK).
  • ​warp_shape (IndexList[3]): Per-warp tile shape (WM, WN, WK).
  • ​mma_shape (IndexList[3]): Single-MMA instruction shape (MMA_M, MMA_N, MMA_K).

num_threads​

def num_threads(self) -> Int

Returns the total threads per workgroup (warps x WARP_SIZE).

Returns:

Int: The number of threads in one workgroup.

write_to​

def write_to(self, mut writer: T)

Writes a human-readable shape tag to writer.

Args:

  • ​writer (T): Sink for the rendered config tag.

write_repr_to​

def write_repr_to(self, mut writer: T)

Writes a debug representation of this config to writer.

Args:

  • ​writer (T): Sink for the rendered config tag.