Skip to main content

Mojo struct

ConsumerTiles

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

Context manager for consumer access to ring buffer tiles.

This struct provides safe access to a single tile slot in the ring buffer for consumers to read. It tracks the read index and automatically releases the slot when exiting the context.

Fields

  • ring_buffer_ptr (Pointer[ring_buffer_type, origin]):
  • read_idx (UInt32):
  • a_tile (LayoutTensor[a_type, a_tile_layout, MutableAnyOrigin, address_space=AddressSpace.SHARED, alignment=NVIDIASharedMemoryBasePtr.alignment]):
  • b_tile (LayoutTensor[b_type, b_tile_layout, MutableAnyOrigin, address_space=AddressSpace.SHARED, alignment=NVIDIASharedMemoryBasePtr.alignment]):

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

ATile

alias ATile = ring_buffer_type.ATile

BTile

alias BTile = ring_buffer_type.BTile

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?