Embedded MLIR API

iree.compiler.ir module

class iree.compiler.ir.AffineAddExpr
static get(arg0: iree.compiler._mlir_libs._mlir.ir.AffineExpr, arg1: iree.compiler._mlir_libs._mlir.ir.AffineExpr) iree.compiler._mlir_libs._mlir.ir.AffineAddExpr
static isinstance(other: iree.compiler._mlir_libs._mlir.ir.AffineExpr) bool
class iree.compiler.ir.AffineBinaryExpr
static isinstance(other: iree.compiler._mlir_libs._mlir.ir.AffineExpr) bool
property lhs
property rhs
class iree.compiler.ir.AffineCeilDivExpr
static get(arg0: iree.compiler._mlir_libs._mlir.ir.AffineExpr, arg1: iree.compiler._mlir_libs._mlir.ir.AffineExpr) iree.compiler._mlir_libs._mlir.ir.AffineCeilDivExpr
static isinstance(other: iree.compiler._mlir_libs._mlir.ir.AffineExpr) bool
class iree.compiler.ir.AffineConstantExpr
static get(value: int, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.AffineConstantExpr
static isinstance(other: iree.compiler._mlir_libs._mlir.ir.AffineExpr) bool
property value
class iree.compiler.ir.AffineDimExpr
static get(position: int, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.AffineDimExpr
static isinstance(other: iree.compiler._mlir_libs._mlir.ir.AffineExpr) bool
property position
class iree.compiler.ir.AffineExpr
compose(self: iree.compiler._mlir_libs._mlir.ir.AffineExpr, arg0: mlir::python::PyAffineMap) iree.compiler._mlir_libs._mlir.ir.AffineExpr
property context
dump(self: iree.compiler._mlir_libs._mlir.ir.AffineExpr) None

Dumps a debug representation of the object to stderr.

static get_add(*args, **kwargs)

Overloaded function.

  1. get_add(arg0: iree.compiler._mlir_libs._mlir.ir.AffineExpr, arg1: iree.compiler._mlir_libs._mlir.ir.AffineExpr) -> (anonymous namespace)::PyAffineAddExpr

Gets an affine expression containing a sum of two expressions.

  1. get_add(arg0: int, arg1: iree.compiler._mlir_libs._mlir.ir.AffineExpr) -> (anonymous namespace)::PyAffineAddExpr

Gets an affine expression containing a sum of a constant and another expression.

  1. get_add(arg0: iree.compiler._mlir_libs._mlir.ir.AffineExpr, arg1: int) -> (anonymous namespace)::PyAffineAddExpr

Gets an affine expression containing a sum of an expression and a constant.

static get_ceil_div(*args, **kwargs)

Overloaded function.

  1. get_ceil_div(arg0: iree.compiler._mlir_libs._mlir.ir.AffineExpr, arg1: iree.compiler._mlir_libs._mlir.ir.AffineExpr) -> (anonymous namespace)::PyAffineCeilDivExpr

Gets an affine expression containing the rounded-up result of dividing one expression by another.

  1. get_ceil_div(arg0: int, arg1: iree.compiler._mlir_libs._mlir.ir.AffineExpr) -> (anonymous namespace)::PyAffineCeilDivExpr

Gets a semi-affine expression containing the rounded-up result of dividing a constant by an expression.

  1. get_ceil_div(arg0: iree.compiler._mlir_libs._mlir.ir.AffineExpr, arg1: int) -> (anonymous namespace)::PyAffineCeilDivExpr

Gets an affine expression containing the rounded-up result of dividing an expression by a constant.

static get_constant(value: int, context: mlir.ir.Context = None) (anonymous namespace)::PyAffineConstantExpr

Gets a constant affine expression with the given value.

static get_dim(position: int, context: mlir.ir.Context = None) (anonymous namespace)::PyAffineDimExpr

Gets an affine expression of a dimension at the given position.

static get_floor_div(*args, **kwargs)

Overloaded function.

  1. get_floor_div(arg0: iree.compiler._mlir_libs._mlir.ir.AffineExpr, arg1: iree.compiler._mlir_libs._mlir.ir.AffineExpr) -> (anonymous namespace)::PyAffineFloorDivExpr

Gets an affine expression containing the rounded-down result of dividing one expression by another.

  1. get_floor_div(arg0: int, arg1: iree.compiler._mlir_libs._mlir.ir.AffineExpr) -> (anonymous namespace)::PyAffineFloorDivExpr

Gets a semi-affine expression containing the rounded-down result of dividing a constant by an expression.

  1. get_floor_div(arg0: iree.compiler._mlir_libs._mlir.ir.AffineExpr, arg1: int) -> (anonymous namespace)::PyAffineFloorDivExpr

Gets an affine expression containing the rounded-down result of dividing an expression by a constant.

static get_mod(*args, **kwargs)

Overloaded function.

  1. get_mod(arg0: iree.compiler._mlir_libs._mlir.ir.AffineExpr, arg1: iree.compiler._mlir_libs._mlir.ir.AffineExpr) -> (anonymous namespace)::PyAffineModExpr

Gets an affine expression containing the modulo of dividing one expression by another.

  1. get_mod(arg0: int, arg1: iree.compiler._mlir_libs._mlir.ir.AffineExpr) -> (anonymous namespace)::PyAffineModExpr

Gets a semi-affine expression containing the modulo of dividing a constant by an expression.

  1. get_mod(arg0: iree.compiler._mlir_libs._mlir.ir.AffineExpr, arg1: int) -> (anonymous namespace)::PyAffineModExpr

Gets an affine expression containing the module of dividingan expression by a constant.

static get_mul(*args, **kwargs)

Overloaded function.

  1. get_mul(arg0: iree.compiler._mlir_libs._mlir.ir.AffineExpr, arg1: iree.compiler._mlir_libs._mlir.ir.AffineExpr) -> (anonymous namespace)::PyAffineMulExpr

Gets an affine expression containing a product of two expressions.

  1. get_mul(arg0: int, arg1: iree.compiler._mlir_libs._mlir.ir.AffineExpr) -> (anonymous namespace)::PyAffineMulExpr

Gets an affine expression containing a product of a constant and another expression.

  1. get_mul(arg0: iree.compiler._mlir_libs._mlir.ir.AffineExpr, arg1: int) -> (anonymous namespace)::PyAffineMulExpr

Gets an affine expression containing a product of an expression and a constant.

static get_symbol(position: int, context: mlir.ir.Context = None) (anonymous namespace)::PyAffineSymbolExpr

Gets an affine expression of a symbol at the given position.

class iree.compiler.ir.AffineExprList
class iree.compiler.ir.AffineFloorDivExpr
static get(arg0: iree.compiler._mlir_libs._mlir.ir.AffineExpr, arg1: iree.compiler._mlir_libs._mlir.ir.AffineExpr) iree.compiler._mlir_libs._mlir.ir.AffineFloorDivExpr
static isinstance(other: iree.compiler._mlir_libs._mlir.ir.AffineExpr) bool
class iree.compiler.ir.AffineMap
static compress_unused_symbols(arg0: list, arg1: mlir.ir.Context) List[iree.compiler._mlir_libs._mlir.ir.AffineMap]
property context

Context that owns the Affine Map

dump(self: iree.compiler._mlir_libs._mlir.ir.AffineMap) None

Dumps a debug representation of the object to stderr.

static get(dim_count: int, symbol_count: int, exprs: list, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.AffineMap

Gets a map with the given expressions as results.

static get_constant(value: int, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.AffineMap

Gets an affine map with a single constant result

static get_empty(context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.AffineMap

Gets an empty affine map.

static get_identity(n_dims: int, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.AffineMap

Gets an identity map with the given number of dimensions.

get_major_submap(self: iree.compiler._mlir_libs._mlir.ir.AffineMap, n_results: int) iree.compiler._mlir_libs._mlir.ir.AffineMap
static get_minor_identity(n_dims: int, n_results: int, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.AffineMap

Gets a minor identity map with the given number of dimensions and results.

get_minor_submap(self: iree.compiler._mlir_libs._mlir.ir.AffineMap, n_results: int) iree.compiler._mlir_libs._mlir.ir.AffineMap
static get_permutation(permutation: List[int], context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.AffineMap

Gets an affine map that permutes its inputs.

get_submap(self: iree.compiler._mlir_libs._mlir.ir.AffineMap, result_positions: List[int]) iree.compiler._mlir_libs._mlir.ir.AffineMap
property is_permutation
property is_projected_permutation
property n_dims
property n_inputs
property n_symbols
replace(self: iree.compiler._mlir_libs._mlir.ir.AffineMap, expr: iree.compiler._mlir_libs._mlir.ir.AffineExpr, replacement: iree.compiler._mlir_libs._mlir.ir.AffineExpr, n_result_dims: int, n_result_syms: int) iree.compiler._mlir_libs._mlir.ir.AffineMap
property results
class iree.compiler.ir.AffineMapAttr
static get(affine_map: iree.compiler._mlir_libs._mlir.ir.AffineMap) iree.compiler._mlir_libs._mlir.ir.AffineMapAttr

Gets an attribute wrapping an AffineMap.

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Attribute) bool
property type
class iree.compiler.ir.AffineModExpr
static get(arg0: iree.compiler._mlir_libs._mlir.ir.AffineExpr, arg1: iree.compiler._mlir_libs._mlir.ir.AffineExpr) iree.compiler._mlir_libs._mlir.ir.AffineModExpr
static isinstance(other: iree.compiler._mlir_libs._mlir.ir.AffineExpr) bool
class iree.compiler.ir.AffineMulExpr
static get(arg0: iree.compiler._mlir_libs._mlir.ir.AffineExpr, arg1: iree.compiler._mlir_libs._mlir.ir.AffineExpr) iree.compiler._mlir_libs._mlir.ir.AffineMulExpr
static isinstance(other: iree.compiler._mlir_libs._mlir.ir.AffineExpr) bool
class iree.compiler.ir.AffineSymbolExpr
static get(position: int, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.AffineSymbolExpr
static isinstance(other: iree.compiler._mlir_libs._mlir.ir.AffineExpr) bool
property position
class iree.compiler.ir.ArrayAttr
static get(attributes: list, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.ArrayAttr

Gets a uniqued Array attribute

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Attribute) bool
property type
class iree.compiler.ir.ArrayAttributeIterator
class iree.compiler.ir.AttrBuilder
static contains(arg0: str) bool
static get(arg0: str) function
static insert(arg0: str, arg1: function) None
class iree.compiler.ir.Attribute
property context

Context that owns the Attribute

dump(self: iree.compiler._mlir_libs._mlir.ir.Attribute) None

Dumps a debug representation of the object to stderr.

get_named(self: iree.compiler._mlir_libs._mlir.ir.Attribute, arg0: str) mlir::python::PyNamedAttribute

Binds a name to the attribute

static parse(asm: str, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.Attribute

Parses an attribute from an assembly form. Raises an MLIRError on failure.

property type
class iree.compiler.ir.BF16Type
static get(context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.BF16Type

Create a bf16 type.

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Type) bool
class iree.compiler.ir.Block
append(self: iree.compiler._mlir_libs._mlir.ir.Block, operation: iree.compiler._mlir_libs._mlir.ir._OperationBase) None

Appends an operation to this block. If the operation is currently in another block, it will be moved.

append_to(self: iree.compiler._mlir_libs._mlir.ir.Block, arg0: iree.compiler._mlir_libs._mlir.ir.Region) None

Append this block to a region, transferring ownership if necessary

property arguments

Returns a list of block arguments.

create_after(self: iree.compiler._mlir_libs._mlir.ir.Block, *args) iree.compiler._mlir_libs._mlir.ir.Block

Creates and returns a new Block after this block (with given argument types).

static create_at_start(parent: iree.compiler._mlir_libs._mlir.ir.Region, arg_types: list = []) iree.compiler._mlir_libs._mlir.ir.Block

Creates and returns a new Block at the beginning of the given region (with given argument types).

create_before(self: iree.compiler._mlir_libs._mlir.ir.Block, *args) iree.compiler._mlir_libs._mlir.ir.Block

Creates and returns a new Block before this block (with given argument types).

property operations

Returns a forward-optimized sequence of operations.

property owner

Returns the owning operation of this block.

property region

Returns the owning region of this block.

class iree.compiler.ir.BlockArgument
property arg_number
static isinstance(other_value: iree.compiler._mlir_libs._mlir.ir.Value) bool
property owner
set_type(self: iree.compiler._mlir_libs._mlir.ir.BlockArgument, type: iree.compiler._mlir_libs._mlir.ir.Type) None
class iree.compiler.ir.BlockArgumentList
property types
class iree.compiler.ir.BlockIterator
class iree.compiler.ir.BlockList
append(self: iree.compiler._mlir_libs._mlir.ir.BlockList, *args) iree.compiler._mlir_libs._mlir.ir.Block

Appends a new block, with argument types as positional args.

Returns

The created block.

class iree.compiler.ir.BoolAttr
static get(value: bool, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.BoolAttr

Gets an uniqued bool attribute

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Attribute) bool
property type
property value

Returns the value of the bool attribute

class iree.compiler.ir.ComplexType
property element_type

Returns element type.

static get(arg0: iree.compiler._mlir_libs._mlir.ir.Type) iree.compiler._mlir_libs._mlir.ir.ComplexType

Create a complex type

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Type) bool
class iree.compiler.ir.Context(*args, **kwargs)
class iree.compiler.ir.DenseBoolArrayAttr
static get(values: List[int], context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.DenseBoolArrayAttr

Gets a uniqued dense array attribute

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Attribute) bool
property type
class iree.compiler.ir.DenseBoolArrayIterator
class iree.compiler.ir.DenseElementsAttr
static get(array: buffer, signless: bool = True, type: Optional[iree.compiler._mlir_libs._mlir.ir.Type] = None, shape: Optional[List[int]] = None, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.DenseElementsAttr

Gets a DenseElementsAttr from a Python buffer or array.

When type is not provided, then some limited type inferencing is done based on the buffer format. Support presently exists for 8/16/32/64 signed and unsigned integers and float16/float32/float64. DenseElementsAttrs of these types can also be converted back to a corresponding buffer.

For conversions outside of these types, a type= must be explicitly provided and the buffer contents must be bit-castable to the MLIR internal representation:

  • Integer types (except for i1): the buffer must be byte aligned to the next byte boundary.

  • Floating point types: Must be bit-castable to the given floating point size.

  • i1 (bool): Bit packed into 8bit words where the bit pattern matches a row major ordering. An arbitrary Numpy bool_ array can be bit packed to this specification with: np.packbits(ary, axis=None, bitorder=’little’).

If a single element buffer is passed (or for i1, a single byte with value 0 or 255), then a splat will be created.

Parameters
  • array – The array or buffer to convert.

  • signless – If inferring an appropriate MLIR type, use signless types for integers (defaults True).

  • type – Skips inference of the MLIR element type and uses this instead. The storage size must be consistent with the actual contents of the buffer.

  • shape – Overrides the shape of the buffer when constructing the MLIR shaped type. This is needed when the physical and logical shape differ (as for i1).

  • context – Explicit context, if not from context manager.

Returns

DenseElementsAttr on success.

Raises

ValueError – If the type of the buffer or array cannot be matched to an MLIR type or if the buffer does not meet expectations.

static get_splat(shaped_type: iree.compiler._mlir_libs._mlir.ir.Type, element_attr: iree.compiler._mlir_libs._mlir.ir.Attribute) iree.compiler._mlir_libs._mlir.ir.DenseElementsAttr

Gets a DenseElementsAttr where all values are the same

get_splat_value(self: iree.compiler._mlir_libs._mlir.ir.DenseElementsAttr) iree.compiler._mlir_libs._mlir.ir.Attribute
property is_splat
static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Attribute) bool
property type
class iree.compiler.ir.DenseF32ArrayAttr
static get(values: List[float], context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.DenseF32ArrayAttr

Gets a uniqued dense array attribute

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Attribute) bool
property type
class iree.compiler.ir.DenseF32ArrayIterator
class iree.compiler.ir.DenseF64ArrayAttr
static get(values: List[float], context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.DenseF64ArrayAttr

Gets a uniqued dense array attribute

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Attribute) bool
property type
class iree.compiler.ir.DenseF64ArrayIterator
class iree.compiler.ir.DenseFPElementsAttr
static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Attribute) bool
property type
class iree.compiler.ir.DenseI16ArrayAttr
static get(values: List[int], context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.DenseI16ArrayAttr

Gets a uniqued dense array attribute

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Attribute) bool
property type
class iree.compiler.ir.DenseI16ArrayIterator
class iree.compiler.ir.DenseI32ArrayAttr
static get(values: List[int], context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.DenseI32ArrayAttr

Gets a uniqued dense array attribute

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Attribute) bool
property type
class iree.compiler.ir.DenseI32ArrayIterator
class iree.compiler.ir.DenseI64ArrayAttr
static get(values: List[int], context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr

Gets a uniqued dense array attribute

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Attribute) bool
property type
class iree.compiler.ir.DenseI64ArrayIterator
class iree.compiler.ir.DenseI8ArrayAttr
static get(values: List[int], context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.DenseI8ArrayAttr

Gets a uniqued dense array attribute

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Attribute) bool
property type
class iree.compiler.ir.DenseI8ArrayIterator
class iree.compiler.ir.DenseIntElementsAttr
static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Attribute) bool
property type
class iree.compiler.ir.Diagnostic
property location
property message
property notes
property severity
class iree.compiler.ir.DiagnosticHandler
property attached
detach(self: iree.compiler._mlir_libs._mlir.ir.DiagnosticHandler) None
property had_error
class iree.compiler.ir.DiagnosticInfo
property location
property message
property notes
property severity
class iree.compiler.ir.DiagnosticSeverity

Members:

ERROR

WARNING

NOTE

REMARK

ERROR = <DiagnosticSeverity.ERROR: 0>
NOTE = <DiagnosticSeverity.NOTE: 2>
REMARK = <DiagnosticSeverity.REMARK: 3>
WARNING = <DiagnosticSeverity.WARNING: 1>
property name
property value
class iree.compiler.ir.Dialect
property descriptor
class iree.compiler.ir.DialectDescriptor
property namespace
class iree.compiler.ir.DialectRegistry
class iree.compiler.ir.Dialects
class iree.compiler.ir.DictAttr
static get(value: dict = {}, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.DictAttr

Gets an uniqued dict attribute

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Attribute) bool
property type
class iree.compiler.ir.F16Type
static get(context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.F16Type

Create a f16 type.

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Type) bool
class iree.compiler.ir.F32Type
static get(context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.F32Type

Create a f32 type.

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Type) bool
class iree.compiler.ir.F64Type
static get(context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.F64Type

Create a f64 type.

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Type) bool
class iree.compiler.ir.FlatSymbolRefAttr
static get(value: str, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.FlatSymbolRefAttr

Gets a uniqued FlatSymbolRef attribute

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Attribute) bool
property type
property value

Returns the value of the FlatSymbolRef attribute as a string

class iree.compiler.ir.Float8E4M3B11FNUZType
static get(context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.Float8E4M3B11FNUZType

Create a float8_e4m3b11fnuz type.

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Type) bool
class iree.compiler.ir.Float8E4M3FNType
static get(context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.Float8E4M3FNType

Create a float8_e4m3fn type.

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Type) bool
class iree.compiler.ir.Float8E4M3FNUZType
static get(context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.Float8E4M3FNUZType

Create a float8_e4m3fnuz type.

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Type) bool
class iree.compiler.ir.Float8E5M2FNUZType
static get(context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.Float8E5M2FNUZType

Create a float8_e5m2fnuz type.

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Type) bool
class iree.compiler.ir.Float8E5M2Type
static get(context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.Float8E5M2Type

Create a float8_e5m2 type.

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Type) bool
class iree.compiler.ir.FloatAttr
static get(type: iree.compiler._mlir_libs._mlir.ir.Type, value: float, loc: mlir.ir.Location = None) iree.compiler._mlir_libs._mlir.ir.FloatAttr

Gets an uniqued float point attribute associated to a type

static get_f32(value: float, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.FloatAttr

Gets an uniqued float point attribute associated to a f32 type

static get_f64(value: float, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.FloatAttr

Gets an uniqued float point attribute associated to a f64 type

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Attribute) bool
property type
property value

Returns the value of the float point attribute

class iree.compiler.ir.FunctionType
static get(inputs: List[iree.compiler._mlir_libs._mlir.ir.Type], results: List[iree.compiler._mlir_libs._mlir.ir.Type], context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.FunctionType

Gets a FunctionType from a list of input and result types

property inputs

Returns the list of input types in the FunctionType.

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Type) bool
property results

Returns the list of result types in the FunctionType.

class iree.compiler.ir.IndexType
static get(context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.IndexType

Create a index type.

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Type) bool
class iree.compiler.ir.InferTypeOpInterface
inferReturnTypes(self: iree.compiler._mlir_libs._mlir.ir.InferTypeOpInterface, operands: Optional[list] = None, attributes: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute] = None, regions: Optional[List[iree.compiler._mlir_libs._mlir.ir.Region]] = None, context: mlir.ir.Context = None, loc: mlir.ir.Location = None) List[iree.compiler._mlir_libs._mlir.ir.Type]

Given the arguments required to build an operation, attempts to infer its return types. Raises ValueError on failure.

property operation

Returns an Operation for which the interface was constructed.

property opview

Returns an OpView subclass _instance_ for which the interface was constructed

class iree.compiler.ir.InsertionPoint
static at_block_begin(block: iree.compiler._mlir_libs._mlir.ir.Block) iree.compiler._mlir_libs._mlir.ir.InsertionPoint

Inserts at the beginning of the block.

static at_block_terminator(block: iree.compiler._mlir_libs._mlir.ir.Block) iree.compiler._mlir_libs._mlir.ir.InsertionPoint

Inserts before the block terminator.

property block

Returns the block that this InsertionPoint points to.

property current
insert(self: iree.compiler._mlir_libs._mlir.ir.InsertionPoint, operation: iree.compiler._mlir_libs._mlir.ir._OperationBase) None

Inserts an operation.

class iree.compiler.ir.IntegerAttr
static get(type: iree.compiler._mlir_libs._mlir.ir.Type, value: int) iree.compiler._mlir_libs._mlir.ir.IntegerAttr

Gets an uniqued integer attribute associated to a type

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Attribute) bool
property type
property value

Returns the value of the integer attribute

class iree.compiler.ir.IntegerSet
property constraints
property context
dump(self: iree.compiler._mlir_libs._mlir.ir.IntegerSet) None

Dumps a debug representation of the object to stderr.

static get(num_dims: int, num_symbols: int, exprs: list, eq_flags: List[bool], context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.IntegerSet
static get_empty(num_dims: int, num_symbols: int, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.IntegerSet
get_replaced(self: iree.compiler._mlir_libs._mlir.ir.IntegerSet, dim_exprs: list, symbol_exprs: list, num_result_dims: int, num_result_symbols: int) iree.compiler._mlir_libs._mlir.ir.IntegerSet
property is_canonical_empty
property n_dims
property n_equalities
property n_inequalities
property n_inputs
property n_symbols
class iree.compiler.ir.IntegerSetConstraint
property expr
property is_eq
class iree.compiler.ir.IntegerSetConstraintList
class iree.compiler.ir.IntegerType
static get_signed(width: int, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.IntegerType

Create a signed integer type

static get_signless(width: int, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.IntegerType

Create a signless integer type

static get_unsigned(width: int, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.IntegerType

Create an unsigned integer type

property is_signed

Returns whether this is a signed integer

property is_signless

Returns whether this is a signless integer

property is_unsigned

Returns whether this is an unsigned integer

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Type) bool
property width

Returns the width of the integer type

class iree.compiler.ir.Location
property attr

Get the underlying LocationAttr

static callsite(callee: iree.compiler._mlir_libs._mlir.ir.Location, frames: List[iree.compiler._mlir_libs._mlir.ir.Location], context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.Location

Gets a Location representing a caller and callsite

property context

Context that owns the Location

property current
emit_error(self: iree.compiler._mlir_libs._mlir.ir.Location, message: str) None

Emits an error at this location

static file(filename: str, line: int, col: int, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.Location

Gets a Location representing a file, line and column

static from_attr(attribute: mlir::python::PyAttribute, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.Location

Gets a Location from a LocationAttr

static fused(locations: List[iree.compiler._mlir_libs._mlir.ir.Location], metadata: Optional[mlir::python::PyAttribute] = None, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.Location

Gets a Location representing a fused location with optional metadata

static name(name: str, childLoc: Optional[iree.compiler._mlir_libs._mlir.ir.Location] = None, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.Location

Gets a Location representing a named location with optional child location

static unknown(context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.Location

Gets a Location representing an unknown location

exception iree.compiler.ir.MLIRError(message, error_diagnostics)
An exception with diagnostic information. Has the following fields:

message: str error_diagnostics: List[ir.DiagnosticInfo]

class iree.compiler.ir.MemRefType
property affine_map

The layout of the MemRef type as an affine map.

static get(shape: List[int], element_type: iree.compiler._mlir_libs._mlir.ir.Type, layout: iree.compiler._mlir_libs._mlir.ir.Attribute = None, memory_space: iree.compiler._mlir_libs._mlir.ir.Attribute = None, loc: mlir.ir.Location = None) iree.compiler._mlir_libs._mlir.ir.MemRefType

Create a memref type

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Type) bool
property layout

The layout of the MemRef type.

property memory_space

Returns the memory space of the given MemRef type.

class iree.compiler.ir.Module
property body

Return the block for this module

property context

Context that created the Module

static create(loc: mlir.ir.Location = None) object

Creates an empty module

dump(self: iree.compiler._mlir_libs._mlir.ir.Module) None

Dumps a debug representation of the object to stderr.

property operation

Accesses the module as an operation

static parse(asm: str, context: mlir.ir.Context = None) object

Parses a module’s assembly format from a string.

Returns a new MlirModule or raises an MLIRError if the parsing fails.

See also: https://mlir.llvm.org/docs/LangRef/

class iree.compiler.ir.NamedAttribute
property attr

The underlying generic attribute of the NamedAttribute binding

property name

The name of the NamedAttribute binding

class iree.compiler.ir.NoneType
static get(context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.NoneType

Create a none type.

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Type) bool
class iree.compiler.ir.OpAttributeMap
class iree.compiler.ir.OpOperand
property operand_number
property owner
class iree.compiler.ir.OpOperandIterator
class iree.compiler.ir.OpOperandList
class iree.compiler.ir.OpResult
static isinstance(other_value: iree.compiler._mlir_libs._mlir.ir.Value) bool
property owner
property result_number
class iree.compiler.ir.OpResultList
property types
class iree.compiler.ir.OpView
classmethod build_generic()

(cls: object, results: list = None, operands: list = None, attributes: Optional[dict] = None, successors: Optional[List[mlir::python::PyBlock]] = None, regions: Optional[int] = None, loc: mlir.ir.Location = None, ip: object = None) -> object

Builds a specific, generated OpView based on class level attributes.

property context

Context that owns the Operation

property operation
classmethod parse()

(cls: object, source: str, *, source_name: str = ‘’, context: mlir.ir.Context = None) -> object

Parses a specific, generated OpView based on class level attributes

class iree.compiler.ir.OpaqueAttr
property data

Returns the data for the Opaqued attributes as a string

property dialect_namespace

Returns the dialect namespace for the Opaque attribute as a string

static get(dialect_namespace: str, buffer: buffer, type: iree.compiler._mlir_libs._mlir.ir.Type, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.OpaqueAttr

Gets an Opaque attribute.

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Attribute) bool
property type
class iree.compiler.ir.OpaqueType
property data

Returns the data for the Opaque type as a string.

property dialect_namespace

Returns the dialect namespace for the Opaque type as a string.

static get(dialect_namespace: str, buffer: str, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.OpaqueType

Create an unregistered (opaque) dialect type.

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Type) bool
class iree.compiler.ir.Operation
clone(self: iree.compiler._mlir_libs._mlir.ir.Operation, ip: object = None) object
property context

Context that owns the Operation

static create(name: str, results: Optional[List[mlir::python::PyType]] = None, operands: Optional[List[mlir::python::PyValue]] = None, attributes: Optional[dict] = None, successors: Optional[List[mlir::python::PyBlock]] = None, regions: int = 0, loc: mlir.ir.Location = None, ip: object = None) object

Creates a new operation.

Parameters
  • name – Operation name (e.g. “dialect.operation”).

  • results – Sequence of Type representing op result types.

  • attributes – Dict of str:Attribute.

  • successors – List of Block for the operation’s successors.

  • regions – Number of regions to create.

  • location – A Location object (defaults to resolve from context manager).

  • ip – An InsertionPoint (defaults to resolve from context manager or set to False to disable insertion, even with an insertion point set in the context manager).

Returns

A new “detached” Operation object. Detached operations can be added to blocks, which causes them to become “attached.”

erase(self: iree.compiler._mlir_libs._mlir.ir.Operation) None
property name
property opview
property parent
static parse(source: str, *, source_name: str = '', context: mlir.ir.Context = None) object

Parses an operation. Supports both text assembly format and binary bytecode format.

class iree.compiler.ir.OperationIterator
class iree.compiler.ir.OperationList
class iree.compiler.ir.RankedTensorType
property encoding
static get(shape: List[int], element_type: iree.compiler._mlir_libs._mlir.ir.Type, encoding: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute] = None, loc: mlir.ir.Location = None) iree.compiler._mlir_libs._mlir.ir.RankedTensorType

Create a ranked tensor type

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Type) bool
class iree.compiler.ir.Region
property blocks

Returns a forward-optimized sequence of blocks.

property owner

Returns the operation owning this region.

class iree.compiler.ir.RegionIterator
class iree.compiler.ir.RegionSequence
class iree.compiler.ir.ShapedType
property element_type

Returns the element type of the shaped type.

get_dim_size(self: iree.compiler._mlir_libs._mlir.ir.ShapedType, dim: int) int

Returns the dim-th dimension of the given ranked shaped type.

static get_dynamic_size() int

Returns the value used to indicate dynamic dimensions in shaped types.

static get_dynamic_stride_or_offset() int

Returns the value used to indicate dynamic strides or offsets in shaped types.

property has_rank

Returns whether the given shaped type is ranked.

property has_static_shape

Returns whether the given shaped type has a static shape.

is_dynamic_dim(self: iree.compiler._mlir_libs._mlir.ir.ShapedType, dim: int) bool

Returns whether the dim-th dimension of the given shaped type is dynamic.

static is_dynamic_size(dim_size: int) bool

Returns whether the given dimension size indicates a dynamic dimension.

is_dynamic_stride_or_offset(self: iree.compiler._mlir_libs._mlir.ir.ShapedType, dim_size: int) bool

Returns whether the given value is used as a placeholder for dynamic strides and offsets in shaped types.

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Type) bool
property rank

Returns the rank of the given ranked shaped type.

property shape

Returns the shape of the ranked shaped type as a list of integers.

class iree.compiler.ir.StridedLayoutAttr
static get(offset: int, strides: List[int], context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.StridedLayoutAttr

Gets a strided layout attribute.

static get_fully_dynamic(rank: int, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.StridedLayoutAttr

Gets a strided layout attribute with dynamic offset and strides of a given rank.

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Attribute) bool
property offset

Returns the value of the float point attribute

property strides

Returns the value of the float point attribute

property type
class iree.compiler.ir.StringAttr
static get(value: str, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.StringAttr

Gets a uniqued string attribute

static get_typed(type: iree.compiler._mlir_libs._mlir.ir.Type, value: str) iree.compiler._mlir_libs._mlir.ir.StringAttr

Gets a uniqued string attribute associated to a type

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Attribute) bool
property type
property value

Returns the value of the string attribute

class iree.compiler.ir.SymbolTable
erase(self: iree.compiler._mlir_libs._mlir.ir.SymbolTable, operation: iree.compiler._mlir_libs._mlir.ir._OperationBase) None
static get_symbol_name(symbol: iree.compiler._mlir_libs._mlir.ir._OperationBase) iree.compiler._mlir_libs._mlir.ir.Attribute
static get_visibility(symbol: iree.compiler._mlir_libs._mlir.ir._OperationBase) iree.compiler._mlir_libs._mlir.ir.Attribute
insert(self: iree.compiler._mlir_libs._mlir.ir.SymbolTable, operation: iree.compiler._mlir_libs._mlir.ir._OperationBase) iree.compiler._mlir_libs._mlir.ir.Attribute
static replace_all_symbol_uses(old_symbol: str, new_symbol: str, from_op: iree.compiler._mlir_libs._mlir.ir._OperationBase) None
static set_symbol_name(symbol: iree.compiler._mlir_libs._mlir.ir._OperationBase, name: str) None
static set_visibility(symbol: iree.compiler._mlir_libs._mlir.ir._OperationBase, visibility: str) None
static walk_symbol_tables(from_op: iree.compiler._mlir_libs._mlir.ir._OperationBase, all_sym_uses_visible: bool, callback: object) None
class iree.compiler.ir.TupleType
static get_tuple(elements: list, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.TupleType

Create a tuple type

get_type(self: iree.compiler._mlir_libs._mlir.ir.TupleType, pos: int) iree.compiler._mlir_libs._mlir.ir.Type

Returns the pos-th type in the tuple type.

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Type) bool
property num_types

Returns the number of types contained in a tuple.

class iree.compiler.ir.Type
property context

Context that owns the Type

dump(self: iree.compiler._mlir_libs._mlir.ir.Type) None

Dumps a debug representation of the object to stderr.

static parse(asm: str, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.Type

Parses the assembly form of a type.

Returns a Type object or raises an MLIRError if the type cannot be parsed.

See also: https://mlir.llvm.org/docs/LangRef/#type-system

class iree.compiler.ir.TypeAttr
static get(value: iree.compiler._mlir_libs._mlir.ir.Type, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.TypeAttr

Gets a uniqued Type attribute

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Attribute) bool
property type
property value
class iree.compiler.ir.UnitAttr
static get(context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.ir.UnitAttr

Create a Unit attribute.

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Attribute) bool
property type
class iree.compiler.ir.UnrankedMemRefType
static get(element_type: iree.compiler._mlir_libs._mlir.ir.Type, memory_space: iree.compiler._mlir_libs._mlir.ir.Attribute, loc: mlir.ir.Location = None) iree.compiler._mlir_libs._mlir.ir.UnrankedMemRefType

Create a unranked memref type

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Type) bool
property memory_space

Returns the memory space of the given Unranked MemRef type.

class iree.compiler.ir.UnrankedTensorType
static get(element_type: iree.compiler._mlir_libs._mlir.ir.Type, loc: mlir.ir.Location = None) iree.compiler._mlir_libs._mlir.ir.UnrankedTensorType

Create a unranked tensor type

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Type) bool
class iree.compiler.ir.Value
property context

Context in which the value lives.

dump(self: iree.compiler._mlir_libs._mlir.ir.Value) None

Dumps a debug representation of the object to stderr.

property owner
property type
property uses
class iree.compiler.ir.VectorType
static get(shape: List[int], elementType: iree.compiler._mlir_libs._mlir.ir.Type, loc: mlir.ir.Location = None) iree.compiler._mlir_libs._mlir.ir.VectorType

Create a vector type

static isinstance(other: iree.compiler._mlir_libs._mlir.ir.Type) bool
iree.compiler.ir.register_attribute_builder(kind)

iree.compiler.passmanager module

class iree.compiler.passmanager.PassManager
add(self: iree.compiler._mlir_libs._mlir.passmanager.PassManager, pipeline: str) None

Add textual pipeline elements to the pass manager. Throws a ValueError if the pipeline can’t be parsed.

enable_ir_printing(self: iree.compiler._mlir_libs._mlir.passmanager.PassManager) None

Enable mlir-print-ir-after-all.

enable_verifier(self: iree.compiler._mlir_libs._mlir.passmanager.PassManager, enable: bool) None

Enable / disable verify-each.

static parse(pipeline: str, context: mlir.ir.Context = None) iree.compiler._mlir_libs._mlir.passmanager.PassManager

Parse a textual pass-pipeline and return a top-level PassManager that can be applied on a Module. Throw a ValueError if the pipeline can’t be parsed

run(self: iree.compiler._mlir_libs._mlir.passmanager.PassManager, operation: iree.compiler._mlir_libs._mlir.ir._OperationBase) None

Run the pass manager on the provided operation, raising an MLIRError on failure.