Skip to main content

Mojo struct

RingBufferConsumer

@register_passable(trivial) struct RingBufferConsumer[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]]]

Consumer view of the ring buffer.

This struct provides the consumer interface to the ring buffer, allowing consumers to wait for and access tiles loaded by the producer. It handles the initial barrier arrival when entering the consumer context.

Fields

  • ring_buffer_ptr (Pointer[ring_buffer_type, origin]):

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

get_tiles

get_tiles(mut self) -> ConsumerTiles[origin, ring_buffer_type]

Get a context manager for accessing the next available tile.

Returns:

ConsumerTiles

Was this page helpful?