IRON 1a5eed49d3c0721a318ac369f725acc96b7c4584
Loading...
Searching...
No Matches
Classes | Functions | Variables
iron.worker Namespace Reference

Classes

class  _BarrierSetOp
 
class  WorkerRuntimeBarrier
 

Functions

 __init__ (self, Callable|None core_fn, list|None fn_args=None, Tile tile=AnyComputeTile, bool while_true=True, int|None stack_size=None, str|None allocation_scheme=None, int|None trace=None, list|None trace_events=None, bool|None dynamic_objfifo_lowering=None)
 
list[list["Worker"]] grid (int rows, int cols, Callable[[int, int], "Worker"] factory)
 
Tile tile (self)
 
list[ObjectFifoHandlefifos (self)
 
list[Bufferbuffers (self)
 
None resolve (self, ir.Location|None loc=None, ir.InsertionPoint|None ip=None)
 

Variables

 _tile
 
 _while_true
 
 stack_size
 
 allocation_scheme
 
 _dynamic_objfifo_lowering
 
 trace
 
 trace_events
 
 core_fn
 
 fn_args
 
 _fifos
 
 _buffers
 
 _barriers
 

Detailed Description

Worker and WorkerRuntimeBarrier: compute-core tasks and runtime synchronization primitives.

Function Documentation

◆ __init__()

iron.worker.__init__ (   self,
Callable | None  core_fn,
list | None   fn_args = None,
Tile   tile = AnyComputeTile,
bool   while_true = True,
int | None   stack_size = None,
str | None   allocation_scheme = None,
int | None   trace = None,
list | None   trace_events = None,
bool | None   dynamic_objfifo_lowering = None 
)
Construct a Worker

Args:
    core_fn (Callable | None): The task to run on a core. If None, a busy-loop (`while(true): pass`) core will be generated.
    fn_args (list | None, optional): Pointers to arguments, which should include all context the core_fn needs to run. Defaults to None (empty list).
    tile (Tile, optional): The compute tile for the Worker. Also accepts None (treated as AnyComputeTile). Defaults to AnyComputeTile.
    while_true (bool, optional): If true, will wrap the core_fn in a while(true) loop to ensure it runs until reconfiguration. Defaults to True.
    stack_size (int, optional): The stack_size in bytes to be allocated for the worker. Defaults to 1024 bytes.
    allocation_scheme (str, optional): The memory allocation scheme to use for the Worker, either 'basic-sequential' or 'bank-aware'. If None, defaults to bank-aware.
        Will override any allocation scheme set on the tile.
    trace (int, optional): If >0, enable tracing for this worker.
    trace_events (list | None, optional): Custom list of trace events for this worker. Defaults to None.
    dynamic_objfifo_lowering (bool | None, optional): Per-core override for the
        ``aie-objectFifo-stateful-transform`` pass's lowering choice. ``True`` forces
        dynamic (loop-preserving) lowering for this core; ``False`` forces static
        LCM-based unrolling. ``None`` (default) leaves the choice to the compiler's
        global ``--dynamic-objFifos`` flag. Note: the per-core attribute is only
        honored when the global flag is ``false``; when global is ``true`` the
        attribute is ignored. Defaults to None.

Raises:
    ValueError: Parameters are validated.

◆ buffers()

list[Buffer] iron.worker.buffers (   self)
Returns a list of Buffers given to the Worker via fn_args.

Returns:
    list[Buffer]: Buffer used by the Worker.

◆ fifos()

list[ObjectFifoHandle] iron.worker.fifos (   self)
Returns a list of ObjectFifoHandles given to the Worker via fn_args.

Returns:
    list[ObjectFifoHandle]: ObjectFifoHandles used by the Worker.

◆ grid()

list[list["Worker"]] iron.worker.grid ( int  rows,
int  cols,
Callable[[int, int], "Worker"]  factory 
)
static
Build a 2D grid of Workers; ``factory(r, c)`` returns one Worker.

Replaces the common pattern::

    ws = [Worker(...) for i in range(R) for j in range(C)]
    ws[i * C + j]  # 1-D index arithmetic

with::

    ws = Worker.grid(R, C, lambda r, c: Worker(...))
    ws[i][j]       # natural 2-D access

Args:
    rows: Outer-dimension count (e.g. column index).
    cols: Inner-dimension count (e.g. channel index).
    factory: Called once per cell with ``(r, c)``; must return a Worker.

Returns:
    ``rows``-by-``cols`` nested list of Worker instances.

◆ resolve()

None iron.worker.resolve (   self,
ir.Location | None   loc = None,
ir.InsertionPoint | None   ip = None 
)

◆ tile()

Tile iron.worker.tile (   self)
The compute tile this Worker is placed on.

Variable Documentation

◆ _barriers

iron.worker._barriers
protected

◆ _buffers

iron.worker._buffers
protected

◆ _dynamic_objfifo_lowering

iron.worker._dynamic_objfifo_lowering
protected

◆ _fifos

iron.worker._fifos
protected

◆ _tile

iron.worker._tile
protected

◆ _while_true

iron.worker._while_true
protected

◆ allocation_scheme

iron.worker.allocation_scheme

◆ core_fn

iron.worker.core_fn

◆ fn_args

iron.worker.fn_args

◆ stack_size

iron.worker.stack_size

◆ trace

iron.worker.trace

◆ trace_events

iron.worker.trace_events