Worker and WorkerRuntimeBarrier: compute-core tasks and runtime synchronization primitives.
| 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.
| 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.