Mojo struct
SchedulerWorkIterator
struct SchedulerWorkIterator[num_stages: Int, cluster_shape: IndexList[3, element_type=DType.uint32], rasterize_order: RasterOrder, block_swizzle_size: Int]
Work iterator for Scheduler warp - owns work_info and both pipeline states.
The Scheduler warp uniquely needs to:
- Consume work responses (like other warps) via next
- Signal throttle and produce new work requests via signal_and_advance()
- Drain pending requests at exit via drain()
Usage: var sched_iter = scheduler.scheduler_iterator() for _ in sched_iter: sched_iter.signal_and_advance() sched_iter.drain()
Fields
- scheduler (
SchedulerWorkIterator[num_stages, cluster_shape, rasterize_order, block_swizzle_size].SchedulerType): - work_info (
WorkInfo): - consumer_state (
PipelineState[num_stages]): - producer_state (
PipelineState[num_stages]): - throttle_pipeline (
SchedulerWorkIterator[num_stages, cluster_shape, rasterize_order, block_swizzle_size].ThrottlePipeline): - needs_fetch (
Bool):
Implemented traits
AnyType,
Copyable,
ImplicitlyDestructible,
Iterable,
Iterator,
Movable,
RegisterPassable
comptime members
Element
comptime Element = WorkInfo
IteratorType
comptime IteratorType[iterable_mut: Bool, //, iterable_origin: Origin[mut=iterable_mut]] = SchedulerWorkIterator[num_stages, cluster_shape, rasterize_order, block_swizzle_size]
Parameters
SchedulerType
comptime SchedulerType = TileScheduler[num_stages, cluster_shape, rasterize_order, block_swizzle_size]
ThrottlePipeline
comptime ThrottlePipeline = SchedulerWorkIterator[num_stages, cluster_shape, rasterize_order, block_swizzle_size].SchedulerType.ThrottlePipeline
Methods
__init__
__init__(scheduler: TileScheduler[num_stages, cluster_shape, rasterize_order, block_swizzle_size], work_info: WorkInfo) -> Self
Create scheduler iterator. Throttle pipeline from scheduler.
__iter__
__iter__(ref self) -> Self
__next__
__next__(mut self) -> WorkInfo
Return current work item, deferring fetch to next call.
Returns:
WorkInfo
Raises:
StopIteration: When there is no more work to process.
signal_and_advance
signal_and_advance(mut self)
Signal CLC throttle consumer and advance to next work request.
Combines two operations that always happen together in Scheduler warp:
- Signal throttle consumer (tells Load warp we've consumed a response)
- Issue next CLC work request (producer side)
drain
drain(mut self)
Drain all pending CLC requests before kernel exit.
Must be called after the work loop completes to ensure all CLC pipeline stages are properly synchronized before exit.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!