Skip to main content

Overview

cute::TiledMma represents a tiled matrix multiply-accumulate operation that partitions an MMA across multiple threads and values. It builds on MMA_Atom (hardware-level MMA instructions) by tiling them in the M, N, and K dimensions.

Class Template

Template Parameters

MMA_Atom<MMAOperation>
The atomic MMA operation (e.g., SM80_16x8x16_F16F16F16F16_TN for Ampere Tensor Cores).
Layout
The MNK-tiling of the Atom. Specifies how many atoms are tiled in M, N, and K dimensions.
Tile
default:"Tile<_,_,_>"
Optional permutations to apply to each MNK mode before tiling.

Source Location

include/cute/atom/mma_atom.hpp:202-457

Member Types

Value Types

Fragment Types

Layout Types

Member Functions

Tensor Partitioning

thrfrg_C()

Tiles a C tensor from shape (M,N,...) to shape ((ThrV,(ThrM,ThrN)),(FrgV,(RestM,RestN,...))). Parameters:
  • ctensor: The C/D tensor to partition
Returns: Partitioned tensor with thread and fragment modes separated Example:

thrfrg_A()

Tiles an A tensor from shape (M,K,...) to shape ((ThrV,(ThrM,ThrK)),(FrgV,(RestM,RestK,...))). Parameters:
  • atensor: The A operand tensor to partition
Returns: Partitioned tensor with thread and fragment modes

thrfrg_B()

Tiles a B tensor from shape (N,K,...) to shape ((ThrV,(ThrN,ThrK)),(FrgV,(RestN,RestK,...))). Parameters:
  • btensor: The B operand tensor to partition
Returns: Partitioned tensor with thread and fragment modes

Thread Slicing

get_slice()

Returns a ThrMMA object for a specific thread index. Parameters:
  • thr_idx: Thread index within the TiledMMA
Returns: ThrMMA<TiledMMA, ThrCoord> for per-thread operations Example:

get_thread_slice()

Alias for get_slice(). Returns per-thread MMA object.

Layout Accessors

get_layoutC_TV()

Returns the (thread_idx, value_idx) -> (M, N) layout for the C matrix.

get_layoutA_TV()

Returns the (thread_idx, value_idx) -> (M, K) layout for the A matrix.

get_layoutB_TV()

Returns the (thread_idx, value_idx) -> (N, K) layout for the B matrix.

Utility

tile_size_mnk()

Returns the total tile size in the M (I=0), N (I=1), or K (I=2) dimension. Example:

ThrMMA - Per-Thread MMA

Represents the MMA operation for a single thread.

ThrMMA Methods

partition_C()

Partitions the C tensor for this thread. Returns: Per-thread view of C with shape (FrgV,(RestM,RestN,...))

partition_A()

Partitions the A tensor for this thread. Returns: Per-thread view of A with shape (FrgV,(RestM,RestK,...))

partition_B()

Partitions the B tensor for this thread. Returns: Per-thread view of B with shape (FrgV,(RestN,RestK,...))

partition_fragment_C()

Partitions C and creates a register fragment. Returns: Register tensor fragment for C accumulation

partition_fragment_A()

Partitions A and creates a register fragment.

partition_fragment_B()

Partitions B and creates a register fragment.

Factory Functions

make_tiled_mma()

Creates a TiledMMA from an MMA atom and thread layout. Parameters:
  • mma_atom: The atomic MMA operation
  • thr_layout: Thread layout in (M, N, K) specifying the tiling
  • permutations: Optional permutations for each mode
Example:

Common MMA Atoms

Ampere (SM80) Tensor Cores

Hopper (SM90) Tensor Cores

Usage Examples

Basic TiledMMA Setup

Partitioning Tensors

Complete GEMM Kernel Outline

Multi-stage Pipeline

See Also