IRON  1.0
Public Member Functions | Private Attributes | Static Private Attributes | List of all members
iron.runtime.runtime.Runtime Class Reference
Inheritance diagram for iron.runtime.runtime.Runtime:
Inheritance graph
[legend]
Collaboration diagram for iron.runtime.runtime.Runtime:
Collaboration graph
[legend]

Public Member Functions

Runtime __init__ (self)
 
def sequence (self, *type[np.ndarray] input_types)
 
RuntimeTaskGroup task_group (self)
 
def finish_task_group (self, RuntimeTaskGroup task_group)
 
None fill (self, ObjectFifoHandle in_fifo, RuntimeData source, TensorAccessPattern|None tap=None, RuntimeTaskGroup|None task_group=None, bool wait=False, PlacementTile placement=AnyShimTile)
 
None drain (self, ObjectFifoHandle out_fifo, RuntimeData dest, TensorAccessPattern|None tap=None, RuntimeTaskGroup|None task_group=None, bool wait=False, PlacementTile placement=AnyShimTile)
 
def start (self, *Worker args)
 
def inline_ops (self, Callable inline_func, list inline_args)
 
list[Workerworkers (self)
 
list[ObjectFifoHandlefifos (self)
 
None resolve (self, ir.Location|None loc=None, ir.InsertionPoint|None ip=None)
 

Private Attributes

 _rt_data
 
 _fifos
 
 _workers
 
 _open_task_groups
 

Static Private Attributes

int __task_group_index = 0
 

Detailed Description

A Runtime contains that operations and structure of all operations that
need to be taken care of by the host/runtime in order to run a program.
This is used to generate unique task group ids

Constructor & Destructor Documentation

◆ __init__()

Runtime iron.runtime.runtime.Runtime.__init__ (   self)
Initialize a runtime object.

Member Function Documentation

◆ drain()

None iron.runtime.runtime.Runtime.drain (   self,
ObjectFifoHandle  out_fifo,
RuntimeData  dest,
TensorAccessPattern | None   tap = None,
RuntimeTaskGroup | None   task_group = None,
bool   wait = False,
PlacementTile   placement = AnyShimTile 
)
Conceptually fill an ObjectFifoHandle (of type consumer) of data and write that data to a runtime buffer.
This should be called within a Runtime.sequence() context.

Args:
    out_fifo (ObjectFifoHandle): The consumer ObjectFifoHandle.
    dest (RuntimeData): The output Runtime data buffer.
    tap (TensorAccessPattern | None, optional): A way of specifying how data in the buffer is accessed when sending it to the in_fifo.
        If None is given, this will default to a linear transfer containing all data in the source buffer. Defaults to None.
    task_group (RuntimeTaskGroup | None, optional):  A TaskGroup to associate this task with. Defaults to None. Defaults to None.
    wait (bool, optional): Whether this Task should be awaited on or not. If not, it will be freed when the task group is finished. Defaults to False.
    placement (PlacementTile, optional): The Shim tile to associate the data transfer with. Defaults to AnyShimTile.

Raises:
    ValueError: Arguments are validated.

◆ fifos()

list[ObjectFifoHandle] iron.runtime.runtime.Runtime.fifos (   self)
The ObjectFifoHandles associated with the Runtime by calls to fill() and drain()

◆ fill()

None iron.runtime.runtime.Runtime.fill (   self,
ObjectFifoHandle  in_fifo,
RuntimeData  source,
TensorAccessPattern | None   tap = None,
RuntimeTaskGroup | None   task_group = None,
bool   wait = False,
PlacementTile   placement = AnyShimTile 
)
Conceptually fill an ObjectFifoHandle (of type producer) with data from a runtime buffer.
This should be called within a Runtime.sequence() context.

Args:
    in_fifo (ObjectFifoHandle): The producer ObjectFifoHandle.
    source (RuntimeData): The input Runtime data buffer.
    tap (TensorAccessPattern | None, optional): A way of specifying how data in the buffer is accessed when sending it to the in_fifo.
        If None is given, this will default to a linear transfer containing all data in the source buffer. Defaults to None.
    task_group (RuntimeTaskGroup | None, optional): A TaskGroup to associate this task with. Defaults to None.
    wait (bool, optional): Whether this Task should be awaited on or not. If not, it will be freed when the task group is finished. Defaults to False.
    placement (PlacementTile, optional): The Shim tile to associate the data transfer with. Defaults to AnyShimTile.

Raises:
    ValueError: Arguments are validated.

◆ finish_task_group()

def iron.runtime.runtime.Runtime.finish_task_group (   self,
RuntimeTaskGroup  task_group 
)
Close out a RuntimeTaskGroup.
This should be called within a Runtime.sequence() context.

Args:
    task_group (RuntimeTaskGroup): _description_

◆ inline_ops()

def iron.runtime.runtime.Runtime.inline_ops (   self,
Callable  inline_func,
list  inline_args 
)
Insert an InlineOpRuntimeTask into the runtime.
 This should be called within a Runtime.sequence() context.

Args:
    inline_func (Callable): The function to execute within an MLIR context.
    inline_args (list): The state the function needs to execute.

◆ resolve()

None iron.runtime.runtime.Runtime.resolve (   cls,
ir.Location | None   loc = None,
ir.InsertionPoint | None   ip = None 
)
Resolve the current object into one or more MLIR operations.
Should only be called within an MLIR context.

Args:
    loc (ir.Location | None, optional): Location is used by MLIR object during construction in some cases. Defaults to None.
    ip (ir.InsertionPoint | None, optional): InsertionPoint is used by MLIR object during construction in some cases. Defaults to None.

Reimplemented from iron.resolvable.Resolvable.

◆ sequence()

def iron.runtime.runtime.Runtime.sequence (   self,
*type[np.ndarray]  input_types 
)
A RuntimeSequence is a sequence of operations that are performed in
support of a program. Common operations include input and output data movement.

Raises:
    ValueError: Arguments are validated.
    ValueError: If task groups are not finished within the sequence() context, and error will be raised.

Yields:
    _type_: Handles to the buffers matching the input types.

◆ start()

def iron.runtime.runtime.Runtime.start (   self,
*Worker  args 
)
A placeholder operation to indicate that one or more Worker should be started on the device.
This should be called within a Runtime.sequence() context.

Args:
    *args: One or more Workers. If more than one is given, they will be started in order.

Raises:
    ValueError: Arguments are validated.

◆ task_group()

RuntimeTaskGroup iron.runtime.runtime.Runtime.task_group (   self)
Generate a handle to a RuntimeTaskGroup.
This should be called within a Runtime.sequence() context.

Returns:
    RuntimeTaskGroup: The new RuntimeTaskGroup

◆ workers()

list[Worker] iron.runtime.runtime.Runtime.workers (   self)
The workers associated with the Runtime by calls to start()

Member Data Documentation

◆ __task_group_index

int iron.runtime.runtime.Runtime.__task_group_index = 0
staticprivate

◆ _fifos

iron.runtime.runtime.Runtime._fifos
private

◆ _open_task_groups

iron.runtime.runtime.Runtime._open_task_groups
private

◆ _rt_data

iron.runtime.runtime.Runtime._rt_data
private

◆ _workers

iron.runtime.runtime.Runtime._workers
private

The documentation for this class was generated from the following file: