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
SchedulerWorkIterator
struct SchedulerWorkIterator[num_stages: Int, cluster_shape: IndexList[Int(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()
Parametersβ
- βnum_stages (
Int): Number of CLC pipeline stages for work distribution. - βcluster_shape (
IndexList[Int(3), element_type=DType.uint32]): Cluster tile counts as(m, n, k). - βrasterize_order (
RasterOrder): Order CLC rasterizes tiles across the cluster grid. - βblock_swizzle_size (
Int): Block swizzle factor for tile remapping, one of 0, 1, 2, 4, or 8.
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,
ImplicitlyDeletable,
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β
- βiterable_mut (
Bool): - βiterable_origin (
Origin[mut=iterable_mut]):
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__β
def __init__(scheduler: TileScheduler[num_stages, cluster_shape, rasterize_order, block_swizzle_size], work_info: WorkInfo) -> Self
Create scheduler iterator. Throttle pipeline from scheduler.
Args:
- βscheduler (
TileScheduler[num_stages, cluster_shape, rasterize_order, block_swizzle_size]): TileScheduler owning the CLC and throttle state. - βwork_info (
WorkInfo): Initial work item for the iterator.
__iter__β
def __iter__(ref self) -> Self
__next__β
def __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β
def 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β
def 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!