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 function
choose_block_scaled_config
def choose_block_scaled_config[a_type: DType, b_type: DType, c_type: DType, sfa_dtype: DType, sfb_dtype: DType, transpose_b: Bool = True, gemm_kind: GEMMKind = GEMMKind.GEMM](M: Int, N: Int, K: Int) -> BlockScaledMatmulConfig[a_type, b_type, c_type, sfa_dtype, sfb_dtype, transpose_b]
Select a BlockScaledMatmulConfig that minimizes waves per SM for the given shape.
Parameters:
- βa_type (
DType):DTypeof the A (left) operand elements;uint8indicates packed FP4; must equalb_type. - βb_type (
DType):DTypeof the B (right) operand elements. - βc_type (
DType):DTypeof the output matrix elements. - βsfa_dtype (
DType):DTypeof the A operand block scaling factors; must equalsfb_dtype. - βsfb_dtype (
DType):DTypeof the B operand block scaling factors; must equalsfa_dtype. - βtranspose_b (
Bool): Whether the B operand is stored transposed (defaults toTrue). - βgemm_kind (
GEMMKind): TheGEMMKindselecting the kernel variant (defaults toGEMMKind.GEMM).
Args:
- βM (
Int): The M dimension of the matmul. - βN (
Int): The N dimension of the matmul. - βK (
Int): The K dimension of the matmul.
Returns:
BlockScaledMatmulConfig[a_type, b_type, c_type, sfa_dtype, sfb_dtype, transpose_b]: A BlockScaledMatmulConfig tuned for the given problem dimensions.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!