IRON 1a5eed49d3c0721a318ac369f725acc96b7c4584
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
iron.kernel.BaseKernel Class Reference
Inheritance diagram for iron.kernel.BaseKernel:
Inheritance graph
[legend]
Collaboration diagram for iron.kernel.BaseKernel:
Collaboration graph
[legend]

Public Member Functions

 __init__ (self, str name, list[type[np.ndarray]|np.dtype]|None arg_types=None)
 
tuple[int,...] arg_shape (self, int arg_index=0)
 
 arg_dtype (self, int arg_index=0)
 
int tile_size (self, int arg_index=0)
 
list arg_types (self)
 
 __call__ (self, *args, **kwargs)
 
- Public Member Functions inherited from iron.resolvable.Resolvable
None resolve (self, ir.Location|None loc=None, ir.InsertionPoint|None ip=None)
 
list tiles (self)
 

Protected Member Functions

 _resolve_arg (self, int arg_index)
 

Protected Attributes

 _name
 
 _arg_types
 
 _op
 

Detailed Description

Base class for AIE core functions that resolve to a func.func declaration.

Subclasses:
    Kernel: wraps a pre-compiled object file.
    ExternalFunction: compiles C/C++ source at JIT time.

Constructor & Destructor Documentation

◆ __init__()

iron.kernel.BaseKernel.__init__ (   self,
str  name,
list[type[np.ndarray] | np.dtype] | None   arg_types = None 
)
Args:
    name: Symbol name of the function.
    arg_types: Type signature of the function arguments.  Defaults to None (empty list).

Reimplemented in iron.kernel.Kernel, and iron.kernel.ExternalFunction.

Member Function Documentation

◆ __call__()

iron.kernel.BaseKernel.__call__ (   self,
args,
**  kwargs 
)
Emit a func.call to this kernel, validating argument count.

Each argument is passed through :func:`_maybe_collapse_to_match`
before the call.  This silently inserts a ``memref.collapse_shape``
when an N-D contiguous memref arg is being fed into a 1-D kernel
signature with the same element count and dtype — the typical case
when an iron design holds 2-D ObjectFifo elements but the
``aie.iron.kernels.X`` helper declares a flat 1-D arg.  See that
helper's docstring for the full set of conditions.  Real shape /
dtype mismatches still fail at MLIR verification time.

``**kwargs`` are forwarded to the underlying ``func.call`` builder
(typically ``loc=``, ``ip=`` for MLIR location / insertion point).

Reimplemented in iron.kernel.ExternalFunction.

◆ _resolve_arg()

iron.kernel.BaseKernel._resolve_arg (   self,
int  arg_index 
)
protected
Validate ``arg_index`` and return the underlying type entry.

◆ arg_dtype()

iron.kernel.BaseKernel.arg_dtype (   self,
int   arg_index = 0 
)
Return the numpy dtype of the array argument at ``arg_index``.

Args:
    arg_index: Index into ``arg_types``.  Defaults to 0.

Raises:
    ValueError: When ``arg_index`` is out of range or the
        argument at that index is not an array type.

◆ arg_shape()

tuple[int, ...] iron.kernel.BaseKernel.arg_shape (   self,
int   arg_index = 0 
)
Return the shape tuple of the array argument at ``arg_index``.

Works for both ``np.ndarray[(...,), np.dtype[T]]`` parameterized
types (the canonical iron kernel signature) and MLIR MemRefType
operands.

Args:
    arg_index: Index into ``arg_types``.  Defaults to 0.

Raises:
    ValueError: When ``arg_index`` is out of range or the
        argument at that index is not an array type.

◆ arg_types()

list iron.kernel.BaseKernel.arg_types (   self)
Return a copy of the argument type list.

◆ tile_size()

int iron.kernel.BaseKernel.tile_size (   self,
int   arg_index = 0 
)
Return the first dimension of the array argument at ``arg_index``.

Convenience wrapper over :meth:`arg_shape` for the common case of
a 1-D buffer argument.  ``tile_size(i)`` is equivalent to
``arg_shape(i)[0]``.

Args:
    arg_index: Index into ``arg_types``.  Defaults to 0.

Member Data Documentation

◆ _arg_types

iron.kernel.BaseKernel._arg_types
protected

◆ _name

iron.kernel.BaseKernel._name
protected

◆ _op

iron.kernel.BaseKernel._op
protected

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