Skip to main content
The CuTe DSL provides comprehensive memory management APIs for creating and manipulating tensors across different memory spaces (global, shared, register).

Tensor Creation

make_tensor

Creates a tensor from a pointer and layout.
Pointer
required
Pointer to memory (global, shared, or register)
Layout
required
Layout defining shape and stride
Example:

make_fragment

Allocates a register memory tensor (fragment).
Type[Numeric]
required
Element data type (e.g., cute.Float32, cute.BFloat16)
Layout
required
Layout of the fragment
Example:

make_fragment_like

Allocates a fragment with the same shape as another tensor.
Tensor
required
Template tensor
Example:

make_rmem_tensor

Allocates register memory tensor.
Alias for make_fragment.

make_rmem_tensor_like

Allocates register memory tensor matching another tensor.
Alias for make_fragment_like.

Tensor Initialization

zeros_like

Creates a tensor initialized to zero.
Example:

ones_like

Creates a tensor initialized to one.

full

Creates a tensor filled with a specific value.
Layout
required
Tensor layout
Numeric
required
Fill value
Type[Numeric]
required
Element data type

full_like

Creates a tensor filled with a value, matching another tensor’s shape.
Example:

empty_like

Allocates an uninitialized tensor matching another tensor’s shape.

Pointer Operations

make_ptr

Creates a typed pointer from raw memory address.
Union[int, Tensor]
required
Memory address or tensor
Type[Numeric]
required
Element data type
AddressSpace
default:"GLOBAL"
Memory address space
Example:

recast_ptr

Recasts a pointer to a different element type.
Pointer
required
Original pointer
Type[Numeric]
required
New element data type
Example:

Layout Operations

make_layout

Creates a layout from shape and stride.
Shape
required
Shape tuple (can be nested)
Stride
default:"compact"
Stride tuple (defaults to compact row-major)
Examples:

make_identity_layout

Creates an identity layout (coordinate layout).
Example:

make_ordered_layout

Creates a layout with specified dimension ordering.

make_layout_like

Creates a layout matching another layout’s shape.

recast_layout

Recasts a layout to a different element type.
Example:

Identity and Coordinate Tensors

make_identity_tensor

Creates a coordinate tensor for bounds checking.
Shape
required
Tensor shape
Example:

Tensor Recasting

recast_tensor

Recasts a tensor to a different element type.
Tensor
required
Original tensor
Type[Numeric]
required
New element data type
Example:

Memory Space Management

Address Spaces

Tensor Partitioning

Partition by Tiled Copy

Partition by Tiled MMA

Complete Example: Memory Management

See Also