IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /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. /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, Deinitable, DevicePassable, ImplicitlyCopyable, 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​

__call__​

def __call__[dtype: DType, LayoutType: TensorLayout](mut self, tile_coord: Coord[*tile_coord.element_types], tile: TileTensor[dtype, LayoutType, MutAnyOrigin, Engine=tile.Engine, address_space=Self.src_address_space, linear_idx_type=tile.linear_idx_type], thread_layout: Layout) -> TileTensor[dtype, LayoutType, MutAnyOrigin, Engine=tile.Engine, 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.

Args:

  • ​tile_coord (Coord[*tile_coord.element_types]): Absolute element coord of this sub-tile's top-left in the global output tensor — consistent with TileConsumer.__call__ and ElementwiseComputeFn.
  • ​tile (TileTensor[dtype, LayoutType, MutAnyOrigin, Engine=tile.Engine, address_space=Self.src_address_space, linear_idx_type=tile.linear_idx_type]): Per-warp tile (kernel side passes a TileTensor view over the per-thread register storage; tile.static_shape is the warp tile shape).
  • ​thread_layout (Layout): Logical layout of the threads collaborating on this call. Passed as a value (its static dims are comptime-readable via type_of(thread_layout)), so the kernel states "this call runs over these threads" the way the tile argument states "this tile is M x N". Impls that load aux inputs use it (e.g. to build a load copier) and should comptime assert it is static.

Returns:

TileTensor[dtype, LayoutType, MutAnyOrigin, Engine=tile.Engine, 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

Was this page helpful?