Embedded MLIR API

iree.compiler.ir module

class iree.compiler.ir.AffineAddExpr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
class iree.compiler.ir.AffineBinaryExpr(*args, **kwargs)
isinstance = <nanobind.nb_func object>
property lhs

(self) -> iree.compiler._mlir_libs._mlir.ir.AffineExpr

property rhs

(self) -> iree.compiler._mlir_libs._mlir.ir.AffineExpr

class iree.compiler.ir.AffineCeilDivExpr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
class iree.compiler.ir.AffineConstantExpr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
property value

(self) -> int

class iree.compiler.ir.AffineDimExpr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
property position

(self) -> int

class iree.compiler.ir.AffineExpr
compose
property context

(self) -> iree.compiler._mlir_libs._mlir.ir.Context

dump

Dumps a debug representation of the object to stderr.

get_add = <nanobind.nb_func object>
get_ceil_div = <nanobind.nb_func object>
get_constant = <nanobind.nb_func object>
get_dim = <nanobind.nb_func object>
get_floor_div = <nanobind.nb_func object>
get_mod = <nanobind.nb_func object>
get_mul = <nanobind.nb_func object>
get_symbol = <nanobind.nb_func object>
shift_dims
shift_symbols
simplify_affine_expr = <nanobind.nb_func object>
class iree.compiler.ir.AffineExprList
class iree.compiler.ir.AffineFloorDivExpr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
class iree.compiler.ir.AffineMap
compress_unused_symbols = <nanobind.nb_func object>
property context

Context that owns the Affine Map

dump

Dumps a debug representation of the object to stderr.

get = <nanobind.nb_func object>
get_constant = <nanobind.nb_func object>
get_empty = <nanobind.nb_func object>
get_identity = <nanobind.nb_func object>
get_major_submap
get_minor_identity = <nanobind.nb_func object>
get_minor_submap
get_permutation = <nanobind.nb_func object>
get_submap
property is_permutation

(self) -> bool

property is_projected_permutation

(self) -> bool

property n_dims

(self) -> int

property n_inputs

(self) -> int

property n_symbols

(self) -> int

replace
property results

(self) -> (anonymous namespace)::PyAffineMapExprList

class iree.compiler.ir.AffineMapAttr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

property value

Returns the value of the AffineMap attribute

class iree.compiler.ir.AffineModExpr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
class iree.compiler.ir.AffineMulExpr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
class iree.compiler.ir.AffineSymbolExpr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
property position

(self) -> int

class iree.compiler.ir.ArrayAttr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.ArrayAttributeIterator
class iree.compiler.ir.AsmState(*args, **kwargs)
class iree.compiler.ir.AttrBuilder
contains = <nanobind.nb_func object>
get = <nanobind.nb_func object>
insert = <nanobind.nb_func object>
class iree.compiler.ir.Attribute(*args, **kwargs)
property context

Context that owns the Attribute.

dump

Dumps a debug representation of the object to stderr.

get_named

Binds a name to the attribute, creating a NamedAttribute.

Parameters

name – The name to bind to the Attribute.

Returns

A NamedAttribute with the given name and this attribute.

maybe_downcast

Downcasts the attribute to a more specific attribute if possible.

parse = <nanobind.nb_func object>
property type

Returns the type of the Attribute.

property typeid

Returns the TypeID of the attribute.

class iree.compiler.ir.BF16Type(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.Block
add_argument

Appends an argument of the specified type to the block.

Parameters
  • type – The type of the argument to add.

  • loc – The source location for the argument.

Returns

The newly added block argument.

append

Appends an operation to this block.

If the operation is currently in another block, it will be moved.

Parameters

operation – The operation to append to the block.

append_to

Appends this block to a region.

Transfers ownership if the block is currently owned by another region.

Parameters

region – The region to append the block to.

property arguments

Returns a list of block arguments.

create_after

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

create_at_start = <nanobind.nb_func object>
create_before

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

erase_argument

Erases the argument at the specified index.

Parameters

index – The index of the argument to erase.

property operations

Returns a forward-optimized sequence of operations.

property owner

Returns the owning operation of this block.

property predecessors

Returns the list of Block predecessors.

property region

Returns the owning region of this block.

property successors

Returns the list of Block successors.

class iree.compiler.ir.BlockArgument(*args, **kwargs)
property arg_number

Returns the position of this argument in the block’s argument list.

isinstance = <nanobind.nb_func object>
maybe_downcast
property owner

Returns the block that owns this argument.

set_location

Sets the location of this block argument.

set_type

Sets the type of this block argument.

class iree.compiler.ir.BlockArgumentList
property types

Returns a list of types for all arguments in this argument list.

class iree.compiler.ir.BlockIterator
class iree.compiler.ir.BlockList
append

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

Returns

The created block.

class iree.compiler.ir.BlockPredecessors
class iree.compiler.ir.BlockSuccessors
class iree.compiler.ir.BoolAttr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
property static_typeid
property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

property value

Returns the value of the bool attribute

class iree.compiler.ir.ComplexType(*args, **kwargs)
property element_type

Returns element type.

get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.Context(load_on_create_dialects=None, thread_pool=None, *args, **kwargs)
class iree.compiler.ir.DenseBoolArrayAttr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
property static_typeid
property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.DenseBoolArrayIterator
class iree.compiler.ir.DenseElementsAttr(*args, **kwargs)
get = <nanobind.nb_func object>
get_splat = <nanobind.nb_func object>
get_splat_value
property is_splat

(self) -> bool

isinstance = <nanobind.nb_func object>
property static_typeid
property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.DenseF32ArrayAttr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
property static_typeid
property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.DenseF32ArrayIterator
class iree.compiler.ir.DenseF64ArrayAttr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
property static_typeid
property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.DenseF64ArrayIterator
class iree.compiler.ir.DenseFPElementsAttr(*args, **kwargs)
isinstance = <nanobind.nb_func object>
property static_typeid
property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.DenseI16ArrayAttr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
property static_typeid
property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.DenseI16ArrayIterator
class iree.compiler.ir.DenseI32ArrayAttr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
property static_typeid
property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.DenseI32ArrayIterator
class iree.compiler.ir.DenseI64ArrayAttr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
property static_typeid
property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.DenseI64ArrayIterator
class iree.compiler.ir.DenseI8ArrayAttr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
property static_typeid
property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.DenseI8ArrayIterator
class iree.compiler.ir.DenseIntElementsAttr(*args, **kwargs)
isinstance = <nanobind.nb_func object>
property static_typeid
property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.DenseResourceElementsAttr(*args, **kwargs)
get_from_buffer = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
property static_typeid
property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.Diagnostic
property location

Returns the location associated with the diagnostic.

property message

Returns the message text of the diagnostic.

property notes

Returns a tuple of attached note diagnostics.

property severity

Returns the severity of the diagnostic.

class iree.compiler.ir.DiagnosticHandler
property attached

Returns True if the handler is attached to a context.

detach

Detaches the diagnostic handler from the context.

property had_error

Returns True if an error was encountered during diagnostic handling.

class iree.compiler.ir.DiagnosticInfo(*args, **kwargs)
property location

The location associated with the diagnostic.

property message

The message text of the diagnostic.

property notes

List of attached note diagnostics.

property severity

The severity level of the diagnostic.

enum iree.compiler.ir.DiagnosticSeverity(value)

Valid values are as follows:

ERROR = DiagnosticSeverity.ERROR
WARNING = DiagnosticSeverity.WARNING
NOTE = DiagnosticSeverity.NOTE
REMARK = DiagnosticSeverity.REMARK
class iree.compiler.ir.Dialect(*args, **kwargs)
property descriptor

Returns the DialectDescriptor for this dialect.

class iree.compiler.ir.DialectDescriptor
property namespace

Returns the namespace of the dialect.

class iree.compiler.ir.DialectRegistry(*args, **kwargs)
class iree.compiler.ir.Dialects
class iree.compiler.ir.DictAttr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.F16Type(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.F32Type(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.F64Type(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.FlatSymbolRefAttr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
property static_typeid
property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

property value

Returns the value of the FlatSymbolRef attribute as a string

class iree.compiler.ir.Float4E2M1FNType(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.Float6E2M3FNType(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.Float6E3M2FNType(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.Float8E3M4Type(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.Float8E4M3B11FNUZType(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.Float8E4M3FNType(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.Float8E4M3FNUZType(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.Float8E4M3Type(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.Float8E5M2FNUZType(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.Float8E5M2Type(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.Float8E8M0FNUType(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.FloatAttr(*args, **kwargs)
get = <nanobind.nb_func object>
get_f32 = <nanobind.nb_func object>
get_f64 = <nanobind.nb_func object>
get_unchecked = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

property value

Returns the value of the float attribute

class iree.compiler.ir.FloatTF32Type(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.FloatType(*args, **kwargs)
isinstance = <nanobind.nb_func object>
property static_typeid
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

property width

Returns the width of the floating-point type

class iree.compiler.ir.FunctionType(*args, **kwargs)
get = <nanobind.nb_func object>
property inputs

Returns the list of input types in the FunctionType.

isinstance = <nanobind.nb_func object>
property results

Returns the list of result types in the FunctionType.

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.IndexType(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.InferShapedTypeOpInterface(*args, **kwargs)
inferReturnTypeComponents

Given the arguments required to build an operation, attempts to infer its return shaped type components. 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.InferTypeOpInterface(*args, **kwargs)
inferReturnTypes

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(*args, **kwargs)
after = <nanobind.nb_func object>
at_block_begin = <nanobind.nb_func object>
at_block_terminator = <nanobind.nb_func object>
property block

Returns the block that this InsertionPoint points to.

property current

Gets the InsertionPoint bound to the current thread or raises ValueError if none has been set.

insert

Inserts an operation at this insertion point.

Parameters

operation – The operation to insert.

property ref_operation

The reference operation before which new operations are inserted, or None if the insertion point is at the end of the block.

class iree.compiler.ir.IntegerAttr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

property value

Returns the value of the integer attribute

class iree.compiler.ir.IntegerSet
property constraints

(self) -> (anonymous namespace)::PyIntegerSetConstraintList

property context

(self) -> iree.compiler._mlir_libs._mlir.ir.Context

dump

Dumps a debug representation of the object to stderr.

get = <nanobind.nb_func object>
get_empty = <nanobind.nb_func object>
get_replaced
property is_canonical_empty

(self) -> bool

property n_dims

(self) -> int

property n_equalities

(self) -> int

property n_inequalities

(self) -> int

property n_inputs

(self) -> int

property n_symbols

(self) -> int

class iree.compiler.ir.IntegerSetAttr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.IntegerSetConstraint
property expr

(self) -> iree.compiler._mlir_libs._mlir.ir.AffineExpr

property is_eq

(self) -> bool

class iree.compiler.ir.IntegerSetConstraintList
class iree.compiler.ir.IntegerType(*args, **kwargs)
get_signed = <nanobind.nb_func object>
get_signless = <nanobind.nb_func object>
get_unsigned = <nanobind.nb_func object>
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

isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

property width

Returns the width of the integer type

class iree.compiler.ir.Iterable
class iree.compiler.ir.Location
property attr

Get the underlying LocationAttr.

property callee

Gets the callee location from a CallSiteLoc.

property caller

Gets the caller location from a CallSiteLoc.

callsite = <nanobind.nb_func object>
property child_loc

Gets the child location from a NameLoc.

property context

Context that owns the Location.

current = None
emit_error

Emits an error diagnostic at this location.

Parameters

message – The error message to emit.

property end_col

Gets the end column number from a FileLineColLoc.

property end_line

Gets the end line number from a FileLineColLoc.

file = <nanobind.nb_func object>
property filename

Gets the filename from a FileLineColLoc.

from_attr = <nanobind.nb_func object>
fused = <nanobind.nb_func object>
is_a_callsite

Returns True if this location is a CallSiteLoc.

is_a_file

Returns True if this location is a FileLineColLoc.

is_a_fused

Returns True if this location is a FusedLoc.

is_a_name

Returns True if this location is a NameLoc.

property locations

Gets the list of locations from a FusedLoc.

name = <nanobind.nb_func object>
property name_str

Gets the name string from a NameLoc.

property start_col

Gets the start column number from a FileLineColLoc.

property start_line

Gets the start line number from a FileLineColLoc.

unknown = <nanobind.nb_func object>
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(*args, **kwargs)
property affine_map

The layout of the MemRef type as an affine map.

get = <nanobind.nb_func object>
get_strides_and_offset

The strides and offset of the MemRef type.

get_unchecked = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
property layout

The layout of the MemRef type.

property memory_space

Returns the memory space of the given MemRef type.

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.Module
property body

Return the block for this module.

property context

Context that created the Module.

create = <nanobind.nb_func object>
dump

Dumps a debug representation of the object to stderr.

property operation

Accesses the module as an operation.

parse = <nanobind.nb_func object>
parseFile = <nanobind.nb_func object>
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(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.OpAttributeMap
items

Returns a list of (name, attribute) tuples.

keys

Returns a list of attribute names.

values

Returns a list of attribute values.

class iree.compiler.ir.OpOperand
property operand_number

Returns the operand number in the owning operation.

property owner

Returns the operation that owns this operand.

class iree.compiler.ir.OpOperandIterator
class iree.compiler.ir.OpOperandList
class iree.compiler.ir.OpResult(*args, **kwargs)
isinstance = <nanobind.nb_func object>
maybe_downcast
property owner

Returns the operation that produces this result.

property result_number

Returns the position of this result in the operation’s result list.

class iree.compiler.ir.OpResultList
property owner

Returns the operation that owns this result list.

property types

Returns a list of types for all results in this result list.

class iree.compiler.ir.OpSuccessors
class iree.compiler.ir.OpView(*args, **kwargs)
property operation

(self) -> iree.compiler._mlir_libs._mlir.ir.Operation

property opview

(self) -> iree.compiler._mlir_libs._mlir.ir.OpView

property successors

Returns the list of Operation successors.

class iree.compiler.ir.OpaqueAttr(*args, **kwargs)
property data

Returns the data for the Opaqued attributes as bytes

property dialect_namespace

Returns the dialect namespace for the Opaque attribute as a string

get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.OpaqueType(*args, **kwargs)
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.

get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.Operation
property block

Returns the block containing this operation.

create = <nanobind.nb_func object>
property operation

Returns self (the operation).

property opview

Returns an OpView of this operation.

Note

If the operation has a registered and loaded dialect then this OpView will be concrete wrapper class.

parse = <nanobind.nb_func object>
replace_uses_of_with

Replaces uses of the ‘of’ value with the ‘with’ value inside the operation.

property successors

Returns the list of Operation successors.

class iree.compiler.ir.OperationIterator
class iree.compiler.ir.OperationList
class iree.compiler.ir.RankedTensorType(*args, **kwargs)
property encoding

(self) -> iree.compiler._mlir_libs._mlir.ir.Attribute | None

get = <nanobind.nb_func object>
get_unchecked = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

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(*args, **kwargs)
property element_type

Returns the element type of the shaped type.

get_dim_size

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

get_dynamic_size = <nanobind.nb_func object>
get_dynamic_stride_or_offset = <nanobind.nb_func object>
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

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

is_dynamic_size = <nanobind.nb_func object>
is_dynamic_stride_or_offset

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

is_static_dim

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

is_static_size = <nanobind.nb_func object>
is_static_stride_or_offset

Returns whether the given shaped type stride or offset value is statically-sized.

isinstance = <nanobind.nb_func object>
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.

property static_typeid
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.ShapedTypeComponents
property element_type

Returns the element type of the shaped type components.

get = <nanobind.nb_func object>
property has_rank

Returns whether the given shaped type component is ranked.

property rank

Returns the rank of the given ranked shaped type components. If the shaped type components does not have a rank, None is returned.

property shape

Returns the shape of the ranked shaped type components as a list of integers. Returns none if the shaped type component does not have a rank.

class iree.compiler.ir.StridedLayoutAttr(*args, **kwargs)
get = <nanobind.nb_func object>
get_fully_dynamic = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
property offset

Returns the value of the float point attribute

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property strides

Returns the value of the float point attribute

property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.StringAttr(*args, **kwargs)
get = <nanobind.nb_func object>
get_typed = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

property value

Returns the value of the string attribute

property value_bytes

Returns the value of the string attribute as bytes

class iree.compiler.ir.SymbolRefAttr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
property static_typeid
property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

property value

Returns the value of the SymbolRef attribute as a list[str]

class iree.compiler.ir.SymbolTable(*args, **kwargs)
erase

Erases a symbol operation from the symbol table.

Parameters

operation – The symbol operation to erase.

Note

The operation is also erased from the IR and invalidated.

get_symbol_name = <nanobind.nb_func object>
get_visibility = <nanobind.nb_func object>
insert

Inserts a symbol operation into the symbol table.

Parameters

operation – An operation with a symbol name to insert.

Returns

The symbol name attribute of the inserted operation.

Raises

ValueError – If the operation does not have a symbol name.

replace_all_symbol_uses = <nanobind.nb_func object>
set_symbol_name = <nanobind.nb_func object>
set_visibility = <nanobind.nb_func object>
walk_symbol_tables = <nanobind.nb_func object>
class iree.compiler.ir.ThreadPool(*args, **kwargs)
get_max_concurrency

Returns the maximum number of threads in the pool.

class iree.compiler.ir.TupleType(*args, **kwargs)
get_tuple = <nanobind.nb_func object>
get_type

Returns the pos-th type in the tuple type.

isinstance = <nanobind.nb_func object>
property num_types

Returns the number of types contained in a tuple.

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.Type(*args, **kwargs)
property context

Context that owns the Type.

dump

Dumps a debug representation of the object to stderr.

maybe_downcast

Downcasts the Type to a more specific Type if possible.

parse = <nanobind.nb_func object>
property typeid

Returns the TypeID of the Type, or raises ValueError if Type has no TypeID.

class iree.compiler.ir.TypeAttr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

property value

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

class iree.compiler.ir.TypeID
class iree.compiler.ir.UnitAttr(*args, **kwargs)
get = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property type

(self) -> iree.compiler._mlir_libs._mlir.ir.Type

property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.UnrankedMemRefType(*args, **kwargs)
get = <nanobind.nb_func object>
get_unchecked = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
property memory_space

Returns the memory space of the given Unranked MemRef type.

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.UnrankedTensorType(*args, **kwargs)
get = <nanobind.nb_func object>
get_unchecked = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

class iree.compiler.ir.Value(*args, **kwargs)
property context

Context in which the value lives.

dump

Dumps a debug representation of the object to stderr.

get_name

Overloaded function.

  1. get_name(self, use_local_scope: bool = False, use_name_loc_as_prefix: bool = False) -> str

    Returns the string form of value as an operand.

    Args:

    use_local_scope: Whether to use local scope for naming. use_name_loc_as_prefix: Whether to use the location attribute (NameLoc) as prefix.

    Returns:

    The value’s name as it appears in IR (e.g., %0, %arg0).

  2. get_name(self, state: iree.compiler._mlir_libs._mlir.ir.AsmState) -> str

Returns the string form of value as an operand (i.e., the ValueID).

property location

Returns the source location of the value.

maybe_downcast

Downcasts the Value to a more specific kind if possible.

property owner

Returns the owner of the value (Operation for results, Block for arguments).

replace_all_uses_except

Replace all uses of this value with the with value, except for those in exceptions. exceptions can be either a single operation or a list of operations.

replace_all_uses_with

Replace all uses of value with the new value, updating anything in the IR that uses self to use the other value instead.

set_type

Sets the type of the value.

property type

Returns the type of the value.

property uses

Returns an iterator over uses of this value.

class iree.compiler.ir.VectorType(*args, **kwargs)
get = <nanobind.nb_func object>
get_unchecked = <nanobind.nb_func object>
isinstance = <nanobind.nb_func object>
property scalable

(self) -> bool

property scalable_dims

(self) -> list[bool]

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
property typeid

(self) -> iree.compiler._mlir_libs._mlir.ir.TypeID

enum iree.compiler.ir.WalkOrder(value)

Valid values are as follows:

PRE_ORDER = WalkOrder.PRE_ORDER
POST_ORDER = WalkOrder.POST_ORDER
enum iree.compiler.ir.WalkResult(value)

Valid values are as follows:

ADVANCE = WalkResult.ADVANCE
INTERRUPT = WalkResult.INTERRUPT
SKIP = WalkResult.SKIP
iree.compiler.ir.append_load_on_create_dialect(dialect: str)
iree.compiler.ir.contextmanager(func)

@contextmanager decorator.

Typical usage:

@contextmanager def some_generator(<arguments>):

<setup> try:

yield <value>

finally:

<cleanup>

This makes this:

with some_generator(<arguments>) as <variable>:

<body>

equivalent to this:

<setup> try:

<variable> = <value> <body>

finally:

<cleanup>

iree.compiler.ir.get_dialect_registry()
iree.compiler.ir.get_load_on_create_dialects()
iree.compiler.ir.loc_tracebacks(*, max_depth: int | None = None) collections.abc.Iterable[None]

Enables automatic traceback-based locations for MLIR operations.

Operations created within this context will have their location automatically set based on the Python call stack.

Parameters

max_depth – Maximum number of frames to include in the location. If None, the default limit is used.

iree.compiler.ir.register_attribute_builder(kind, replace=False)

iree.compiler.passmanager module

class iree.compiler.passmanager.ExternalPass
signal_pass_failure
enum iree.compiler.passmanager.PassDisplayMode(value)

Valid values are as follows:

LIST = PassDisplayMode.LIST
PIPELINE = PassDisplayMode.PIPELINE
class iree.compiler.passmanager.PassManager(*args, **kwargs)
add

Overloaded function.

  1. add(self, pipeline: str) -> None

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

  1. add(self, run: collections.abc.Callable, name: str | None = None, argument: str | None = '', description: str | None = '', op_name: str | None = '') -> None

    Add a python-defined pass to the current pipeline of the pass manager.

    Args:
    run: A callable with signature (op: ir.Operation, pass_: ExternalPass) -> None.

    Called when the pass executes. It receives the operation to be processed and the current ExternalPass instance. Use pass_.signal_pass_failure() to signal failure.

    name: The name of the pass. Defaults to run.__name__. argument: The command-line argument for the pass. Defaults to empty. description: The description of the pass. Defaults to empty. op_name: The name of the operation this pass operates on.

    It will be a generic operation pass if not specified.

enable_ir_printing

Enable IR printing, default as mlir-print-ir-after-all.

enable_statistics

Enable pass statistics.

enable_timing

Enable pass timing.

enable_verifier

Enable / disable verify-each.

parse = <nanobind.nb_func object>
run

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