mlir.dialects.func¶
Attributes¶
Classes¶
Specialization for the constant op class. |
|
Specialization for the func op class. |
|
Specialization for the call op class. |
Module Contents¶
- mlir.dialects.func.ARGUMENT_ATTRIBUTE_NAME = 'arg_attrs'¶
- mlir.dialects.func.RESULT_ATTRIBUTE_NAME = 'res_attrs'¶
- class mlir.dialects.func.ConstantOp(result, value, *, loc=None, ip=None)¶
Bases:
ConstantOpSpecialization for the constant op class.
- property type¶
- class mlir.dialects.func.FuncOp(name, type, *, visibility=None, body_builder=None, loc=None, ip=None)¶
Bases:
FuncOpSpecialization for the func op class.
- property is_external¶
- property body¶
- property type¶
- property visibility¶
- property name: StringAttr¶
Returns the fully qualified name of the operation.
- property entry_block¶
- add_entry_block(arg_locs: Sequence[Location] | None = None)¶
Add an entry block to the function body using the function signature to infer block arguments. Returns the newly created block
- property arg_attrs¶
- property arguments¶
- property result_attrs¶
- classmethod from_py_func(*inputs: Type, results: Sequence[Type] | None = None, name: str | None = None)¶
Decorator to define an MLIR FuncOp specified as a python function.
Requires that an
mlir.ir.InsertionPointandmlir.ir.Locationare active for the current thread (i.e. established in awithblock).When applied as a decorator to a Python function, an entry block will be constructed for the FuncOp with types as specified in
*inputs. The block arguments will be passed positionally to the Python function. In addition, if the Python function accepts keyword arguments generally or has a corresponding keyword argument, the following will be passed:func_op: Thefuncop being defined.
By default, the function name will be the Python function
__name__. This can be overriden by passing thenameargument to the decorator.If
resultsis not specified, then the decorator will implicitly insert aReturnOpwith theValue’s returned from the decorated function. It will also set theFuncOptype with the actual return value types. Ifresultsis specified, then the decorated function must returnNoneand no implicitReturnOpis added (nor are the result types updated). The implicit behavior is intended for simple, single-block cases, and users should specify result types explicitly for any complicated cases.The decorated function can further be called from Python and will insert a
CallOpat the then-current insertion point, returning either None ( if no return values), a unary Value (for one result), or a list of Values). This mechanism cannot be used to emit recursive calls (by construction).
- mlir.dialects.func.func¶
- class mlir.dialects.func.CallOp(calleeOrResults: FuncOp | List[Type], argumentsOrCallee: List | FlatSymbolRefAttr | str, arguments: List | None = None, *, loc=None, ip=None)¶
Bases:
CallOpSpecialization for the call op class.