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

Public Member Functions

None __init__ (self, str name, str|None object_file_name=None, str|None source_file=None, str|None source_string=None, list[type[np.ndarray]|np.dtype] arg_types=[], list[str] include_dirs=[], list[str] compile_flags=[])
 
 __enter__ (self)
 
 __exit__ (self, exc_type, exc_value, traceback)
 
str bin_name (self)
 
int tile_size (self, int arg_index=0)
 
list arg_types (self)
 
None resolve (self, ir.Location|None loc=None, ir.InsertionPoint|None ip=None)
 
 __call__ (self, *args, **kwargs)
 

Protected Member Functions

None _setup_source (self, str|None source_file, str|None source_string)
 

Protected Attributes

 _include_dirs
 
 _compile_flags
 
 _object_file_name
 
 _compiled
 
 _source_file
 
 _source_string
 
 _op
 
- Protected Attributes inherited from iron.kernel.BaseKernel
 _name
 
 _arg_types
 
 _op
 

Static Protected Attributes

 _instances = set()
 

Constructor & Destructor Documentation

◆ __init__()

None iron.kernel.ExternalFunction.__init__ (   self,
str  name,
str | None   object_file_name = None,
str | None   source_file = None,
str | None   source_string = None,
list[type[np.ndarray] | np.dtype]   arg_types = [],
list[str]   include_dirs = [],
list[str]   compile_flags = [] 
)
An ExternalFunction is a C/C++ source file that gets compiled to an object file and eventually resolves to a FuncOp.
If it is called, a CallOp will be generated.

Args:
    name (str): The name of the function
    object_file_name (str, optional): The name of the object file. If None, it will be name.o.
    source_file (str): Path to the C/C++ source file
    source_string (str): C/C++ source code as a string
    arg_types (list[type[np.ndarray] | np.dtype], optional): The type signature of the function. Defaults to [].
    include_dirs (list[str], optional): Additional include directories. Defaults to [].
    compile_flags (list[str], optional): Additional compilation flags. Defaults to [].

Reimplemented from iron.kernel.BaseKernel.

Member Function Documentation

◆ __call__()

iron.kernel.ExternalFunction.__call__ (   self,
args,
**  kwargs 
)
Call the kernel with the given arguments.

Reimplemented from iron.kernel.BaseKernel.

◆ __enter__()

iron.kernel.ExternalFunction.__enter__ (   self)
Enter the context.

◆ __exit__()

iron.kernel.ExternalFunction.__exit__ (   self,
  exc_type,
  exc_value,
  traceback 
)
Exit the context.

◆ _setup_source()

None iron.kernel.ExternalFunction._setup_source (   self,
str | None  source_file,
str | None  source_string 
)
protected
Set up the source file for compilation.

◆ arg_types()

list iron.kernel.ExternalFunction.arg_types (   self)
Get the argument types of the ExternalFunction.

◆ bin_name()

str iron.kernel.ExternalFunction.bin_name (   self)

◆ resolve()

None iron.kernel.ExternalFunction.resolve (   self,
ir.Location | None   loc = None,
ir.InsertionPoint | None   ip = None 
)
Resolve the kernel to a FuncOp. Must be implemented by subclasses.

Reimplemented from iron.kernel.BaseKernel.

◆ tile_size()

int iron.kernel.ExternalFunction.tile_size (   self,
int   arg_index = 0 
)
Get the tile size from the specified array argument type.

Args:
    arg_index (int): Index of the argument to get tile size from. Defaults to 0.

Returns:
    int: The tile size (first dimension) of the specified argument.

Member Data Documentation

◆ _compile_flags

iron.kernel.ExternalFunction._compile_flags
protected

◆ _compiled

iron.kernel.ExternalFunction._compiled
protected

◆ _include_dirs

iron.kernel.ExternalFunction._include_dirs
protected

◆ _instances

iron.kernel.ExternalFunction._instances = set()
staticprotected

◆ _object_file_name

iron.kernel.ExternalFunction._object_file_name
protected

◆ _op

iron.kernel.ExternalFunction._op
protected

◆ _source_file

iron.kernel.ExternalFunction._source_file
protected

◆ _source_string

iron.kernel.ExternalFunction._source_string
protected

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