Skip to main content

Mojo struct

TileWriterRegular

@register_passable(trivial) struct TileWriterRegular[dtype: DType, dst_layout: Layout, dst_address_space: AddressSpace, dst_element_layout: Layout, dst_layout_int_type: DType, dst_linear_idx_type: DType, dst_masked: Bool, dst_alignment: Int, //, thread_layout: Layout, swizzle: Swizzle, simd_size: Int, use_x2_for_last_iter: Bool = False]

Fields

  • dst (LayoutTensor[dtype, dst_layout, MutableAnyOrigin, address_space=dst_address_space, element_layout=dst_element_layout, layout_int_type=dst_layout_int_type, linear_idx_type=dst_linear_idx_type, masked=dst_masked, alignment=dst_alignment]):
  • thread_idx (UInt):

Implemented traits

AnyType, Copyable, ImplicitlyCopyable, Movable, TileWriter, UnknownDestructibility

Aliases

__copyinit__is_trivial

alias __copyinit__is_trivial = True

__del__is_trivial

alias __del__is_trivial = True

__moveinit__is_trivial

alias __moveinit__is_trivial = True

Methods

__init__

__init__(dst: LayoutTensor[dtype, dst_layout, MutableAnyOrigin, address_space=dst_address_space, element_layout=dst_element_layout, layout_int_type=dst_layout_int_type, linear_idx_type=dst_linear_idx_type, masked=dst_masked, alignment=dst_alignment], thread_idx: UInt) -> Self

Initialize the regular tile writer.

Args:

  • dst (LayoutTensor): Destination tensor in global memory.
  • thread_idx (UInt): Thread index within the consumer warp group.

write_tile

write_tile(self, src: LayoutTensor[dtype, layout, MutableAnyOrigin, address_space=AddressSpace(3), alignment=128], coords: Tuple[UInt, UInt])

Write a tile using regular stores.

Distributes the write operation across threads with proper swizzling for optimal memory access patterns.

Args:

  • src (LayoutTensor): Source tile in shared memory.
  • coords (Tuple): Tile indices (row_tile, col_tile) in the destination matrix.

Was this page helpful?