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 function

test_matmul_sm90_swapAB_comparison

def test_matmul_sm90_swapAB_comparison[a_type: DType, b_type: DType, c_type: DType, config: MatmulConfig[a_type, b_type, c_type], config_swapAB: MatmulConfig[a_type, b_type, c_type], MType: CoordLike, NType: CoordLike, KType: CoordLike, //](ctx: DeviceContext, m: MType, n: NType, k: KType)

Compare matmul results between normal execution and swapAB execution.

Both compute: C[M,N] = A[M,K] @ B[N,K]^T swapAB internally swaps A/B and transposes C on store, but result should match.

Parameters:

  • ​a_type (DType): Element type of the A operand matrix A[M,K].
  • ​b_type (DType): Element type of the B operand matrix B[N,K].
  • ​c_type (DType): Element type of the output matrix C[M,N].
  • ​config (MatmulConfig[a_type, b_type, c_type]): Compile-time matmul configuration for the normal kernel, including block tile shape, cluster shape, MMA shape, pipeline stages, and consumer count.
  • ​config_swapAB (MatmulConfig[a_type, b_type, c_type]): Compile-time matmul configuration for the swapAB kernel, which internally swaps the A/B operands and transposes the C tile on store.
  • ​MType (CoordLike): Type carrying the M dimension value, either static or dynamic.
  • ​NType (CoordLike): Type carrying the N dimension value, either static or dynamic.
  • ​KType (CoordLike): Type carrying the K dimension value, either static or dynamic.

Args:

  • ​ctx (DeviceContext): The device context.
  • ​m (MType): The M dimension (can be static or dynamic).
  • ​n (NType): The N dimension (can be static or dynamic).
  • ​k (KType): The K dimension (can be static or dynamic).

Was this page helpful?