IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).

Mojo struct

ProducerView

struct ProducerView[origin: MutOrigin, ring_buffer_type: AnyStruct[RingBuffer[ring_buffer_type.dtype, ring_buffer_type.layout, ring_buffer_type.pipeline_stages, ring_buffer_type.block_rows, ring_buffer_type.block_cols, ring_buffer_type.warp_rows, ring_buffer_type.warp_cols, ring_buffer_type.reads_per_warp_block, ring_buffer_type.tile_buffers, ring_buffer_type.sync_strategy_type]], warps_processed_per_producer: Int]

Producer view of the unified ring buffer.

Parameters​

  • ​origin (MutOrigin): Memory origin for pointers to the underlying ring buffer.
  • ​ring_buffer_type (AnyStruct[RingBuffer[ring_buffer_type.dtype, ring_buffer_type.layout, ring_buffer_type.pipeline_stages, ring_buffer_type.block_rows, ring_buffer_type.block_cols, ring_buffer_type.warp_rows, ring_buffer_type.warp_cols, ring_buffer_type.reads_per_warp_block, ring_buffer_type.tile_buffers, ring_buffer_type.sync_strategy_type]]): The RingBuffer type accessed through this view.
  • ​warps_processed_per_producer (Int): Number of warps each producer processes per pipeline stage.

Fields​

  • ​ring_buffer_ptr (ProducerView[origin, ring_buffer_type, warps_processed_per_producer].RingBufferPtrType):
  • ​phases (StaticTuple[Int32, (pipeline_stages * warps_processed_per_producer)]):

Implemented traits​

AnyType, Copyable, ImplicitlyCopyable, ImplicitlyDeletable, Movable, RegisterPassable, TrivialRegisterPassable

comptime members​

ProducerTileType​

comptime ProducerTileType = ProducerTile[origin, ring_buffer_type, warps_processed_per_producer]

RingBufferPtrType​

comptime RingBufferPtrType = Pointer[ring_buffer_type, origin, _safe=True]

Methods​

__init__​

def __init__(ring_buffer_ptr: Pointer[ring_buffer_type, origin, _safe=True]) -> Self

__enter__​

def __enter__(mut self) -> Self

Context manager entry.

__exit__​

def __exit__(mut self)

Context manager exit.

acquire_tiles​

def acquire_tiles(mut self, stage: Int, producer_iteration: Int, warp_tile_idx: Int) -> ring_buffer_type.WarpTileTupleType

Acquire tiles for writing by this producer.

Args:

  • ​stage (Int): Pipeline stage to write to.
  • ​producer_iteration (Int): Which iteration this producer is on (0 to warps_processed_per_producer - 1).
  • ​warp_tile_idx (Int): Which tile this producer is responsible for.

Returns:

ring_buffer_type.WarpTileTupleType

release_tiles​

def release_tiles(mut self, stage: Int, warp_tile_idx: Int)

Signal to consumers that tile is ready.

Args:

  • ​stage (Int): Pipeline stage of the tile to release.
  • ​warp_tile_idx (Int): Index of the warp tile within the stage to release.

get_tile​

def get_tile(mut self, stage: Int, warp_tile_idx: Int, producer_iteration: Int) -> Self.ProducerTileType

Get a context manager for accessing a tile.

Args:

  • ​stage (Int): Pipeline stage.
  • ​warp_tile_idx (Int): Which tile to access.
  • ​producer_iteration (Int): Current iteration of this producer.

Returns:

Self.ProducerTileType

Was this page helpful?