Skip to main content

Mojo struct

ProducerTiles

@register_passable(trivial) struct ProducerTiles[a_type: DType, b_type: DType, a_tile_layout: Layout, b_tile_layout: Layout, num_pipeline_stages: Int, num_consumers: Int, cluster_size: Int, use_async_copy: Bool, //, origin: MutableOrigin, ring_buffer_type: AnyStruct[RingBuffer[a_type, b_type, a_tile_layout, b_tile_layout, num_pipeline_stages, num_consumers, cluster_size, use_async_copy]]]

Context manager for producer access to ring buffer tiles.

This struct provides safe access to a single tile slot in the ring buffer for the producer to fill. It automatically handles barrier synchronization when entering and exiting the context.

Fields

  • ring_buffer_ptr (Pointer[ring_buffer_type, origin]):
  • barrier (UnsafePointer[SharedMemBarrier, address_space=AddressSpace(3)]):
  • a_tile (LayoutTensor[a_type, a_tile_layout, MutableAnyOrigin, address_space=AddressSpace(3), layout_int_type=_get_index_type(AddressSpace(3)), linear_idx_type=_get_index_type(AddressSpace(3)), alignment=128]):
  • b_tile (LayoutTensor[b_type, b_tile_layout, MutableAnyOrigin, address_space=AddressSpace(3), layout_int_type=_get_index_type(AddressSpace(3)), linear_idx_type=_get_index_type(AddressSpace(3)), alignment=128]):

Implemented traits

AnyType, Copyable, ImplicitlyCopyable, Movable, 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

ATileType

alias ATileType = LayoutTensor[a_type, a_tile_layout, MutableAnyOrigin, address_space=AddressSpace(3), layout_int_type=_get_index_type(AddressSpace(3)), linear_idx_type=_get_index_type(AddressSpace(3)), alignment=128]

BTileType

alias BTileType = LayoutTensor[b_type, b_tile_layout, MutableAnyOrigin, address_space=AddressSpace(3), layout_int_type=_get_index_type(AddressSpace(3)), linear_idx_type=_get_index_type(AddressSpace(3)), alignment=128]

RingBufferPtrType

alias RingBufferPtrType = Pointer[ring_buffer_type, origin]

Methods

__init__

__init__(ring_buffer_ptr: Pointer[ring_buffer_type, origin]) -> Self

__enter__

__enter__(mut self) -> Self

__exit__

__exit__(mut self)

Was this page helpful?