Mojo struct
ConsumerView
struct ConsumerView[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_computed_per_consumer: Int]
Consumer view of the unified ring buffer.
Fieldsβ
- βring_buffer_ptr (
ConsumerView[origin, ring_buffer_type, warps_computed_per_consumer].RingBufferPtrType): - βphases (
StaticTuple[Int32, (pipeline_stages * warps_computed_per_consumer)]):
Implemented traitsβ
AnyType,
Copyable,
ImplicitlyCopyable,
ImplicitlyDestructible,
Movable,
RegisterPassable,
TrivialRegisterPassable
comptime membersβ
ConsumerTileTypeβ
comptime ConsumerTileType = ConsumerTile[origin, ring_buffer_type, warps_computed_per_consumer]
RingBufferPtrTypeβ
comptime RingBufferPtrType = Pointer[ring_buffer_type, origin]
Methodsβ
__init__β
__init__(ring_buffer_ptr: Pointer[ring_buffer_type, origin]) -> Self
__enter__β
__enter__(mut self) -> Self
Context manager entry.
__exit__β
__exit__(mut self)
Context manager exit.
acquire_tilesβ
acquire_tiles(mut self, stage: Int, consumer_iteration: Int, warp_tile_idx: Int) -> ring_buffer_type.WarpTileTupleType
Acquire tiles for reading by this consumer.
Args:
- βstage (
Int): Pipeline stage to read from. - βconsumer_iteration (
Int): Which iteration this consumer is on (0 to warps_computed_per_consumer-1). - βwarp_tile_idx (
Int): Which tile this consumer wants to read.
Returns:
ring_buffer_type.WarpTileTupleType
release_tilesβ
release_tiles(mut self, stage: Int, warp_tile_idx: Int)
Signal to producers that tile is free.
get_tileβ
get_tile(mut self, stage: Int, consumer_iteration: Int, warp_tile_idx: Int) -> ConsumerView[origin, ring_buffer_type, warps_computed_per_consumer].ConsumerTileType
Get a context manager for accessing a tile.
Args:
- βstage (
Int): Pipeline stage. - βconsumer_iteration (
Int): Current iteration of this consumer. - βwarp_tile_idx (
Int): Which tile to access.
Returns:
ConsumerView[origin, ring_buffer_type, warps_computed_per_consumer].ConsumerTileType
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!