Skip to main content

Mojo struct

RingBufferProducer

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

Producer view of the ring buffer.

This struct provides the producer interface to the ring buffer, allowing the producer to wait for empty slots and fill them with new tiles.

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) -> ProducerTiles[origin, ring_buffer_type]

Get a context manager for accessing the next empty tile slot.

Returns:

ProducerTiles

Was this page helpful?