Overview
cute::Layout is the fundamental abstraction in CuTe for describing the mapping between logical multi-dimensional coordinates and linear memory offsets. A Layout is defined by a Shape (extents in each dimension) and a Stride (steps between adjacent elements in each dimension).
Class Template
Template Parameters
IntTuple
The shape of the layout, specifying the extent in each mode. Can be a single integer or a hierarchical tuple of integers.
IntTuple
default:"LayoutLeft::Apply<Shape>"
The stride of the layout, specifying the step size in each mode. Defaults to column-major (LayoutLeft) ordering.
Source Location
include/cute/layout.hpp:98-311
Member Functions
Accessors
shape()
stride()
Mapping Operations
operator()
_ (underscore).
Parameters:
coord: Logical coordinate (single integer or tuple)
Composition
compose()
result(c) = this(other(c)).
Example:
with_shape()
Tiling
tile()
Coordinate Conversion
get_hier_coord()
get_flat_coord()
get_1d_coord()
Factory Functions
make_layout()
make_identity_layout()
layout(i) = i.
make_layout_like()
Utility Functions
size()
rank()
depth()
cosize()
coalesce()
filter()
complement()
right_inverse()
layout(result(i)) == i.
Common Layout Types
LayoutLeft
Column-major (Fortran-style) layout where the first mode has stride-1.LayoutRight
Row-major (C-style) layout where the last mode has stride-1.Usage Examples
Basic Layout Creation
Hierarchical Layouts
Slicing and Tiling
Working with Strides
See Also
- cute::Tensor - Tensor type that combines Layout with data
- cute::TiledMma - Tiled matrix multiply operations
- cute::TiledCopy - Tiled copy operations