Skip to main content

Overview

cute::TiledCopy represents a tiled copy operation that partitions data movement across multiple threads. It builds on Copy_Atom (hardware-level copy instructions like ldgsts, cp.async, TMA) by tiling them across threads and values.

Class Template

Template Parameters

Copy_Atom<CopyOperation, InternalType>
The atomic copy operation (e.g., SM80_CP_ASYNC_CACHEALWAYS for async copy).
Layout
The (thread_id, value_id) -> coordinate layout specifying how threads and values map to coordinates.
Shape
The shape of the coordinate space being tiled (typically 2D for matrix operations).

Source Location

include/cute/atom/copy_atom.hpp:182-355

Member Types

Value Type

Layout Types

Thread and Value Counts

Member Functions

Tensor Partitioning

tidfrg_S()

Tiles a source tensor from shape (M,N,...) to shape (Thr,(FrgV,FrgX),(RestM,RestN,...)). Parameters:
  • stensor: The source tensor to partition
Returns: Partitioned tensor with thread and fragment modes Example:

tidfrg_D()

Tiles a destination tensor from shape (M,N,...) to shape (Thr,(FrgV,FrgX),(RestM,RestN,...)). Parameters:
  • dtensor: The destination tensor to partition
Returns: Partitioned tensor with thread and fragment modes

Thread Slicing

get_slice()

Returns a ThrCopy object for a specific thread index. Parameters:
  • thr_idx: Thread index within the TiledCopy
Returns: ThrCopy<TiledCopy, ThrIdx> for per-thread copy operations Example:

get_thread_slice()

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

Layout Accessors

get_layoutS_TV()

Returns the (thread_idx, value_idx) -> (M, N) layout for the source tensor.

get_layoutD_TV()

Returns the (thread_idx, value_idx) -> (M, N) layout for the destination tensor.

Retiling

retile()

Retiles a tensor according to the TiledCopy’s value layout.

ThrCopy - Per-Thread Copy

Represents the copy operation for a single thread.

ThrCopy Methods

partition_S()

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

partition_D()

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

retile_S()

Retiles the source tensor according to the copy pattern.

retile_D()

Retiles the destination tensor according to the copy pattern.

Common Copy Atoms

Ampere (SM80)

Hopper (SM90)

Factory Functions

make_tiled_copy()

Creates a TiledCopy from a copy atom, thread-value layout, and tiler shape. Parameters:
  • copy_atom: The atomic copy operation
  • layout_tv: (thread, value) layout
  • tiler_mn: Shape to tile in (M, N) dimensions
Example:

Usage Examples

Basic TiledCopy Setup

Global to Shared Memory Copy

Shared to Register Copy

Multi-Stage Pipeline with TiledCopy

TMA Copy (Hopper SM90)

Custom Copy Pattern

See Also