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 trait

TileOperation

Non-terminal counterpart to TileConsumer: mutates a tile in place between MMA and store. Composes additively with capability subtraits like AuxLoading for ops that need pre-loaded data.

Surface matches TileConsumer.__call__ modulo mut=True on the tile (the op writes back) and on self. The two traits are role- distinct (terminal vs non-terminal); a struct that wants to be both would need separate disambiguation, which we'll deal with if/when that comes up.

Implemented traits​

AnyType, Copyable, DevicePassable, ImplicitlyCopyable, ImplicitlyDeletable, Movable, RegisterPassable, TrivialRegisterPassable

comptime members​

device_type​

comptime device_type = _Self

src_address_space​

comptime src_address_space

AddressSpace of the tile being transformed (typically LOCAL).

Required methods​

__init__​

def __init__(out self, *, copy: Self)

Create a new instance of the value by copying an existing one.

Args:

  • ​copy (_Self): The value to copy.

Returns:

_Self

def __init__(out self, *, deinit move: Self)

Create a new instance of the value by moving the value of another.

Args:

  • ​move (_Self): The value to move.

Returns:

_Self

__call__​

def __call__[dtype: DType, LayoutType: TensorLayout](mut self, tile_coord: Coord, tile: TileTensor[dtype, LayoutType, MutAnyOrigin, Storage=tile.Storage, address_space=Self.src_address_space, linear_idx_type=tile.linear_idx_type], thread_layout: Layout) -> TileTensor[dtype, LayoutType, MutAnyOrigin, Storage=tile.Storage, address_space=Self.src_address_space, linear_idx_type=tile.linear_idx_type]

Transform tile and return it.

Returns a TileTensor of the same shape as its tile argument.

Parameters:

  • ​dtype (DType): Element type of the tile.
  • ​LayoutType (TensorLayout): Layout of the tile.

Returns:

TileTensor[dtype, LayoutType, MutAnyOrigin, Storage=tile.Storage, address_space=_Self.src_address_space, linear_idx_type=tile.linear_idx_type]

Provided methods​

get_type_name​

static def get_type_name() -> String

Returns:

String

copy​

def copy(self) -> Self

Explicitly construct a copy of self, a convenience method for Self(copy=self) when the type is inconvenient to write out.

Overriding this method is not allowed.

Returns:

_Self: A copy of this value.