MLIR Core Dialects

amdgpu dialect

enum iree.compiler.dialects.amdgpu.AddressSpace(value)

AMDGPU-specific address spaces

Member Type

int

Valid values are as follows:

FatRawBuffer = <AddressSpace.FatRawBuffer: 0>
BufferRsrc = <AddressSpace.BufferRsrc: 1>
FatStructuredBuffer = <AddressSpace.FatStructuredBuffer: 2>
class iree.compiler.dialects.amdgpu.DPPOp(old, src, kind, *, permArgument=None, row_mask=None, bank_mask=None, bound_ctrl=None, results=None, loc=None, ip=None)
This operation represents DPP functionality in a GPU program.

DPP provides the following operations:

  • Full crossbar in a group of four (quad_perm)

  • Wavefront shift left by one lane (wave_shl)

  • Wavefront shift right by one lane (wave_shr)

  • Wavefront rotate right by one lane (wave_ror)

  • Wavefront rotate left by one lane (wave_rol)

  • Row shift left by 1–15 lanes (row_shl)

  • Row shift right by 1–15 lanes (row_shr)

  • Row rotate right by 1–15 lanes (row_ror)

  • Reverse within a row (row_mirror)

  • Reverse within a half-row (row_half_mirror)

  • Broadcast the 15th lane of each row to the next row (row_bcast)

  • Broadcast lane 31 to rows 2 and 3 (row_bcast)

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.DPPOpAdaptor

OPERATION_NAME = 'amdgpu.dpp'
property bank_mask: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property bound_ctrl: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property kind: iree.compiler._mlir_libs._mlir.ir.Attribute
property old: iree.compiler._mlir_libs._mlir.ir.Value
property permArgument: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property row_mask: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property src: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.DPPOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.dpp'
property bank_mask: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property bound_ctrl: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property kind: iree.compiler._mlir_libs._mlir.ir.Attribute
property old: iree.compiler._mlir_libs._mlir.ir.Value
property permArgument: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute]
property row_mask: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property src: iree.compiler._mlir_libs._mlir.ir.Value
enum iree.compiler.dialects.amdgpu.DPPPerm(value)

The possible permutations for a DPP operation

Member Type

int

Valid values are as follows:

quad_perm = <DPPPerm.quad_perm: 0>
row_shl = <DPPPerm.row_shl: 1>
row_shr = <DPPPerm.row_shr: 2>
row_ror = <DPPPerm.row_ror: 3>
wave_shl = <DPPPerm.wave_shl: 4>
wave_shr = <DPPPerm.wave_shr: 5>
wave_ror = <DPPPerm.wave_ror: 6>
wave_rol = <DPPPerm.wave_rol: 7>
row_mirror = <DPPPerm.row_mirror: 8>
row_half_mirror = <DPPPerm.row_half_mirror: 9>
row_bcast_15 = <DPPPerm.row_bcast_15: 10>
row_bcast_31 = <DPPPerm.row_bcast_31: 11>
class iree.compiler.dialects.amdgpu.ExtPackedFp8Op(res, source, index, *, loc=None, ip=None)

Extend one or two 8-bit floats in source[index] to a 32-bit float or two floats and return them.

This rather unusual signature arises from the fact that AMD GPUs cannot easily work with sub 32-bit quantities, so the compiler intrinsics for extending 8-bit floats (which are, currently, the only way to work with this operation) take packed vectors of 4 such floats.

If the passed-in vector has fewer than four elements, or the input is scalar, the remaining values in the <4 x i8> will be filled with undefined values as needed.

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.ExtPackedFp8OpAdaptor

OPERATION_NAME = 'amdgpu.ext_packed_fp8'
property index: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property res: iree.compiler._mlir_libs._mlir.ir.OpResult
property source: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.ExtPackedFp8OpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.ext_packed_fp8'
property index: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property source: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.FatRawBufferCastOp(source, *, validBytes=None, cacheSwizzleStride=None, boundsCheck=None, resetOffset=None, results=None, loc=None, ip=None)

Wraps the memory pointed to by source as a raw buffer fat pointer, or, in LLVM terms, a ptr addrspace(7), returning a memref that has the same sizes and layout but the #amdgpu.address_space<fat_raw_buffer> address space.

This memref can be used with standard memref operations like memref.load, memref.store, and memref.atomicrmw, which will be lowered to the relevant buffer intrinsics. (vector.masked_load/store will work once there’s backend support for lowering them, and then this document will be updated)

If validBytes is given, it is the number of bytes that will be valid as an offset to out. If it is not provided, this will be inferred from the size of the memref during lowering. This size is max_{d = 0 upto rank(source)} (sizes[d] * strides[d]) * sizeof(element type).

The flags of the buffer descriptor will be set up to enable raw usage - for example, stride = 0, add_tid = 0, and so on. The boundsCheck property determines if bounds checking is enabled or not (on architectures where this can be controlled - that is, on RDNA chips).

If cacheSwizzleStride is provided, L1 cache swizzling will be enabled on architectures that support it. This swizzling, unlike the main swizzling mode (whose usage makes a buffer non-raw) does not affect index calculation, but does affect cache behavior. Mixing access between cache-swizzled raw buffers and other forms of memory access, like ordinary pointer loads or unswizzled buffer pointers can cause incorrect behavior and must be avoided.

This operation preserves the sizes, strides, and offset of the input memref - they’ll be added in by memref.load later. However, if resetOffset is set, that offset will be added to the base pointer. If the value of the memref’s offset is not uniform (independent of the lane/thread ID), this will lead to substantially decreased performance due to the need for a waterfall loop on the base address of the buffer resource.

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.FatRawBufferCastOpAdaptor

OPERATION_NAME = 'amdgpu.fat_raw_buffer_cast'
property boundsCheck: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property cacheSwizzleStride: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property resetOffset: bool
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.MemRefType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property validBytes: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
class iree.compiler.dialects.amdgpu.FatRawBufferCastOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.fat_raw_buffer_cast'
property boundsCheck: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property cacheSwizzleStride: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property resetOffset: bool
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property validBytes: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
class iree.compiler.dialects.amdgpu.GatherToLDSOp(src, srcIndices, dst, dstIndices, transferType, *, loc=None, ip=None)

The amdgpu.gather_to_lds op is a wrapper around the global_load_lds instructions.

Operands: * $src: global memory (including fat buffer) memref to read from. * $srcIndices: indices into $src to read from for this thread. * $dst: LDS memory memref to write to. * $dstIndices: base indices into $dst to write to for the subgroup of this thread.

The elements gathered by the subgroup will be written contiguously in order of lane ID starting at $dst[$dstIndices]. Byte-sized (ex. i8) or short-sized (ex. i16) types will be zero-padded/extended to 32 bits before being written. 96-bit types (ex. vector<3xf32>) will be zero-padded to 128 bits before being written. Only the offsets held by lane 0 are used.

  • $transferType: type of the data to be transferred by each thread. This is used to determine the size of the data to be transferred and the number of threads in the subgroup. The transfer type must be a scalar type or a vector type with a single element type.

The $dst, along with its indices, points to the memory location the subgroup of this thread will write to.

Note: only supported on gfx9 and gfx10.

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.GatherToLDSOpAdaptor

OPERATION_NAME = 'amdgpu.gather_to_lds'
property dst: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property dstIndices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property src: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property srcIndices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property transferType: iree.compiler._mlir_libs._mlir.ir.TypeAttr
class iree.compiler.dialects.amdgpu.GatherToLDSOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.gather_to_lds'
property dst: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property dstIndices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property src: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property srcIndices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property transferType: iree.compiler._mlir_libs._mlir.ir.TypeAttr
enum iree.compiler.dialects.amdgpu.IntEnum(value)

Enum where members are also (and must be) ints

Member Type

int

flag iree.compiler.dialects.amdgpu.IntFlag(value)

Support for integer-based Flags

Member Type

int

class iree.compiler.dialects.amdgpu.LDSBarrierOp(*, loc=None, ip=None)

DEPRECATION NOTICE: Unless you need the inline-assembly-based workaround for gfx908/MI-100, you should represent this pattern with the equivalent

`mlir gpu.barrier memfence [#gpu.address_space<workgroup>] `

instead.

amdgpu.lds_barrier is both a barrier (all workitems in a workgroup must reach the barrier before any of them may proceed past it) and a wait for all operations that affect the Local Data Store (LDS) issued from that workgroup to complete before the workgroup may continue. Since the LDS is per-workgroup memory, this barrier may be used, for example, to ensure all workitems have written data to LDS before any workitem attempts to read from it.

Note that lds_barrier does not force reads to or from global memory to complete before execution continues. Therefore, it should be used when operations on global memory can be issued far in advance of when their results are used (for example, by writing them to LDS).

WARNING: On architectures that do not support the BackOffBarrier feature, (those which will implement this barrier by emitting inline assembly), use of this operation will impede the usabiliity of memory watches (including breakpoints set on variables) when debugging.

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.LDSBarrierOpAdaptor

OPERATION_NAME = 'amdgpu.lds_barrier'
class iree.compiler.dialects.amdgpu.LDSBarrierOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.lds_barrier'
class iree.compiler.dialects.amdgpu.MFMAOp(m, n, k, sourceA, sourceB, destC, *, blocks=None, cbsz=None, abid=None, blgp=None, reducePrecision=None, negateA=None, negateB=None, negateC=None, results=None, loc=None, ip=None)

The amdgpu.mfma op is an MLIR wrapper around intrinsics for various mfma instructions in the CDNA architecture, which perform multiple outer products in order to allow fast matrix multiplication.

The wrapper will select an appropriate mfma instruction, if one is available, based on the provided m, k, n, and nBlks attributes, along with the types of the source and destination arguments.

For information on the layouts of the input and output matrices (which are stored in sourceA, sourceB, destC, and destD), see the CDNA ISA documentation.

The cbsz, abid, and blgp parameters control how the lanes of the wave are permuted when matrix data is being loaded: blgp can be any number of fixed permutations, cbsz specifies the log_2 of the number of chunks the lanes holding sourceA are split into, and abid selects one of those chunks.

Note, this wrapper allows specifying vector<4Kxi8> arguments to MFMA intrinsics that take an integer type of width 4K. For example, one can provide a vector<4xi8> as an argument to an MFMA instruction that logically takes 4 i8s but whose intrinsics are specified to take an i32. In these cases, the bytes in the vector will be concatenated in little-endian order (that is, v[0] will go to arg[7:0], v[1] to arg[15:8] and so on).

The negateA, negateB, and negateC flags are only supported for double-precision operations on gfx94x.

Example: ```mlir

%0 = amdgpu.mfma 16x16x16 %matA * %matB + %matC

: vector<4xf16>, vector<4xf16>, vector<4xf32>

%1 = amdgpu.mfma 32x32x1 %matD * %matE + %matF

{ abid = 1 : i32, cbsz = 1 : i32, blocks = 2 : i32 } blgp = bcast_second_32 : f32, f32, vector<32xf32>

```

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.MFMAOpAdaptor

OPERATION_NAME = 'amdgpu.mfma'
property abid: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property blgp: iree.compiler._mlir_libs._mlir.ir.Attribute
property blocks: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property cbsz: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property destC: iree.compiler._mlir_libs._mlir.ir.Value
property destD: iree.compiler._mlir_libs._mlir.ir.OpResult
property k: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property m: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property n: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property negateA: bool
property negateB: bool
property negateC: bool
property reducePrecision: bool
property sourceA: iree.compiler._mlir_libs._mlir.ir.Value
property sourceB: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.MFMAOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.mfma'
property abid: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property blgp: iree.compiler._mlir_libs._mlir.ir.Attribute
property blocks: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property cbsz: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property destC: iree.compiler._mlir_libs._mlir.ir.Value
property k: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property m: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property n: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property negateA: bool
property negateB: bool
property negateC: bool
property reducePrecision: bool
property sourceA: iree.compiler._mlir_libs._mlir.ir.Value
property sourceB: iree.compiler._mlir_libs._mlir.ir.Value
enum iree.compiler.dialects.amdgpu.MFMAPermB(value)

The possible permutations of the lanes storing B available in an MFMA

Member Type

int

Valid values are as follows:

none = <MFMAPermB.none: 0>
bcast_first_32 = <MFMAPermB.bcast_first_32: 1>
bcast_second_32 = <MFMAPermB.bcast_second_32: 2>
rotate_16_right = <MFMAPermB.rotate_16_right: 3>
bcast_first_16 = <MFMAPermB.bcast_first_16: 4>
bcast_second_16 = <MFMAPermB.bcast_second_16: 5>
bcast_third_16 = <MFMAPermB.bcast_third_16: 6>
bcast_fourth_16 = <MFMAPermB.bcast_fourth_16: 7>
class iree.compiler.dialects.amdgpu.MakeDmaBaseOp(base, global_, global_indices, lds, lds_indices, *, loc=None, ip=None)

This operation creates a pair of addresses that will be used by tensor_load_to_lds and tensor_store_from_lds.

This operation creates a value corresponding to the tensor descriptor (D#) group 0 found in TensorLoadToLDSOp and TensorStoreFromLDSOp in the rocdl dialect.

For example:

```mlir

%base = amdgpu.make_dma_base %global[%idx0, %idx1], %lds[%idx2, %idx3] : memref<64x64xi32>, memref<64x64xi32, #gpu.address_space<workgroup>> -> !amdgpu.tdm_base<i32> %descriptor = amdgpu.make_dma_descriptor %base globalSize [2, 2] globalStride [2, 1] sharedSize [2, 2] : !amdgpu.tdm_base<i32> -> !amdgpu.tdm_descriptor amdgpu.tensor_load_to_lds %descriptor : !amdgpu.tdm_descriptor

```

to

```mlir

// pseudo-code %global_base = llvm.extractvalue %global_memref[1] %global_address = llvm.get_element_ptr …

%lds_base = llvm.extractvalue %lds_memref[1] %lds_address = llvm.get_element_ptr …

// Definition of %base %undef = llvm.mlir.undef : vector<4xi32> %v0 = llvm.insertelement %15, %undef[0] : vector<4xi32> %v1 = llvm.insertelement %lds_address, %v0[1] : vector<4xi32> %v2 = llvm.insertelement %global_address_low, %v1[2] : vector<4xi32> %base = llvm.insertelement %global_address_high, %v2[3] : vector<4xi32>

rocdl.tensor.load.to.lds %base, %dgroup1, %dgroup2, %dgroup3 cachepolicy 0 : vector<4xi32>, vector<8xi32>

```

These tensor DMA operations were introduced in gfx1250.

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.MakeDmaBaseOpAdaptor

OPERATION_NAME = 'amdgpu.make_dma_base'
property base: iree.compiler._mlir_libs._mlir.ir.OpResult
property global_: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property global_indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property lds: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property lds_indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.amdgpu.MakeDmaBaseOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.make_dma_base'
property global_: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property global_indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property lds: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property lds_indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.amdgpu.MakeDmaDescriptorOp(base, global_dynamic_sizes, global_static_sizes, global_dynamic_strides, global_static_strides, shared_dynamic_sizes, shared_static_sizes, atomic_barrier_indices, *, workgroup_mask=None, early_timeout=None, pad_amount=None, pad_interval=None, atomic_barrier_address=None, global_increment=None, lds_increment=None, iteration_count=None, results=None, loc=None, ip=None)

Make all descriptor groups needed by tensor memory operations.

The $base operand corresponds to the base pair addresses, one must be an address in LDS while the other must be a global memory location.

$global_{static/dynamic}_sizes determine the size of the tensor. $global_{static/dynamic}_strides determine the strides of the tensor. $shared_{static/dynamic}_sizes determines the size of the tile.

$workgroup_mask broadcast load to workgroups inside of a workgroup cluster (0 = do not broadcast result to workgroup, 1 = broadcast result to workgroup). Ignored for stores. An all zeros mask is interpreted as a non-broadcasted load.

$early_timeout return data to requesters as soon as cache supplies it.

Padding can be applied to the LDS address when copying from memory to LDS, but not when copying from LDS to memory. The values in the padded target addresses remain the same as before the operation was applied. $pad_interval must be a power of two contained in [2, 256]. $pad_amount must be a value contained in [1, 128].

$atomic_barrier_address must be aligned to 8 bytes.

2D and 3D tensors may be iterated over by setting $global_increment, $lds_increment, and $iteration_count. $global_increment determines how much to increment the starting global memory address per iteration in units of the $base’s element type. $lds_increment determines how much to increment the starting LDS address per iteration in units of the $base’s element type. $iterate_count determines how many times to iterate, it must be a value in the inclusive interval [1, 256].

```mlir

// Example of moving a two-dimensional tensor to LDS. %base = amdgpu.make_dma_base %global[0, 0], %lds[0, 0] : memref<64x64xi32>, memref<64x64xi32, #gpu.address_space<workgroup>> -> !amdgpu.tdm_base<i32> %descriptor = amdgpu.make_dma_descriptor %base globalSize [64, 64] globalStride [64, 1] sharedSize [64, 64] : !amdgpu.tdm_base<i32> -> !amdgpu.tdm_descriptor amdgpu.tensor_load_to_lds %descriptor : !amdgpu.tdm_descriptor

// Example of moving a two dimension tensor to LDS where padding is applied after every integer. %base = amdgpu.make_dma_base %global[0, 0], %lds[0, 0] : memref<32x32xi32>, memref<64x64xi32, #gpu.address_space<workgroup>> -> !amdgpu.tdm_base<i32> %descriptor = amdgpu.make_dma_descriptor %base globalSize [32, 32] globalStride [32, 1] sharedSize [64, 64] padShared(%pad_amount every %pad_interval) : !amdgpu.tdm_base<i32> -> !amdgpu.tdm_descriptor amdgpu.tensor_load_to_lds %descriptor : !amdgpu.tdm_descriptor

```

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.MakeDmaDescriptorOpAdaptor

OPERATION_NAME = 'amdgpu.make_dma_descriptor'
property atomic_barrier_address: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]]
property atomic_barrier_indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property base: iree.compiler._mlir_libs._mlir.ir.Value
property desc: iree.compiler._mlir_libs._mlir.ir.OpResult
property early_timeout: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property global_dynamic_sizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property global_dynamic_strides: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property global_increment: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IndexType]]
property global_static_sizes: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property global_static_strides: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property iteration_count: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IndexType]]
property lds_increment: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property pad_amount: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property pad_interval: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property shared_dynamic_sizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property shared_static_sizes: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property workgroup_mask: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]]
class iree.compiler.dialects.amdgpu.MakeDmaDescriptorOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.make_dma_descriptor'
property atomic_barrier_address: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]]
property atomic_barrier_indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property base: iree.compiler._mlir_libs._mlir.ir.Value
property early_timeout: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property global_dynamic_sizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property global_dynamic_strides: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property global_increment: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IndexType]]
property global_static_sizes: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property global_static_strides: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property iteration_count: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IndexType]]
property lds_increment: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property pad_amount: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property pad_interval: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property shared_dynamic_sizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property shared_static_sizes: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property workgroup_mask: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]]
class iree.compiler.dialects.amdgpu.MakeGatherDmaBaseOp(base, global_, global_indices, lds, lds_indices, *, loc=None, ip=None)

This operation creates a pair of addresses that will be used by tensor_load_to_lds and tensor_store_from_lds.

This operation creates a value corresponding to the tensor descriptor (D#) group 0 found in TensorLoadToLDSOp and TensorStoreFromLDSOp in the rocdl dialect.

Unlike make_dma_base, this operation returns !amdgpu.tdm_gather_base<$element_type, $index_type> which is only compatible with make_gather_dma_descriptor. Using the descriptor returned by make_gather_dma_descriptor will set the tensor_load_to_lds and tensor_store_from_lds to gather mode.

```mlir

%base = amdgpu.make_gather_dma_base %global[%idx0, %idx1], %lds[%idx2, %idx3] : memref<64x64xi32>, memref<64x64xi32, #gpu.address_space<workgroup>> -> !amdgpu.tdm_gather_base<i32, i16> // %indices : i16 %descriptor = amdgpu.make_gather_dma_descriptor %base[%indices] globalSize [2, 2] globalStride [2, 1] sharedSize [2, 2] : !amdgpu.tdm_gather_base<i32, i16>, i16 -> !amdgpu.tdm_descriptor amdgpu.tensor_load_to_lds %descriptor : !amdgpu.tdm_descriptor

```

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.MakeGatherDmaBaseOpAdaptor

OPERATION_NAME = 'amdgpu.make_gather_dma_base'
property base: iree.compiler._mlir_libs._mlir.ir.OpResult
property global_: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property global_indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property lds: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property lds_indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.amdgpu.MakeGatherDmaBaseOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.make_gather_dma_base'
property global_: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property global_indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property lds: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property lds_indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.amdgpu.MakeGatherDmaDescriptorOp(base, indices, global_dynamic_sizes, global_static_sizes, global_dynamic_strides, global_static_strides, shared_dynamic_sizes, shared_static_sizes, atomic_barrier_indices, *, workgroup_mask=None, early_timeout=None, pad_amount=None, pad_interval=None, atomic_barrier_address=None, global_increment=None, lds_increment=None, iteration_count=None, results=None, loc=None, ip=None)
Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.MakeGatherDmaDescriptorOpAdaptor

OPERATION_NAME = 'amdgpu.make_gather_dma_descriptor'
property atomic_barrier_address: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]]
property atomic_barrier_indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property base: iree.compiler._mlir_libs._mlir.ir.Value
property desc: iree.compiler._mlir_libs._mlir.ir.OpResult
property early_timeout: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property global_dynamic_sizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property global_dynamic_strides: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property global_increment: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IndexType]]
property global_static_sizes: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property global_static_strides: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property indices: iree.compiler._mlir_libs._mlir.ir.Value
property iteration_count: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IndexType]]
property lds_increment: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property pad_amount: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property pad_interval: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property shared_dynamic_sizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property shared_static_sizes: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property workgroup_mask: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]]
class iree.compiler.dialects.amdgpu.MakeGatherDmaDescriptorOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.make_gather_dma_descriptor'
property atomic_barrier_address: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]]
property atomic_barrier_indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property base: iree.compiler._mlir_libs._mlir.ir.Value
property early_timeout: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property global_dynamic_sizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property global_dynamic_strides: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property global_increment: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IndexType]]
property global_static_sizes: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property global_static_strides: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property indices: iree.compiler._mlir_libs._mlir.ir.Value
property iteration_count: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IndexType]]
property lds_increment: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property pad_amount: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property pad_interval: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property shared_dynamic_sizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property shared_static_sizes: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property workgroup_mask: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]]
class iree.compiler.dialects.amdgpu.MemoryCounterWaitOp(*, load=None, store=None, ds=None, exp=None, tensor=None, loc=None, ip=None)

Wait for the specified counters to be less-than or equal-to the provided values before continuing.

Counters can lower to different instructions on different architectires, including clamping to the some HW supported max value or combining multiple counters into one.

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.MemoryCounterWaitOpAdaptor

OPERATION_NAME = 'amdgpu.memory_counter_wait'
property ds: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property exp: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property load: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property store: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property tensor: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
class iree.compiler.dialects.amdgpu.MemoryCounterWaitOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.memory_counter_wait'
property ds: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property exp: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property load: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property store: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property tensor: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
class iree.compiler.dialects.amdgpu.PackedScaledTruncOp(res, source, scale, index, *, existing=None, loc=None, ip=None)

Scale and round the inputs source (which is undefined if not specified) into the low or high word (bottom two or top two) elements of the returned vector, keeping the other two elements of existing unchanged if present (or undefined if it was not passed in).

The reason for this odd signature is that AMD GPUs cannot easily work with sub-registers, and so the conversion intrinsics take 32-bit wide packed vectors of float values.

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.PackedScaledTruncOpAdaptor

OPERATION_NAME = 'amdgpu.packed_scaled_trunc'
property existing: Optional[iree.compiler._mlir_libs._mlir.ir.Value]
property index: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property res: iree.compiler._mlir_libs._mlir.ir.OpResult
property scale: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.FloatType]
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.amdgpu.PackedScaledTruncOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.packed_scaled_trunc'
property existing: Optional[iree.compiler._mlir_libs._mlir.ir.Value]
property index: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property scale: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.FloatType]
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.amdgpu.PackedStochRoundFp8Op(res, source, stochiasticParam, storeIndex, *, existing=None, loc=None, ip=None)

Round the input source, adding in stochiasticParam, and place it into the storeIndex`th element of `res.

If existing is passed in, elements of res other than the one at storeIndex are copied from existing.

The reason for this odd signature is that AMD GPUs cannot easily work with sub-registers, and so the conversion intrinsics (which are currently the only way to work with 8-bit float types) take packed vectors of 4 8-bit values.

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.PackedStochRoundFp8OpAdaptor

OPERATION_NAME = 'amdgpu.packed_stoch_round_fp8'
property existing: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]]
property res: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.VectorType]
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.FloatType]
property stochiasticParam: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]
property storeIndex: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
class iree.compiler.dialects.amdgpu.PackedStochRoundFp8OpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.packed_stoch_round_fp8'
property existing: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]]
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.FloatType]
property stochiasticParam: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]
property storeIndex: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
class iree.compiler.dialects.amdgpu.PackedTrunc2xFp8Op(res, sourceA, wordIndex, *, sourceB=None, existing=None, loc=None, ip=None)

Round the inputs sourceA and sourceB (which is undefined if not specified) into the low or high word (bottom two or top two) elements of the returned vector, keeping the other two elements of existing unchanged if present (or undefined if it was not passed in).

The reason for this odd signature is that AMD GPUs cannot easily work with sub-registers, and so the conversion intrinsics (which are currently the only way to work with 8-bit float types) take packed vectors of 4 8-bit values.

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.PackedTrunc2xFp8OpAdaptor

OPERATION_NAME = 'amdgpu.packed_trunc_2xfp8'
property existing: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]]
property res: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.VectorType]
property sourceA: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.FloatType]
property sourceB: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.FloatType]]
property wordIndex: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
class iree.compiler.dialects.amdgpu.PackedTrunc2xFp8OpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.packed_trunc_2xfp8'
property existing: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]]
property sourceA: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.FloatType]
property sourceB: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.FloatType]]
property wordIndex: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
class iree.compiler.dialects.amdgpu.PermlaneSwapOp(src, row_length, *, fetch_inactive=None, bound_ctrl=None, results=None, loc=None, ip=None)

High-level wrapper on rocdl.permlane{16,32}.swap variants for permutations on rows of lanes in a subgroup.

Supports arbitrary int/float/vector types, which will be repacked to i32 and one or more rocdl.permlane_swap ops during lowering. Supported lane permutations: - Swap the data between odd and even rows of 16 lanes - Swap the data between the first 32 lanes and the last 32 lanes

Example: `mlir %0 = amdgpu.permlane_swap %src 16 : f16 %1 = amdgpu.permlane_swap %src 32 { fetch_inactive = true, bound_ctrl = true } : f16 `

Operands: * $src: Vector register to permute across lanes of the subgroup. * $row_length: The length of a row to permute in number of lanes (valid values are 16 and 32). * $fetch_inactive: Optional. Used to dertermine behavior of a fetch from a disabled lane.

fetch_inactive = false: If the source lane is disabled, use bound_ctrl to determine the source value. fetch_inactive = true: If the source lane is disabled, fetch the source value anyway (ignoring bound_ctrl).

  • $bound_ctrl: Optional. Used to determine what a thread should do if its source operand is from a disabled lane: use the value zero, or disable the write. bound_ctrl = false: Do not write when source is from a disabled lane bound_ctrl = true: Use zero as input if source is from a disabled lane

Note: Lowering is only supported on gfx950 and up.

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.PermlaneSwapOpAdaptor

OPERATION_NAME = 'amdgpu.permlane_swap'
property bound_ctrl: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property fetch_inactive: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property row_length: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property src: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.PermlaneSwapOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.permlane_swap'
property bound_ctrl: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property fetch_inactive: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property row_length: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property src: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.RawBufferAtomicCmpswapOp(src, cmp, memref, indices, *, boundsCheck=None, indexOffset=None, sgprOffset=None, results=None, loc=None, ip=None)

The amdgpu.raw_buffer_atomic_cmpswap op is a wrapper around the buffer-based atomic compare-and-swap min available on AMD GPUs.

The index into the buffer is computed as for memref.store with the addition of indexOffset (which is used to aid in emitting vectorized code) and, if present sgprOffset (which is added after bounds checks and includes any non-zero offset on the memref type).

All indexing components are given in terms of the memref’s element size, not the byte lengths required by the intrinsic.

Out of bounds atomic operations are ignored in hardware.

See amdgpu.raw_buffer_load for a description of how the underlying instruction is constructed.

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.RawBufferAtomicCmpswapOpAdaptor

OPERATION_NAME = 'amdgpu.raw_buffer_atomic_cmpswap'
property boundsCheck: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property cmp: iree.compiler._mlir_libs._mlir.ir.Value
property indexOffset: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property sgprOffset: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property src: iree.compiler._mlir_libs._mlir.ir.Value
property value: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.amdgpu.RawBufferAtomicCmpswapOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.raw_buffer_atomic_cmpswap'
property boundsCheck: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property cmp: iree.compiler._mlir_libs._mlir.ir.Value
property indexOffset: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property sgprOffset: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property src: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.RawBufferAtomicFaddOp(value, memref, indices, *, boundsCheck=None, indexOffset=None, sgprOffset=None, loc=None, ip=None)

The amdgpu.raw_buffer_atomic_fadd op is a wrapper around the buffer-based atomic floating point addition available on the MI-* series of AMD GPUs.

The index into the buffer is computed as for memref.store with the addition of indexOffset (which is used to aid in emitting vectorized code) and, if present sgprOffset (which is added after bounds checks and includes any non-zero offset on the memref type).

All indexing components are given in terms of the memref’s element size, not the byte lengths required by the intrinsic.

Out of bounds atomic operations are ignored in hardware.

See amdgpu.raw_buffer_load for a description of how the underlying instruction is constructed.

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.RawBufferAtomicFaddOpAdaptor

OPERATION_NAME = 'amdgpu.raw_buffer_atomic_fadd'
property boundsCheck: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property indexOffset: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property sgprOffset: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property value: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.RawBufferAtomicFaddOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.raw_buffer_atomic_fadd'
property boundsCheck: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property indexOffset: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property sgprOffset: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property value: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.RawBufferAtomicFmaxOp(value, memref, indices, *, boundsCheck=None, indexOffset=None, sgprOffset=None, loc=None, ip=None)

The amdgpu.raw_buffer_atomic_fmax op is a wrapper around the buffer-based atomic floating point max available on AMD GPUs (except GFX9).

The index into the buffer is computed as for memref.store with the addition of indexOffset (which is used to aid in emitting vectorized code) and, if present sgprOffset (which is added after bounds checks and includes any non-zero offset on the memref type).

All indexing components are given in terms of the memref’s element size, not the byte lengths required by the intrinsic.

Out of bounds atomic operations are ignored in hardware.

See amdgpu.raw_buffer_load for a description of how the underlying instruction is constructed.

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.RawBufferAtomicFmaxOpAdaptor

OPERATION_NAME = 'amdgpu.raw_buffer_atomic_fmax'
property boundsCheck: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property indexOffset: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property sgprOffset: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property value: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.RawBufferAtomicFmaxOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.raw_buffer_atomic_fmax'
property boundsCheck: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property indexOffset: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property sgprOffset: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property value: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.RawBufferAtomicSmaxOp(value, memref, indices, *, boundsCheck=None, indexOffset=None, sgprOffset=None, loc=None, ip=None)

The amdgpu.raw_buffer_atomic_smax op is a wrapper around the buffer-based atomic signed integer max available on AMD GPUs.

The index into the buffer is computed as for memref.store with the addition of indexOffset (which is used to aid in emitting vectorized code) and, if present sgprOffset (which is added after bounds checks and includes any non-zero offset on the memref type).

All indexing components are given in terms of the memref’s element size, not the byte lengths required by the intrinsic.

Out of bounds atomic operations are ignored in hardware.

See amdgpu.raw_buffer_load for a description of how the underlying instruction is constructed.

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.RawBufferAtomicSmaxOpAdaptor

OPERATION_NAME = 'amdgpu.raw_buffer_atomic_smax'
property boundsCheck: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property indexOffset: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property sgprOffset: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property value: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]
class iree.compiler.dialects.amdgpu.RawBufferAtomicSmaxOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.raw_buffer_atomic_smax'
property boundsCheck: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property indexOffset: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property sgprOffset: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property value: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]
class iree.compiler.dialects.amdgpu.RawBufferAtomicUminOp(value, memref, indices, *, boundsCheck=None, indexOffset=None, sgprOffset=None, loc=None, ip=None)

The amdgpu.raw_buffer_atomic_umin op is a wrapper around the buffer-based atomic signed integer min available on AMD GPUs.

The index into the buffer is computed as for memref.store with the addition of indexOffset (which is used to aid in emitting vectorized code) and, if present sgprOffset (which is added after bounds checks and includes any non-zero offset on the memref type).

All indexing components are given in terms of the memref’s element size, not the byte lengths required by the intrinsic.

Out of bounds atomic operations are ignored in hardware.

See amdgpu.raw_buffer_load for a description of how the underlying instruction is constructed.

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.RawBufferAtomicUminOpAdaptor

OPERATION_NAME = 'amdgpu.raw_buffer_atomic_umin'
property boundsCheck: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property indexOffset: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property sgprOffset: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property value: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]
class iree.compiler.dialects.amdgpu.RawBufferAtomicUminOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.raw_buffer_atomic_umin'
property boundsCheck: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property indexOffset: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property sgprOffset: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property value: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]
class iree.compiler.dialects.amdgpu.RawBufferLoadOp(value, memref, indices, *, boundsCheck=None, indexOffset=None, sgprOffset=None, loc=None, ip=None)

The amdgpu.raw_buffer_load op is a wrapper around the buffer load intrinsics available on AMD GPUs, including extensions in newer GPUs.

The index into the buffer is computed as for memref.load with the additon of indexOffset and sgprOffset (which may or may not be considered in bounds checks and includes any offset present on the memref type if it’s non-zero).

All indices and offsets are in units of the memref’s data type and are converted to bytes during lowering.

When a load is out of bounds, the instruction returns zero. Partially-out of bounds have chipset-dependent behavior: whether reading 2 elements starting at index 7 of a memref<8xf32> returns the last element in the first vector component depends on the architecture.

The memref struct is converted into a buffer resource (a V#) and the arguments are translated to intrinsic arguments as follows: - The base address of the buffer is the base address of the memref - The stride is 0 to enable raw mode - The number of records is the size of the memref, in bytes

In the case of dynamically-shaped memrefs, this is computed at runtime as max_d (size(d) * stride(d)) * sizeof(elementType(memref))

  • The offset enable bit is 1, the index enable bit is 0.

  • The thread ID addition bit is off

  • If boundsCheck is false and the target chipset is RDNA, OOB_SELECT is set to 2 to disable bounds checks, otherwise it is 3

  • The cache coherency bits are off

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.RawBufferLoadOpAdaptor

OPERATION_NAME = 'amdgpu.raw_buffer_load'
property boundsCheck: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property indexOffset: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property sgprOffset: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property value: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.amdgpu.RawBufferLoadOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.raw_buffer_load'
property boundsCheck: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property indexOffset: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property sgprOffset: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
class iree.compiler.dialects.amdgpu.RawBufferStoreOp(value, memref, indices, *, boundsCheck=None, indexOffset=None, sgprOffset=None, loc=None, ip=None)

The amdgpu.raw_buffer_store op is a wrapper around the buffer store intrinsics available on AMD GPUs, including extensions in newer GPUs.

The store index is computed as in memref.store with the addition of indexOffset (which is included for uniformity with atomics and may be useful when writing vectorized code) and sgprOffset (which is added after bounds checks and implicitly includes the offset of the memref type if non-zero). All index components are in terms of the elements of the memref, not bytes, and are scaled up appropriately.

Out of bounds stores are ignored in hardware. Wthether a vector write that includes some in-bounds and soeme out-of-bounds components is partically completed is chipset-dependent.

See amdgpu.raw_buffer_load for a description of how the underlying instruction is constructed.

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.RawBufferStoreOpAdaptor

OPERATION_NAME = 'amdgpu.raw_buffer_store'
property boundsCheck: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property indexOffset: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property sgprOffset: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property value: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.RawBufferStoreOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.raw_buffer_store'
property boundsCheck: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property indexOffset: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property sgprOffset: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]]
property value: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.ScaledExtPackedMatrixOp(res, source, scale, blockSize, firstScaleLane, firstScaleByte, *, loc=None, ip=None)

Extend matrix of microfloats (8 or 16 elements per lane) using a set of scales that may be stored on other lanes.

The scales applied to the input microfloats are stored in bytes which come from the scales input provided in a half of the wave identified by firstScaleLane. The bytes used is selected by firstScaleByte and depends on the type of source. The 16 vectors in consecutive lanes starting from firstScaleLane (which we’ll call the scale vectors) will be used by both halves of the wave (with lane L reading from L % 16’th scale vector).

When source is either F4E2M1FN, F6E2M3FN, or F6E3M2FN each half of the wave will use a different byte. The first one being firstScaleByte and the second one being firstScaleByte + 1. When the block size is 32, firstScaleByte can be either 0 or 2, selecting halves of the scale vectors. Lanes 0-15 will read from firstScaleByte and lanes 16-31 will read from firstScaleByte + 1.

For example: ```mlir // Input: 8-element vector of F8E4M3FN, converting to F32 // Lanes 0-15 read from byte 0, lanes 16-31 read from byte 1 %result = amdgpu.scaled_ext_packed_matrix %source scale(%scales)

blockSize(32) firstScaleLane(0) firstScaleByte(0) : vector<8xf8E4M3FN>, vector<4xf8E8M0FNU> -> vector<8xf32>

// Input: 16-element vector of F6E2M3FN, converting to F16 // Lanes 0-15 read from byte 2, lanes 16-31 read from byte 3 %result = amdgpu.scaled_ext_packed_matrix %source scale(%scales)

blockSize(32) firstScaleLane(16) firstScaleByte(2) : vector<16xf6E2M3FN>, vector<4xf8E8M0FNU> -> vector<16xf16>

```

When source is either F4E2M1FN, F6E2M3FN, or F6E3M2FN and the block size is 16, firstScaleByte can be 0 or 1. Lanes 0-15 read from the firstScaleByte`th element of the scale vectors, while lanes 16-31 read from `firstScaleByte + 2. For example: ```mlir // Input: 8-element vector of F8E5M2, converting to BF16 // Lanes 0-15 read from byte 0, lanes 16-31 read from byte 2 (0+2) %result = amdgpu.scaled_ext_packed_matrix %source scale(%scales)

blockSize(16) firstScaleLane(0) firstScaleByte(0) : vector<8xf8E5M2>, vector<4xf8E8M0FNU> -> vector<8xbf16>

// Input: 16-element vector of F6E3M2FN, converting to F32 // Lanes 0-15 read from byte 1, lanes 16-31 read from byte 3 (1+2) %result = amdgpu.scaled_ext_packed_matrix %source scale(%scales)

blockSize(16) firstScaleLane(16) firstScaleByte(1) : vector<16xf6E3M2FN>, vector<4xf8E8M0FNU> -> vector<16xf32>

```

Note: the layout for the scales generally mirrors how the WMMA instructions use for matrix scales. These selection operands allows one to choose portions of the matrix to convert.

When source is either F8E4M3FN or F8E5M2 and blockSize is 32, then the same byte will be used by both halves of the wave. In this case, firstScaleByte can be any value from 0 to 3.

When source is either F8E4M3FN or F8E5M2 and blockSize is 16, following combinations are allowed: * firstScaleLane(0), firstScaleByte(0) * firstScaleLane(16), firstScaleByte(2) all other combinations are reserved.

Available on gfx1250+.

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.ScaledExtPackedMatrixOpAdaptor

OPERATION_NAME = 'amdgpu.scaled_ext_packed_matrix'
property blockSize: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property firstScaleByte: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property firstScaleLane: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property res: iree.compiler._mlir_libs._mlir.ir.OpResult
property scale: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property source: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.ScaledExtPackedMatrixOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.scaled_ext_packed_matrix'
property blockSize: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property firstScaleByte: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property firstScaleLane: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property scale: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property source: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.ScaledExtPackedOp(res, source, scale, index, *, loc=None, ip=None)

Extend and scale two packed floats in source[index] to two floats and return them.

This rather unusual signature arises from the fact that AMD GPUs cannot easily work with sub 32-bit quantities, so the compiler intrinsics for extending 8-bit floats (which are, currently, the only way to work with this operation) take packed vectors of 2 such floats.

If the passed-in vector has fewer than two elements, or the input is scalar, the remaining values in the <2 x i8> will be filled with undefined values as needed.

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.ScaledExtPackedOpAdaptor

OPERATION_NAME = 'amdgpu.scaled_ext_packed'
property index: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property res: iree.compiler._mlir_libs._mlir.ir.OpResult
property scale: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.FloatType]
property source: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.ScaledExtPackedOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.scaled_ext_packed'
property index: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property scale: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.FloatType]
property source: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.ScaledMFMAOp(m, n, k, sourceA, sourceB, destC, scalesA, scalesB, scalesIdxA, scalesIdxB, *, results=None, loc=None, ip=None)

The amdgpu.scaled_mfma op is an MLIR wrapper around intrinsics for various scaled versions of mfma instructions in the CDNA architecture, which perform multiple outer products in order to allow fast matrix multiplication.

The wrapper will select an appropriate mfma instruction, if one is available, based on the provided m, k, n, and nBlks attributes, along with the types of the source and destination arguments.

Note, this wrapper allows specifying vector<4Kxi8> arguments to MFMA intrinsics that take an integer type of width 4K. For example, one can provide a vector<4xi8> as an argument to an MFMA instruction that logically takes 4 i8s but whose intrinsics are specified to take an i32. In these cases, the bytes in the vector will be concatenated in little-endian order (that is, v[0] will go to arg[7:0], v[1] to arg[15:8] and so on).

This wrapper takes inspiration from amdgpu.mfma, but has some key differences: - amdgpu.scaled_mfma operates on fp4 (f4E2M1FN), fp6 (f6E2M3FN and f6E3M2FN) and

fp8 (f8E4M3FN and f8E5M2) types using either M=N=16, K=128 or M=N=32, K=64 as their tile size.

  • amdgpu.scaled_mfma does not support broadcasting. So, cbsz, abid, and blgp are omitted from this wrapper.

  • The negateA, negateB, and negateC flags in amdgpu.mfma are only supported for double-precision operations on gfx94x and so are not included here.

Example: ```mlir

%0 = amdgpu.scaled_mfma 32x32x64 (%arg0[0] * %arg1) * (%arg0[1] * %arg1) + %arg2

: vector<4xf8E8M0FNU>, vector<32xf6E2M3FN>, f8E8M0FNU, vector<32xf6E2M3FN>, vector<16xf32>

```

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.ScaledMFMAOpAdaptor

OPERATION_NAME = 'amdgpu.scaled_mfma'
property destC: iree.compiler._mlir_libs._mlir.ir.Value
property destD: iree.compiler._mlir_libs._mlir.ir.OpResult
property k: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property m: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property n: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property scalesA: iree.compiler._mlir_libs._mlir.ir.Value
property scalesB: iree.compiler._mlir_libs._mlir.ir.Value
property scalesIdxA: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property scalesIdxB: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property sourceA: iree.compiler._mlir_libs._mlir.ir.Value
property sourceB: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.ScaledMFMAOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.scaled_mfma'
property destC: iree.compiler._mlir_libs._mlir.ir.Value
property k: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property m: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property n: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property scalesA: iree.compiler._mlir_libs._mlir.ir.Value
property scalesB: iree.compiler._mlir_libs._mlir.ir.Value
property scalesIdxA: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property scalesIdxB: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property sourceA: iree.compiler._mlir_libs._mlir.ir.Value
property sourceB: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.ScaledWMMAOp(m, n, k, sourceA, sourceB, destC, scaleA, a_first_scale_lane, scaleB, b_first_scale_lane, *, results=None, loc=None, ip=None)

The amdgpu.scaled_wmma op is an MLIR wrapper around intrinsics for scaled wmma instructions. These instructions perform matrix multiplication with per-block scaling of inputs, supporting fp4, fp6, and fp8 data formats.

The scale instructions support a block size of 16 or 32 and two tile sizes: - 16x16x128 with mixed f8/f6/f4 formats (output: vector<8xf32>) - 32x16x128 with f4 format only (output: vector<16xf32>)

Scale parameters (scaleA, scaleB) are small vectors of f8 scale values (either f8E8M0FNU, or f8E4M3FN) that are packed into i32/i64 values during lowering. Each lane can operate on 4 bytes (4 scale values), and the number of scales required for each matrix is determined by:

num_scales_A = (M × K) / block_size num_scales_B = (N × K) / block_size

The index attributes (a_first_scale_lane, b_first_scale_lane) select which lane to start reading scale values from (0 or 16): - For block size 32, 32 lanes across a single wave are used for the scale values. If the number of scales (num_scales_A or num_scales_B) can fit into half of the available lanes (i.e., num_scales / scales_per_lane == 16 (num_lanes)), then then first_scale_lane can be either 0 or 16. If all lanes are required for storing the scale values (num_scales / scales_per_lane == 32 (num_lanes)), then the first_scale_lane must be 0. - For block size 16, the same rules apply as above except that there are 64 lanes across two waves that are used for the scale values. When num_scales / scales_per_lane == 32 (num lanes), then 16 lanes from each wave are used. first_scale_lane of 0 or 16 will decide which lanes are used for this. When num_scales / scales_per_lane == 64 (num_lanes), then first_scale_lane must be set to 0.

Example: ```mlir

// 16x16x128: fp8 inputs %0 = amdgpu.scaled_wmma 16x16x128 (%scaleVecA * %matA) * (%scaleVecB * %matB) + %matC

{a_first_scale_lane = 0 : i32, b_first_scale_lane = 0 : i32} : vector<4xf8E8M0FNU>, vector<64xf8E4M3FN>, vector<4xf8E8M0FNU>, vector<64xf8E4M3FN>, vector<8xf32>

// 32x16x128: fp4 inputs with different scale lanes %1 = amdgpu.scaled_wmma 32x16x128 (%scaleVecD * %matD) * (%scaleVecE * %matE) + %matF

{a_first_scale_lane = 0 : i32, b_first_scale_lane = 16 : i32} : vector<8xf8E4M3FN>, vector<128xf4E2M1FN>, vector<8xf8E4M3FN>, vector<64xf4E2M1FN>, vector<16xf32>

```

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.ScaledWMMAOpAdaptor

OPERATION_NAME = 'amdgpu.scaled_wmma'
property a_first_scale_lane: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property b_first_scale_lane: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property destC: iree.compiler._mlir_libs._mlir.ir.Value
property destD: iree.compiler._mlir_libs._mlir.ir.OpResult
property k: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property m: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property n: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property scaleA: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property scaleB: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property sourceA: iree.compiler._mlir_libs._mlir.ir.Value
property sourceB: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.ScaledWMMAOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.scaled_wmma'
property a_first_scale_lane: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property b_first_scale_lane: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property destC: iree.compiler._mlir_libs._mlir.ir.Value
property k: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property m: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property n: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property scaleA: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property scaleB: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property sourceA: iree.compiler._mlir_libs._mlir.ir.Value
property sourceB: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.SchedBarrierOp(opts, *, loc=None, ip=None)

amdgpu.sched_barrier serves as a barrier that could be configured to restrict movements of instructions through it as defined by sched_barrier_opts.

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.SchedBarrierOpAdaptor

OPERATION_NAME = 'amdgpu.sched_barrier'
property opts: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.amdgpu.SchedBarrierOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.sched_barrier'
property opts: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.amdgpu.SparseMFMAOp(m, n, k, sourceA, sourceB, destC, sparseIdx, *, cbsz=None, abid=None, results=None, loc=None, ip=None)

The amdgpu.sparse_mfma op is an MLIR wrapper around intrinsics for various smfmac instructions in the AMDGPU architecture, which perform matrix multiply-accumulate operations using 2:4 structured sparsity on matrix A with dense matrices B, C, and D.

On gfx942, smfmac intrinsics support:
  • M=N=16, K=32 and M=N=32, K=16 for f16 and bf16 sources

  • M=N=16, K=64 and M=N=32, K=32 for i8 and fp8 sources

On gfx950, smfmac intrinsics additionally support:
  • M=N=16, K=64 and M=N=32, K=32 for f16 and bf16 sources

  • M=N=16, K=128 and M=N=32, K=64 for i8 and fp8 sources

The sparseIdx parameter contains packed indices identifying the positions of non-zero elements in the 2:4 sparse matrix A. For 16-bit source data, use vector<4xi8> (four 8-bit indices). For 8-bit source data, use vector<2xi16> (two 16-bit indices).

The cbsz and abid parameters are repurposed to select the index set. If cbsz == 0, then abid[1:0] selects which index set to use. If cbsz != 0, then the very first is selected.

Example: ```mlir

%0 = amdgpu.sparse_mfma 16x16x32 %matA * %matB + %matC sparse(%idxvector<4xi8>)

: vector<4xf16>, vector<8xf16>, vector<4xf32>

%1 = amdgpu.sparse_mfma 16x16x64 %matA * %matB + %matC sparse(%idxvector<2xi16>)

: vector<8xi8>, vector<16xi8>, vector<4xi32>

%2 = amdgpu.sparse_mfma 16x16x64 %matA * %matB + %matC sparse(%idxvector<2xi16>)

{ cbsz = 0 : i32, abid = 1 : i32 } : vector<8xf8E4M3FNUZ>, vector<16xf8E4M3FNUZ>, vector<4xf32>

```

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.SparseMFMAOpAdaptor

OPERATION_NAME = 'amdgpu.sparse_mfma'
property abid: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property cbsz: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property destC: iree.compiler._mlir_libs._mlir.ir.Value
property destD: iree.compiler._mlir_libs._mlir.ir.OpResult
property k: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property m: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property n: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property sourceA: iree.compiler._mlir_libs._mlir.ir.Value
property sourceB: iree.compiler._mlir_libs._mlir.ir.Value
property sparseIdx: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.SparseMFMAOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.sparse_mfma'
property abid: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property cbsz: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property destC: iree.compiler._mlir_libs._mlir.ir.Value
property k: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property m: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property n: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property sourceA: iree.compiler._mlir_libs._mlir.ir.Value
property sourceB: iree.compiler._mlir_libs._mlir.ir.Value
property sparseIdx: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.SwizzleBitModeOp(src, and_mask, or_mask, xor_mask, *, results=None, loc=None, ip=None)

High-level wrapper on bitmode rocdl.ds_swizzle op, masks are represented as separate fields so user won’t need to do manual bitpacking.

Supports arbitrary int/float/vector types, which will be repacked to i32 and one or more rocdl.ds_swizzle ops during lowering.

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.SwizzleBitModeOpAdaptor

OPERATION_NAME = 'amdgpu.swizzle_bitmode'
property and_mask: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property or_mask: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property src: iree.compiler._mlir_libs._mlir.ir.Value
property xor_mask: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
class iree.compiler.dialects.amdgpu.SwizzleBitModeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.swizzle_bitmode'
property and_mask: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property or_mask: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property src: iree.compiler._mlir_libs._mlir.ir.Value
property xor_mask: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
class iree.compiler.dialects.amdgpu.TDMBaseType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'amdgpu.tdm_base'
property typeid

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

class iree.compiler.dialects.amdgpu.TDMDescriptorType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'amdgpu.tdm_descriptor'
property typeid

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

class iree.compiler.dialects.amdgpu.TDMGatherBaseType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'amdgpu.tdm_gather_base'
property typeid

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

class iree.compiler.dialects.amdgpu.TensorLoadToLDSOp(desc, *, loc=None, ip=None)

Load tensors of up to five dimensions from global memory to LDS.

This operation was introduced in gfx1250.

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.TensorLoadToLDSOpAdaptor

OPERATION_NAME = 'amdgpu.tensor_load_to_lds'
property desc: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.TensorLoadToLDSOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.tensor_load_to_lds'
property desc: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.TensorStoreFromLDSOp(desc, *, loc=None, ip=None)

Store tensors of up to five dimensions from LDS to global memory.

This operation was introduced in gfx1250.

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.TensorStoreFromLDSOpAdaptor

OPERATION_NAME = 'amdgpu.tensor_store_from_lds'
property desc: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.TensorStoreFromLDSOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.tensor_store_from_lds'
property desc: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.amdgpu.TransposeLoadOp(result, src, srcIndices, *, loc=None, ip=None)

The amdgpu.transpose_load op is a wrapper around the ds_read_tr instructions. The transpose load op represents a subgroup load from LDS memory, where the subgroup of threads collectively reads a matrix from the source memref, with each thread reading a vector of the matrix, and gets a transposed matrix in as the result. That is, each thread reads a vector of the col-major matrix at different indices, and the thread’s read result is a vector of the corresponding row of the transposed matrix.

This op is a direct wrapper around the ROCDL ds_read_tr family intrinsics. Please refer to the CDNA4 ISA documentation for more details about its exact semantics.

Format example: ` %0 = amdgpu.transpose_load %src[%srcIndices] : memref<128x256xf16> -> vector<4xf16> ` Operands: * $src: LDS memref to read from. * $srcIndices: indices into $src to read from for this thread. * $result: target register this transpose load instruction will write to.

Note: Lowering is only supported on gfx950 and up.

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.TransposeLoadOpAdaptor

OPERATION_NAME = 'amdgpu.transpose_load'
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property src: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property srcIndices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.amdgpu.TransposeLoadOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.transpose_load'
property src: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property srcIndices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.amdgpu.WMMAOp(m, n, k, sourceA, sourceB, destC, *, subwordOffset=None, unsignedA=None, unsignedB=None, clamp=None, results=None, loc=None, ip=None)

The amdgpu.wmma op is an MLIR wrapper around intrinsics for various wmma instructions in the AMDGPU architecture, which perform matrix multiplication.

On gfx11/RDNA3, wmma intrinsics have M=N=K=16 dimensions.

On gfx12/RDNA4, wmma intrinsics have M=N=16 dimensions and support K=16 for all element types, and K=32 for i4 sources.

On gfx1250, wmma intrinsics have M=N=16 and K dimensions of 4, 32, 64, or 128, depending on the element types.

On gfx11/RDNA3, emitting f16->f16 (or bf16->bf16) wmma the output is a 16xf16 (or 16xbf16) vector containing only 8 valid values:

  • If subwordOffset is 0, then the output is stored at indices 0, 2, 4, …, 14.

  • If subwordOffset is 1, then the output is stored at indices 1, 3, 5, …, 15.

On gfx12/RDNA4 and gfx1250, the result is instead returned as vector where all the values are valid and the subwordOffset must be 0, as it cannot be used.

unsignedA and unsignedB flag that the int8 LLVM inputs are unsigned.

The clamp flag is used to saturate the output of type T to numeric_limits<T>::max() in case of overflow.

Example: ```mlir

%0 = amdgpu.wmma 16x16x16 %matA * %matB + %matC : vector<8xf16>, vector<8xf16>, vector<8xf16>

%1 = amdgpu.wmma 16x16x64 %matD * %matE + %matF : vector<32xi8>, vector<8xf32>, vector<8xf32>

%2 = amdgpu.wmma 16x16x128 %matG * %matH + %matI : vector<64xf4E2M1FN>, vector<64xf4E2M1FN>, vector<8xf32>

%3 = amdgpu.wmma 16x16x4 %matJ * %matK + %matL : vector<2xf32>, vector<2xf32>, vector<8xf32>

```

Adaptor

alias of iree.compiler.dialects._amdgpu_ops_gen.WMMAOpAdaptor

OPERATION_NAME = 'amdgpu.wmma'
property clamp: bool
property destC: iree.compiler._mlir_libs._mlir.ir.Value
property destD: iree.compiler._mlir_libs._mlir.ir.OpResult
property k: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property m: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property n: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property sourceA: iree.compiler._mlir_libs._mlir.ir.Value
property sourceB: iree.compiler._mlir_libs._mlir.ir.Value
property subwordOffset: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property unsignedA: bool
property unsignedB: bool
class iree.compiler.dialects.amdgpu.WMMAOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'amdgpu.wmma'
property clamp: bool
property destC: iree.compiler._mlir_libs._mlir.ir.Value
property k: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property m: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property n: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property sourceA: iree.compiler._mlir_libs._mlir.ir.Value
property sourceB: iree.compiler._mlir_libs._mlir.ir.Value
property subwordOffset: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property unsignedA: bool
property unsignedB: bool
class iree.compiler.dialects.amdgpu.auto(value=_auto_null)

Instances are replaced with an appropriate value in Enum class suites.

iree.compiler.dialects.amdgpu.dpp(old, src, kind, *, perm_argument=None, row_mask=None, bank_mask=None, bound_ctrl=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.amdgpu.ext_packed_fp8(res, source, index, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.amdgpu.fat_raw_buffer_cast(source, *, valid_bytes=None, cache_swizzle_stride=None, bounds_check=None, reset_offset=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.amdgpu.gather_to_lds(src, src_indices, dst, dst_indices, transfer_type, *, loc=None, ip=None) iree.compiler.dialects._amdgpu_ops_gen.GatherToLDSOp
iree.compiler.dialects.amdgpu.lds_barrier(*, loc=None, ip=None) iree.compiler.dialects._amdgpu_ops_gen.LDSBarrierOp
iree.compiler.dialects.amdgpu.make_dma_base(base, global_, global_indices, lds, lds_indices, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.amdgpu.make_dma_descriptor(base, global_dynamic_sizes, global_static_sizes, global_dynamic_strides, global_static_strides, shared_dynamic_sizes, shared_static_sizes, atomic_barrier_indices, *, workgroup_mask=None, early_timeout=None, pad_amount=None, pad_interval=None, atomic_barrier_address=None, global_increment=None, lds_increment=None, iteration_count=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.amdgpu.make_gather_dma_base(base, global_, global_indices, lds, lds_indices, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.amdgpu.make_gather_dma_descriptor(base, indices, global_dynamic_sizes, global_static_sizes, global_dynamic_strides, global_static_strides, shared_dynamic_sizes, shared_static_sizes, atomic_barrier_indices, *, workgroup_mask=None, early_timeout=None, pad_amount=None, pad_interval=None, atomic_barrier_address=None, global_increment=None, lds_increment=None, iteration_count=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.amdgpu.memory_counter_wait(*, load=None, store=None, ds=None, exp=None, tensor=None, loc=None, ip=None) iree.compiler.dialects._amdgpu_ops_gen.MemoryCounterWaitOp
iree.compiler.dialects.amdgpu.mfma(m, n, k, source_a, source_b, dest_c, *, blocks=None, cbsz=None, abid=None, blgp=None, reduce_precision=None, negate_a=None, negate_b=None, negate_c=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.amdgpu.packed_scaled_trunc(res, source, scale, index, *, existing=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.amdgpu.packed_stoch_round_fp8(res, source, stochiastic_param, store_index, *, existing=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.amdgpu.packed_trunc_2xfp8(res, source_a, word_index, *, source_b=None, existing=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.amdgpu.permlane_swap(src, row_length, *, fetch_inactive=None, bound_ctrl=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.amdgpu.raw_buffer_atomic_cmpswap(src, cmp, memref, indices, *, bounds_check=None, index_offset=None, sgpr_offset=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.amdgpu.raw_buffer_atomic_fadd(value, memref, indices, *, bounds_check=None, index_offset=None, sgpr_offset=None, loc=None, ip=None) iree.compiler.dialects._amdgpu_ops_gen.RawBufferAtomicFaddOp
iree.compiler.dialects.amdgpu.raw_buffer_atomic_fmax(value, memref, indices, *, bounds_check=None, index_offset=None, sgpr_offset=None, loc=None, ip=None) iree.compiler.dialects._amdgpu_ops_gen.RawBufferAtomicFmaxOp
iree.compiler.dialects.amdgpu.raw_buffer_atomic_smax(value, memref, indices, *, bounds_check=None, index_offset=None, sgpr_offset=None, loc=None, ip=None) iree.compiler.dialects._amdgpu_ops_gen.RawBufferAtomicSmaxOp
iree.compiler.dialects.amdgpu.raw_buffer_atomic_umin(value, memref, indices, *, bounds_check=None, index_offset=None, sgpr_offset=None, loc=None, ip=None) iree.compiler.dialects._amdgpu_ops_gen.RawBufferAtomicUminOp
iree.compiler.dialects.amdgpu.raw_buffer_load(value, memref, indices, *, bounds_check=None, index_offset=None, sgpr_offset=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.amdgpu.raw_buffer_store(value, memref, indices, *, bounds_check=None, index_offset=None, sgpr_offset=None, loc=None, ip=None) iree.compiler.dialects._amdgpu_ops_gen.RawBufferStoreOp
iree.compiler.dialects.amdgpu.register_attribute_builder(kind, replace=False)
iree.compiler.dialects.amdgpu.scaled_ext_packed(res, source, scale, index, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.amdgpu.scaled_ext_packed_matrix(res, source, scale, block_size, first_scale_lane, first_scale_byte, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.amdgpu.scaled_mfma(m, n, k, source_a, source_b, dest_c, scales_a, scales_b, scales_idx_a, scales_idx_b, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.amdgpu.scaled_wmma(m, n, k, source_a, source_b, dest_c, scale_a, a_first_scale_lane, scale_b, b_first_scale_lane, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.amdgpu.sched_barrier(opts, *, loc=None, ip=None) iree.compiler.dialects._amdgpu_ops_gen.SchedBarrierOp
flag iree.compiler.dialects.amdgpu.sched_barrier_opt_enum(value)

The possible options for scheduling barriers

Member Type

int

Valid values are as follows:

non_mem_non_sideffect = <sched_barrier_opt_enum.non_mem_non_sideffect: 1>
valu = <sched_barrier_opt_enum.valu: 2>
salu = <sched_barrier_opt_enum.salu: 4>
mfma_wmma = <sched_barrier_opt_enum.mfma_wmma: 8>
all_vmem = <sched_barrier_opt_enum.all_vmem: 16>
vmem_read = <sched_barrier_opt_enum.vmem_read: 32>
vmem_write = <sched_barrier_opt_enum.vmem_write: 64>
all_ds = <sched_barrier_opt_enum.all_ds: 128>
ds_read = <sched_barrier_opt_enum.ds_read: 256>
ds_write = <sched_barrier_opt_enum.ds_write: 512>
transcendental = <sched_barrier_opt_enum.transcendental: 1024>
iree.compiler.dialects.amdgpu.sparse_mfma(m, n, k, source_a, source_b, dest_c, sparse_idx, *, cbsz=None, abid=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.amdgpu.swizzle_bitmode(src, and_mask, or_mask, xor_mask, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.amdgpu.tensor_load_to_lds(desc, *, loc=None, ip=None) iree.compiler.dialects._amdgpu_ops_gen.TensorLoadToLDSOp
iree.compiler.dialects.amdgpu.tensor_store_from_lds(desc, *, loc=None, ip=None) iree.compiler.dialects._amdgpu_ops_gen.TensorStoreFromLDSOp
iree.compiler.dialects.amdgpu.transpose_load(result, src, src_indices, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.amdgpu.wmma(m, n, k, source_a, source_b, dest_c, *, subword_offset=None, unsigned_a=None, unsigned_b=None, clamp=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult

arith dialect

class iree.compiler.dialects.arith.AddFOp(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None)

The addf operation takes two operands and returns one result, each of these is required to be the same type. This type may be a floating point scalar type, a vector whose element type is a floating point type, or a floating point tensor.

Example:

```mlir // Scalar addition. %a = arith.addf %b, %c : f64

// SIMD vector addition, e.g. for Intel SSE. %f = arith.addf %g, %h : vector<4xf32>

// Tensor addition. %x = arith.addf %y, %z : tensor<4x?xbf16> ```

TODO: In the distant future, this will accept optional attributes for fast math, contraction, rounding mode, and other controls.

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.AddFOpAdaptor

OPERATION_NAME = 'arith.addf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.AddFOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.addf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.AddIOp(lhs, rhs, *, overflowFlags=None, results=None, loc=None, ip=None)

Performs N-bit addition on the operands. The operands are interpreted as unsigned bitvectors. The result is represented by a bitvector containing the mathematical value of the addition modulo 2^n, where n is the bitwidth. Because arith integers use a two’s complement representation, this operation is applicable on both signed and unsigned integer operands.

The addi operation takes two operands and returns one result, each of these is required to be the same type. This type may be an integer scalar type, a vector whose element type is integer, or a tensor of integers.

This op supports nuw/nsw overflow flags which stands for “No Unsigned Wrap” and “No Signed Wrap”, respectively. If the nuw and/or nsw flags are present, and an unsigned/signed overflow occurs (respectively), the result is poison.

Example:

```mlir // Scalar addition. %a = arith.addi %b, %c : i64

// Scalar addition with overflow flags. %a = arith.addi %b, %c overflow<nsw, nuw> : i64

// SIMD vector element-wise addition. %f = arith.addi %g, %h : vector<4xi32>

// Tensor element-wise addition. %x = arith.addi %y, %z : tensor<4x?xi8> ```

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.AddIOpAdaptor

OPERATION_NAME = 'arith.addi'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property overflowFlags: iree.compiler._mlir_libs._mlir.ir.Attribute
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.AddIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.addi'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property overflowFlags: iree.compiler._mlir_libs._mlir.ir.Attribute
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.AddUIExtendedOp(sum, overflow, lhs, rhs, *, loc=None, ip=None)

Performs (N+1)-bit addition on zero-extended operands. Returns two results: the N-bit sum (same type as both operands), and the overflow bit (boolean-like), where 1 indicates unsigned addition overflow, while 0 indicates no overflow.

Example:

```mlir // Scalar addition. %sum, %overflow = arith.addui_extended %b, %c : i64, i1

// Vector element-wise addition. %d:2 = arith.addui_extended %e, %f : vector<4xi32>, vector<4xi1>

// Tensor element-wise addition. %x:2 = arith.addui_extended %y, %z : tensor<4x?xi8>, tensor<4x?xi1> ```

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.AddUIExtendedOpAdaptor

OPERATION_NAME = 'arith.addui_extended'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property overflow: iree.compiler._mlir_libs._mlir.ir.OpResult
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
property sum: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.arith.AddUIExtendedOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.addui_extended'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.AffineAddExpr(*args, **kwargs)
get = <nanobind.nb_func object>
class iree.compiler.dialects.arith.AffineBinaryExpr(*args, **kwargs)
property lhs

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

property rhs

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

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

(self) -> int

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

(self) -> int

class iree.compiler.dialects.arith.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>
maybe_downcast
shift_dims
shift_symbols
simplify_affine_expr = <nanobind.nb_func object>
class iree.compiler.dialects.arith.AffineExprList
class iree.compiler.dialects.arith.AffineFloorDivExpr(*args, **kwargs)
get = <nanobind.nb_func object>
class iree.compiler.dialects.arith.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) -> mlir::python::mlir::PyAffineMapExprList

class iree.compiler.dialects.arith.AffineMapAttr(*args, **kwargs)
attr_name = 'builtin.affine_map'
get = <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.dialects.arith.AffineModExpr(*args, **kwargs)
get = <nanobind.nb_func object>
class iree.compiler.dialects.arith.AffineMulExpr(*args, **kwargs)
get = <nanobind.nb_func object>
class iree.compiler.dialects.arith.AffineSymbolExpr(*args, **kwargs)
get = <nanobind.nb_func object>
property position

(self) -> int

class iree.compiler.dialects.arith.AndIOp(lhs, rhs, *, results=None, loc=None, ip=None)

The andi operation takes two operands and returns one result, each of these is required to be the same type. This type may be an integer scalar type, a vector whose element type is integer, or a tensor of integers. It has no standard attributes.

Example:

```mlir // Scalar integer bitwise and. %a = arith.andi %b, %c : i64

// SIMD vector element-wise bitwise integer and. %f = arith.andi %g, %h : vector<4xi32>

// Tensor element-wise bitwise integer and. %x = arith.andi %y, %z : tensor<4x?xi8> ```

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.AndIOpAdaptor

OPERATION_NAME = 'arith.andi'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.AndIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.andi'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.Any(*args, **kwargs)

Special type indicating an unconstrained type.

  • Any is compatible with every type.

  • Any assumed to have all methods.

  • All values assumed to be instances of Any.

Note that all the above statements are true from the point of view of static type checkers. At runtime, Any should not be used with instance checks.

class iree.compiler.dialects.arith.ArrayAttr(*args, **kwargs)
attr_name = 'builtin.array'
get = <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.dialects.arith.ArrayAttributeIterator
class iree.compiler.dialects.arith.AsmState(*args, **kwargs)
enum iree.compiler.dialects.arith.AtomicRMWKind(value)

allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15

Member Type

int

Valid values are as follows:

addf = <AtomicRMWKind.addf: 0>
addi = <AtomicRMWKind.addi: 1>
andi = <AtomicRMWKind.andi: 2>
assign = <AtomicRMWKind.assign: 3>
maximumf = <AtomicRMWKind.maximumf: 4>
maxnumf = <AtomicRMWKind.maxnumf: 5>
maxs = <AtomicRMWKind.maxs: 6>
maxu = <AtomicRMWKind.maxu: 7>
minimumf = <AtomicRMWKind.minimumf: 8>
minnumf = <AtomicRMWKind.minnumf: 9>
mins = <AtomicRMWKind.mins: 10>
minu = <AtomicRMWKind.minu: 11>
mulf = <AtomicRMWKind.mulf: 12>
muli = <AtomicRMWKind.muli: 13>
ori = <AtomicRMWKind.ori: 14>
xori = <AtomicRMWKind.xori: 15>
class iree.compiler.dialects.arith.AttrBuilder
contains = <nanobind.nb_func object>
get = <nanobind.nb_func object>
insert = <nanobind.nb_func object>
class iree.compiler.dialects.arith.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.dialects.arith.BF16Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.bf16'
property typeid

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

class iree.compiler.dialects.arith.BitcastOp(out, in_, *, loc=None, ip=None)

Bitcast an integer or floating point value to an integer or floating point value of equal bit width. When operating on vectors, casts elementwise.

Note that this implements a logical bitcast independent of target endianness. This allows constant folding without target information and is consitent with the bitcast constant folders in LLVM (see https://github.com/llvm/llvm-project/blob/18c19414eb/llvm/lib/IR/ConstantFold.cpp#L168) For targets where the source and target type have the same endianness (which is the standard), this cast will also change no bits at runtime, but it may still require an operation, for example if the machine has different floating point and integer register files. For targets that have a different endianness for the source and target types (e.g. float is big-endian and integer is little-endian) a proper lowering would add operations to swap the order of words in addition to the bitcast.

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.BitcastOpAdaptor

OPERATION_NAME = 'arith.bitcast'
property in_: iree.compiler._mlir_libs._mlir.ir.Value
property out: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.arith.BitcastOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.bitcast'
property in_: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.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.dialects.arith.BlockArgument(*args, **kwargs)
property arg_number

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

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.dialects.arith.BlockArgumentList
property types

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

class iree.compiler.dialects.arith.BlockIterator
class iree.compiler.dialects.arith.BlockList
append

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

Returns

The created block.

class iree.compiler.dialects.arith.BlockPredecessors
class iree.compiler.dialects.arith.BlockSuccessors
class iree.compiler.dialects.arith.BoolAttr(*args, **kwargs)
get = <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.dialects.arith.CeilDivSIOp(lhs, rhs, *, results=None, loc=None, ip=None)

Signed integer division. Rounds towards positive infinity, i.e. 7 / -2 = -3.

Divison by zero, or signed division overflow (minimum value divided by -1) is undefined behavior. When applied to vector and tensor values, the behavior is undefined if _any_ of its elements are divided by zero or has a signed division overflow.

Example:

`mlir // Scalar signed integer division. %a = arith.ceildivsi %b, %c : i64 `

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.CeilDivSIOpAdaptor

OPERATION_NAME = 'arith.ceildivsi'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.CeilDivSIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.ceildivsi'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.CeilDivUIOp(lhs, rhs, *, results=None, loc=None, ip=None)

Unsigned integer division. Rounds towards positive infinity. Treats the leading bit as the most significant, i.e. for i16 given two’s complement representation, 6 / -2 = 6 / (2^16 - 2) = 1.

Division by zero is undefined behavior. When applied to vector and tensor values, the behavior is undefined if _any_ elements are divided by zero.

Example:

`mlir // Scalar unsigned integer division. %a = arith.ceildivui %b, %c : i64 `

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.CeilDivUIOpAdaptor

OPERATION_NAME = 'arith.ceildivui'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.CeilDivUIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.ceildivui'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.CmpFOp(predicate, lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None)

The cmpf operation compares its two operands according to the float comparison rules and the predicate specified by the respective attribute. The predicate defines the type of comparison: (un)orderedness, (in)equality and signed less/greater than (or equal to) as well as predicates that are always true or false. The operands must have the same type, and this type must be a float type, or a vector or tensor thereof. The result is an i1, or a vector/tensor thereof having the same shape as the inputs. Unlike cmpi, the operands are always treated as signed. The u prefix indicates unordered comparison, not unsigned comparison, so “une” means unordered or not equal. For the sake of readability by humans, custom assembly form for the operation uses a string-typed attribute for the predicate. The value of this attribute corresponds to lower-cased name of the predicate constant, e.g., “one” means “ordered not equal”. The string representation of the attribute is merely a syntactic sugar and is converted to an integer attribute by the parser.

Example:

`mlir %r1 = arith.cmpf oeq, %0, %1 : f32 %r2 = arith.cmpf ult, %0, %1 : tensor<42x42xf64> %r3 = "arith.cmpf"(%0, %1) {predicate: 0} : (f8, f8) -> i1 `

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.CmpFOpAdaptor

OPERATION_NAME = 'arith.cmpf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property predicate: iree.compiler._mlir_libs._mlir.ir.Attribute
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.CmpFOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.cmpf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property predicate: iree.compiler._mlir_libs._mlir.ir.Attribute
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
enum iree.compiler.dialects.arith.CmpFPredicate(value)

allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15

Member Type

int

Valid values are as follows:

AlwaysFalse = <CmpFPredicate.AlwaysFalse: 0>
OEQ = <CmpFPredicate.OEQ: 1>
OGT = <CmpFPredicate.OGT: 2>
OGE = <CmpFPredicate.OGE: 3>
OLT = <CmpFPredicate.OLT: 4>
OLE = <CmpFPredicate.OLE: 5>
ONE = <CmpFPredicate.ONE: 6>
ORD = <CmpFPredicate.ORD: 7>
UEQ = <CmpFPredicate.UEQ: 8>
UGT = <CmpFPredicate.UGT: 9>
UGE = <CmpFPredicate.UGE: 10>
ULT = <CmpFPredicate.ULT: 11>
ULE = <CmpFPredicate.ULE: 12>
UNE = <CmpFPredicate.UNE: 13>
UNO = <CmpFPredicate.UNO: 14>
AlwaysTrue = <CmpFPredicate.AlwaysTrue: 15>
class iree.compiler.dialects.arith.CmpIOp(predicate, lhs, rhs, *, results=None, loc=None, ip=None)

The cmpi operation is a generic comparison for integer-like types. Its two arguments can be integers, vectors or tensors thereof as long as their types match. The operation produces an i1 for the former case, a vector or a tensor of i1 with the same shape as inputs in the other cases.

Its first argument is an attribute that defines which type of comparison is performed. The following comparisons are supported:

  • equal (mnemonic: “eq”; integer value: 0)

  • not equal (mnemonic: “ne”; integer value: 1)

  • signed less than (mnemonic: “slt”; integer value: 2)

  • signed less than or equal (mnemonic: “sle”; integer value: 3)

  • signed greater than (mnemonic: “sgt”; integer value: 4)

  • signed greater than or equal (mnemonic: “sge”; integer value: 5)

  • unsigned less than (mnemonic: “ult”; integer value: 6)

  • unsigned less than or equal (mnemonic: “ule”; integer value: 7)

  • unsigned greater than (mnemonic: “ugt”; integer value: 8)

  • unsigned greater than or equal (mnemonic: “uge”; integer value: 9)

The result is 1 if the comparison is true and 0 otherwise. For vector or tensor operands, the comparison is performed elementwise and the element of the result indicates whether the comparison is true for the operand elements with the same indices as those of the result.

Note: while the custom assembly form uses strings, the actual underlying attribute has integer type (or rather enum class in C++ code) as seen from the generic assembly form. String literals are used to improve readability of the IR by humans.

This operation only applies to integer-like operands, but not floats. The main reason being that comparison operations have diverging sets of attributes: integers require sign specification while floats require various floating point-related particularities, e.g., -ffast-math behavior, IEEE754 compliance, etc ([rationale](../Rationale/Rationale.md#splitting-floating-point-vs-integer-operations)). The type of comparison is specified as attribute to avoid introducing ten similar operations, taking into account that they are often implemented using the same operation downstream ([rationale](../Rationale/Rationale.md#specifying-comparison-kind-as-attribute)). The separation between signed and unsigned order comparisons is necessary because of integers being signless. The comparison operation must know how to interpret values with the foremost bit being set: negatives in two’s complement or large positives ([rationale](../Rationale/Rationale.md#specifying-sign-in-integer-comparison-operations)).

Example:

```mlir // Custom form of scalar “signed less than” comparison. %x = arith.cmpi slt, %lhs, %rhs : i32

// Generic form of the same operation. %x = “arith.cmpi”(%lhs, %rhs) {predicate = 2 : i64} : (i32, i32) -> i1

// Custom form of vector equality comparison. %x = arith.cmpi eq, %lhs, %rhs : vector<4xi64>

// Generic form of the same operation. %x = “arith.cmpi”(%lhs, %rhs) {predicate = 0 : i64}

: (vector<4xi64>, vector<4xi64>) -> vector<4xi1>

```

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.CmpIOpAdaptor

OPERATION_NAME = 'arith.cmpi'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property predicate: iree.compiler._mlir_libs._mlir.ir.Attribute
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.CmpIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.cmpi'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property predicate: iree.compiler._mlir_libs._mlir.ir.Attribute
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
enum iree.compiler.dialects.arith.CmpIPredicate(value)

allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Member Type

int

Valid values are as follows:

eq = <CmpIPredicate.eq: 0>
ne = <CmpIPredicate.ne: 1>
slt = <CmpIPredicate.slt: 2>
sle = <CmpIPredicate.sle: 3>
sgt = <CmpIPredicate.sgt: 4>
sge = <CmpIPredicate.sge: 5>
ult = <CmpIPredicate.ult: 6>
ule = <CmpIPredicate.ule: 7>
ugt = <CmpIPredicate.ugt: 8>
uge = <CmpIPredicate.uge: 9>
class iree.compiler.dialects.arith.ComplexType(*args, **kwargs)
property element_type

Returns element type.

get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.complex'
property typeid

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

class iree.compiler.dialects.arith.ConstantOp(value: Attribute, *, loc='None', ip='None')
class iree.compiler.dialects.arith.ConstantOp(result: Type, value: Union[int, float, _array], *, loc='None', ip='None')

Specialization for the constant op class.

classmethod create_index(value: int, *, loc=None, ip=None)

Create an index-typed constant.

property literal_value: Union[int, float]
property type
property value
class iree.compiler.dialects.arith.ConstantOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.constant'
property value: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.arith.Context(load_on_create_dialects=None, thread_pool=None, *args, **kwargs)
class iree.compiler.dialects.arith.DenseBoolArrayAttr(*args, **kwargs)
get = <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.dialects.arith.DenseBoolArrayIterator
class iree.compiler.dialects.arith.DenseElementsAttr(*args, **kwargs)
get = <nanobind.nb_func object>
get_splat = <nanobind.nb_func object>
get_splat_value
property is_splat

(self) -> bool

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.dialects.arith.DenseF32ArrayAttr(*args, **kwargs)
get = <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.dialects.arith.DenseF32ArrayIterator
class iree.compiler.dialects.arith.DenseF64ArrayAttr(*args, **kwargs)
get = <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.dialects.arith.DenseF64ArrayIterator
class iree.compiler.dialects.arith.DenseFPElementsAttr(*args, **kwargs)
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.dialects.arith.DenseI16ArrayAttr(*args, **kwargs)
get = <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.dialects.arith.DenseI16ArrayIterator
class iree.compiler.dialects.arith.DenseI32ArrayAttr(*args, **kwargs)
get = <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.dialects.arith.DenseI32ArrayIterator
class iree.compiler.dialects.arith.DenseI64ArrayAttr(*args, **kwargs)
get = <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.dialects.arith.DenseI64ArrayIterator
class iree.compiler.dialects.arith.DenseI8ArrayAttr(*args, **kwargs)
get = <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.dialects.arith.DenseI8ArrayIterator
class iree.compiler.dialects.arith.DenseIntElementsAttr(*args, **kwargs)
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.dialects.arith.DenseResourceElementsAttr(*args, **kwargs)
attr_name = 'builtin.dense_resource_elements'
get_from_buffer = <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.dialects.arith.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.dialects.arith.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.dialects.arith.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.dialects.arith.DiagnosticSeverity(value)

Valid values are as follows:

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

Returns the DialectDescriptor for this dialect.

class iree.compiler.dialects.arith.DialectDescriptor
property namespace

Returns the namespace of the dialect.

class iree.compiler.dialects.arith.DialectRegistry(*args, **kwargs)
class iree.compiler.dialects.arith.Dialects
class iree.compiler.dialects.arith.DictAttr(*args, **kwargs)
attr_name = 'builtin.dictionary'
get = <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.dialects.arith.DivFOp(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None)
Adaptor

alias of iree.compiler.dialects._arith_ops_gen.DivFOpAdaptor

OPERATION_NAME = 'arith.divf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.DivFOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.divf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.DivSIOp(lhs, rhs, *, isExact=None, results=None, loc=None, ip=None)

Signed integer division. Rounds towards zero. Treats the leading bit as sign, i.e. 6 / -2 = -3.

Divison by zero, or signed division overflow (minimum value divided by -1) is undefined behavior. When applied to vector and tensor values, the behavior is undefined if _any_ of its elements are divided by zero or has a signed division overflow.

If the exact attribute is present, the result value is poison if lhs is not a multiple of rhs.

Example:

```mlir // Scalar signed integer division. %a = arith.divsi %b, %c : i64

// Scalar signed integer division where %b is known to be a multiple of %c. %a = arith.divsi %b, %c exact : i64

// SIMD vector element-wise division. %f = arith.divsi %g, %h : vector<4xi32>

// Tensor element-wise integer division. %x = arith.divsi %y, %z : tensor<4x?xi8> ```

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.DivSIOpAdaptor

OPERATION_NAME = 'arith.divsi'
property isExact: bool
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.DivSIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.divsi'
property isExact: bool
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.DivUIOp(lhs, rhs, *, isExact=None, results=None, loc=None, ip=None)

Unsigned integer division. Rounds towards zero. Treats the leading bit as the most significant, i.e. for i16 given two’s complement representation, 6 / -2 = 6 / (2^16 - 2) = 0.

Division by zero is undefined behavior. When applied to vector and tensor values, the behavior is undefined if _any_ elements are divided by zero.

If the exact attribute is present, the result value is poison if lhs is not a multiple of rhs.

Example:

```mlir // Scalar unsigned integer division. %a = arith.divui %b, %c : i64

// Scalar unsigned integer division where %b is known to be a multiple of %c. %a = arith.divui %b, %c exact : i64

// SIMD vector element-wise division. %f = arith.divui %g, %h : vector<4xi32>

// Tensor element-wise integer division. %x = arith.divui %y, %z : tensor<4x?xi8> ```

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.DivUIOpAdaptor

OPERATION_NAME = 'arith.divui'
property isExact: bool
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.DivUIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.divui'
property isExact: bool
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.ExtFOp(out, in_, *, fastmath=None, loc=None, ip=None)

Cast a floating-point value to a larger floating-point-typed value. The destination type must to be strictly wider than the source type. When operating on vectors, casts elementwise.

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.ExtFOpAdaptor

OPERATION_NAME = 'arith.extf'
property fastmath: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute]
property in_: iree.compiler._mlir_libs._mlir.ir.Value
property out: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.arith.ExtFOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.extf'
property fastmath: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute]
property in_: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.ExtSIOp(out, in_, *, loc=None, ip=None)

The integer sign extension operation takes an integer input of width M and an integer destination type of width N. The destination bit-width must be larger than the input bit-width (N > M). The top-most (N - M) bits of the output are filled with copies of the most-significant bit of the input.

Example:

```mlir %1 = arith.constant 5 : i3 // %1 is 0b101 %2 = arith.extsi %1 : i3 to i6 // %2 is 0b111101 %3 = arith.constant 2 : i3 // %3 is 0b010 %4 = arith.extsi %3 : i3 to i6 // %4 is 0b000010

%5 = arith.extsi %0 : vector<2 x i32> to vector<2 x i64> ```

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.ExtSIOpAdaptor

OPERATION_NAME = 'arith.extsi'
property in_: iree.compiler._mlir_libs._mlir.ir.Value
property out: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.arith.ExtSIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.extsi'
property in_: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.ExtUIOp(out, in_, *, loc=None, ip=None)

The integer zero extension operation takes an integer input of width M and an integer destination type of width N. The destination bit-width must be larger than the input bit-width (N > M). The top-most (N - M) bits of the output are filled with zeros.

Example:

```mlir

%1 = arith.constant 5 : i3 // %1 is 0b101 %2 = arith.extui %1 : i3 to i6 // %2 is 0b000101 %3 = arith.constant 2 : i3 // %3 is 0b010 %4 = arith.extui %3 : i3 to i6 // %4 is 0b000010

%5 = arith.extui %0 : vector<2 x i32> to vector<2 x i64>

```

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.ExtUIOpAdaptor

OPERATION_NAME = 'arith.extui'
property in_: iree.compiler._mlir_libs._mlir.ir.Value
property out: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.arith.ExtUIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.extui'
property in_: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.F16Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f16'
property typeid

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

class iree.compiler.dialects.arith.F32Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f32'
property typeid

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

class iree.compiler.dialects.arith.F64Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f64'
property typeid

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

class iree.compiler.dialects.arith.FPToSIOp(out, in_, *, loc=None, ip=None)

Cast from a value interpreted as floating-point to the nearest (rounding towards zero) signed integer value. When operating on vectors, casts elementwise.

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.FPToSIOpAdaptor

OPERATION_NAME = 'arith.fptosi'
property in_: iree.compiler._mlir_libs._mlir.ir.Value
property out: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.arith.FPToSIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.fptosi'
property in_: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.FPToUIOp(out, in_, *, loc=None, ip=None)

Cast from a value interpreted as floating-point to the nearest (rounding towards zero) unsigned integer value. When operating on vectors, casts elementwise.

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.FPToUIOpAdaptor

OPERATION_NAME = 'arith.fptoui'
property in_: iree.compiler._mlir_libs._mlir.ir.Value
property out: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.arith.FPToUIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.fptoui'
property in_: iree.compiler._mlir_libs._mlir.ir.Value
flag iree.compiler.dialects.arith.FastMathFlags(value)

Floating point fast math flags

Member Type

int

Valid values are as follows:

reassoc = <FastMathFlags.reassoc: 1>
nnan = <FastMathFlags.nnan: 2>
ninf = <FastMathFlags.ninf: 4>
nsz = <FastMathFlags.nsz: 8>
arcp = <FastMathFlags.arcp: 16>
contract = <FastMathFlags.contract: 32>
afn = <FastMathFlags.afn: 64>
class iree.compiler.dialects.arith.FlatSymbolRefAttr(*args, **kwargs)
attr_name = 'builtin.symbol_ref'
get = <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.dialects.arith.Float4E2M1FNType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f4E2M1FN'
property typeid

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

class iree.compiler.dialects.arith.Float6E2M3FNType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f6E2M3FN'
property typeid

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

class iree.compiler.dialects.arith.Float6E3M2FNType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f6E3M2FN'
property typeid

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

class iree.compiler.dialects.arith.Float8E3M4Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E3M4'
property typeid

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

class iree.compiler.dialects.arith.Float8E4M3B11FNUZType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E4M3B11FNUZ'
property typeid

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

class iree.compiler.dialects.arith.Float8E4M3FNType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E4M3FN'
property typeid

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

class iree.compiler.dialects.arith.Float8E4M3FNUZType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E4M3FNUZ'
property typeid

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

class iree.compiler.dialects.arith.Float8E4M3Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E4M3'
property typeid

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

class iree.compiler.dialects.arith.Float8E5M2FNUZType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E5M2FNUZ'
property typeid

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

class iree.compiler.dialects.arith.Float8E5M2Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E5M2'
property typeid

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

class iree.compiler.dialects.arith.Float8E8M0FNUType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E8M0FNU'
property typeid

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

class iree.compiler.dialects.arith.FloatAttr(*args, **kwargs)
attr_name = 'builtin.float'
get = <nanobind.nb_func object>
get_f32 = <nanobind.nb_func object>
get_f64 = <nanobind.nb_func object>
get_unchecked = <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.dialects.arith.FloatTF32Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.tf32'
property typeid

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

class iree.compiler.dialects.arith.FloatType(*args, **kwargs)
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.dialects.arith.FloorDivSIOp(lhs, rhs, *, results=None, loc=None, ip=None)

Signed integer division. Rounds towards negative infinity, i.e. 5 / -2 = -3.

Divison by zero, or signed division overflow (minimum value divided by -1) is undefined behavior. When applied to vector and tensor values, the behavior is undefined if _any_ of its elements are divided by zero or has a signed division overflow.

Example:

```mlir // Scalar signed integer division. %a = arith.floordivsi %b, %c : i64

```

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.FloorDivSIOpAdaptor

OPERATION_NAME = 'arith.floordivsi'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.FloorDivSIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.floordivsi'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.FunctionType(*args, **kwargs)
get = <nanobind.nb_func object>
property inputs

Returns the list of input types in the FunctionType.

property results

Returns the list of result types in the FunctionType.

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.function'
property typeid

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

class iree.compiler.dialects.arith.IndexCastOp(out, in_, *, loc=None, ip=None)

Casts between scalar or vector integers and corresponding ‘index’ scalar or vectors. Index is an integer of platform-specific bit width. If casting to a wider integer, the value is sign-extended. If casting to a narrower integer, the value is truncated.

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.IndexCastOpAdaptor

OPERATION_NAME = 'arith.index_cast'
property in_: iree.compiler._mlir_libs._mlir.ir.Value
property out: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.arith.IndexCastOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.index_cast'
property in_: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.IndexCastUIOp(out, in_, *, loc=None, ip=None)

Casts between scalar or vector integers and corresponding ‘index’ scalar or vectors. Index is an integer of platform-specific bit width. If casting to a wider integer, the value is zero-extended. If casting to a narrower integer, the value is truncated.

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.IndexCastUIOpAdaptor

OPERATION_NAME = 'arith.index_castui'
property in_: iree.compiler._mlir_libs._mlir.ir.Value
property out: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.arith.IndexCastUIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.index_castui'
property in_: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.IndexType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.index'
property typeid

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

class iree.compiler.dialects.arith.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.dialects.arith.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.dialects.arith.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.

enum iree.compiler.dialects.arith.IntEnum(value)

Enum where members are also (and must be) ints

Member Type

int

flag iree.compiler.dialects.arith.IntFlag(value)

Support for integer-based Flags

Member Type

int

class iree.compiler.dialects.arith.IntegerAttr(*args, **kwargs)
attr_name = 'builtin.integer'
get = <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

flag iree.compiler.dialects.arith.IntegerOverflowFlags(value)

Integer overflow arith flags

Member Type

int

Valid values are as follows:

nsw = <IntegerOverflowFlags.nsw: 1>
nuw = <IntegerOverflowFlags.nuw: 2>
class iree.compiler.dialects.arith.IntegerSet
property constraints

(self) -> mlir::python::mlir::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.dialects.arith.IntegerSetAttr(*args, **kwargs)
attr_name = 'builtin.integer_set'
get = <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.dialects.arith.IntegerSetConstraint
property expr

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

property is_eq

(self) -> bool

class iree.compiler.dialects.arith.IntegerSetConstraintList
class iree.compiler.dialects.arith.IntegerType(*args, **kwargs)
SIGNED = 1
SIGNLESS = 0
enum Signedness(value)

Valid values are as follows:

SIGNLESS = Signedness.SIGNLESS
SIGNED = Signedness.SIGNED
UNSIGNED = Signedness.UNSIGNED
UNSIGNED = 2
get = <nanobind.nb_func object>
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

property signedness

(self) -> iree.compiler._mlir_libs._mlir.ir.IntegerType.Signedness

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.integer'
property typeid

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

property width

Returns the width of the integer type

class iree.compiler.dialects.arith.Iterable
class iree.compiler.dialects.arith.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.dialects.arith.MLIRError(message, error_diagnostics)
An exception with diagnostic information. Has the following fields:

message: str error_diagnostics: List[ir.DiagnosticInfo]

class iree.compiler.dialects.arith.MaxNumFOp(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None)

Returns the maximum of the two arguments. If the arguments are -0.0 and +0.0, then the result is either of them. If one of the arguments is NaN, then the result is the other argument.

Example:

`mlir // Scalar floating-point maximum. %a = arith.maxnumf %b, %c : f64 `

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.MaxNumFOpAdaptor

OPERATION_NAME = 'arith.maxnumf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.MaxNumFOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.maxnumf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.MaxSIOp(lhs, rhs, *, results=None, loc=None, ip=None)
Adaptor

alias of iree.compiler.dialects._arith_ops_gen.MaxSIOpAdaptor

OPERATION_NAME = 'arith.maxsi'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.MaxSIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.maxsi'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.MaxUIOp(lhs, rhs, *, results=None, loc=None, ip=None)
Adaptor

alias of iree.compiler.dialects._arith_ops_gen.MaxUIOpAdaptor

OPERATION_NAME = 'arith.maxui'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.MaxUIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.maxui'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.MaximumFOp(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None)

Returns the maximum of the two arguments, treating -0.0 as less than +0.0. If one of the arguments is NaN, then the result is also NaN.

Example:

`mlir // Scalar floating-point maximum. %a = arith.maximumf %b, %c : f64 `

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.MaximumFOpAdaptor

OPERATION_NAME = 'arith.maximumf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.MaximumFOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.maximumf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.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>
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>
type_name = 'builtin.memref'
property typeid

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

class iree.compiler.dialects.arith.MinNumFOp(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None)

Returns the minimum of the two arguments. If the arguments are -0.0 and +0.0, then the result is either of them. If one of the arguments is NaN, then the result is the other argument.

Example:

`mlir // Scalar floating-point minimum. %a = arith.minnumf %b, %c : f64 `

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.MinNumFOpAdaptor

OPERATION_NAME = 'arith.minnumf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.MinNumFOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.minnumf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.MinSIOp(lhs, rhs, *, results=None, loc=None, ip=None)
Adaptor

alias of iree.compiler.dialects._arith_ops_gen.MinSIOpAdaptor

OPERATION_NAME = 'arith.minsi'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.MinSIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.minsi'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.MinUIOp(lhs, rhs, *, results=None, loc=None, ip=None)
Adaptor

alias of iree.compiler.dialects._arith_ops_gen.MinUIOpAdaptor

OPERATION_NAME = 'arith.minui'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.MinUIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.minui'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.MinimumFOp(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None)

Returns the minimum of the two arguments, treating -0.0 as less than +0.0. If one of the arguments is NaN, then the result is also NaN.

Example:

`mlir // Scalar floating-point minimum. %a = arith.minimumf %b, %c : f64 `

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.MinimumFOpAdaptor

OPERATION_NAME = 'arith.minimumf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.MinimumFOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.minimumf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.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.dialects.arith.MulFOp(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None)

The mulf operation takes two operands and returns one result, each of these is required to be the same type. This type may be a floating point scalar type, a vector whose element type is a floating point type, or a floating point tensor.

Example:

```mlir // Scalar multiplication. %a = arith.mulf %b, %c : f64

// SIMD pointwise vector multiplication, e.g. for Intel SSE. %f = arith.mulf %g, %h : vector<4xf32>

// Tensor pointwise multiplication. %x = arith.mulf %y, %z : tensor<4x?xbf16> ```

TODO: In the distant future, this will accept optional attributes for fast math, contraction, rounding mode, and other controls.

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.MulFOpAdaptor

OPERATION_NAME = 'arith.mulf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.MulFOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.mulf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.MulIOp(lhs, rhs, *, overflowFlags=None, results=None, loc=None, ip=None)

Performs N-bit multiplication on the operands. The operands are interpreted as unsigned bitvectors. The result is represented by a bitvector containing the mathematical value of the multiplication modulo 2^n, where n is the bitwidth. Because arith integers use a two’s complement representation, this operation is applicable on both signed and unsigned integer operands.

The muli operation takes two operands and returns one result, each of these is required to be the same type. This type may be an integer scalar type, a vector whose element type is integer, or a tensor of integers.

This op supports nuw/nsw overflow flags which stands for “No Unsigned Wrap” and “No Signed Wrap”, respectively. If the nuw and/or nsw flags are present, and an unsigned/signed overflow occurs (respectively), the result is poison.

Example:

```mlir // Scalar multiplication. %a = arith.muli %b, %c : i64

// Scalar multiplication with overflow flags. %a = arith.muli %b, %c overflow<nsw, nuw> : i64

// SIMD vector element-wise multiplication. %f = arith.muli %g, %h : vector<4xi32>

// Tensor element-wise multiplication. %x = arith.muli %y, %z : tensor<4x?xi8> ```

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.MulIOpAdaptor

OPERATION_NAME = 'arith.muli'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property overflowFlags: iree.compiler._mlir_libs._mlir.ir.Attribute
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.MulIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.muli'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property overflowFlags: iree.compiler._mlir_libs._mlir.ir.Attribute
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.MulSIExtendedOp(lhs, rhs, *, results=None, loc=None, ip=None)

Performs (2*N)-bit multiplication on sign-extended operands. Returns two N-bit results: the low and the high halves of the product. The low half has the same value as the result of regular multiplication arith.muli with the same operands.

Example:

```mlir // Scalar multiplication. %low, %high = arith.mulsi_extended %a, %b : i32

// Vector element-wise multiplication. %c:2 = arith.mulsi_extended %d, %e : vector<4xi32>

// Tensor element-wise multiplication. %x:2 = arith.mulsi_extended %y, %z : tensor<4x?xi8> ```

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.MulSIExtendedOpAdaptor

OPERATION_NAME = 'arith.mulsi_extended'
property high: iree.compiler._mlir_libs._mlir.ir.OpResult
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property low: iree.compiler._mlir_libs._mlir.ir.OpResult
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.MulSIExtendedOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.mulsi_extended'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.MulUIExtendedOp(lhs, rhs, *, results=None, loc=None, ip=None)

Performs (2*N)-bit multiplication on zero-extended operands. Returns two N-bit results: the low and the high halves of the product. The low half has the same value as the result of regular multiplication arith.muli with the same operands.

Example:

```mlir // Scalar multiplication. %low, %high = arith.mului_extended %a, %b : i32

// Vector element-wise multiplication. %c:2 = arith.mului_extended %d, %e : vector<4xi32>

// Tensor element-wise multiplication. %x:2 = arith.mului_extended %y, %z : tensor<4x?xi8> ```

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.MulUIExtendedOpAdaptor

OPERATION_NAME = 'arith.mului_extended'
property high: iree.compiler._mlir_libs._mlir.ir.OpResult
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property low: iree.compiler._mlir_libs._mlir.ir.OpResult
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.MulUIExtendedOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.mului_extended'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.NamedAttribute
property attr

The underlying generic attribute of the NamedAttribute binding.

property name

The name of the NamedAttribute binding.

class iree.compiler.dialects.arith.NegFOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

The negf operation computes the negation of a given value. It takes one operand and returns one result of the same type. This type may be a float scalar type, a vector whose element type is float, or a tensor of floats. It has no standard attributes.

Example:

```mlir // Scalar negation value. %a = arith.negf %b : f64

// SIMD vector element-wise negation value. %f = arith.negf %g : vector<4xf32>

// Tensor element-wise negation value. %x = arith.negf %y : tensor<4x?xf8> ```

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.NegFOpAdaptor

OPERATION_NAME = 'arith.negf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.arith.NegFOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.negf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.NoneType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.none'
property typeid

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

class iree.compiler.dialects.arith.OpAdaptor(*args, **kwargs)
property attributes

Returns the attributes of the adaptor.

property operands

Returns the operands of the adaptor.

class iree.compiler.dialects.arith.OpAttributeMap
get

Gets an attribute by name or the default value, if it does not exist.

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.dialects.arith.OpOperand
property operand_number

Returns the operand number in the owning operation.

property owner

Returns the operation that owns this operand.

class iree.compiler.dialects.arith.OpOperandIterator
class iree.compiler.dialects.arith.OpOperandList
class iree.compiler.dialects.arith.OpResult(*args, **kwargs)
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.dialects.arith.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.dialects.arith.OpSuccessors
class iree.compiler.dialects.arith.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.dialects.arith.OpaqueAttr(*args, **kwargs)
attr_name = 'builtin.opaque'
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>
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.dialects.arith.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>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.opaque'
property typeid

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

class iree.compiler.dialects.arith.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.dialects.arith.OperationIterator
class iree.compiler.dialects.arith.OperationList
class iree.compiler.dialects.arith.OrIOp(lhs, rhs, *, results=None, loc=None, ip=None)

The ori operation takes two operands and returns one result, each of these is required to be the same type. This type may be an integer scalar type, a vector whose element type is integer, or a tensor of integers. It has no standard attributes.

Example:

```mlir // Scalar integer bitwise or. %a = arith.ori %b, %c : i64

// SIMD vector element-wise bitwise integer or. %f = arith.ori %g, %h : vector<4xi32>

// Tensor element-wise bitwise integer or. %x = arith.ori %y, %z : tensor<4x?xi8> ```

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.OrIOpAdaptor

OPERATION_NAME = 'arith.ori'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.OrIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.ori'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.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>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.tensor'
property typeid

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

class iree.compiler.dialects.arith.Region
property blocks

Returns a forward-optimized sequence of blocks.

property owner

Returns the operation owning this region.

class iree.compiler.dialects.arith.RegionIterator
class iree.compiler.dialects.arith.RegionSequence
class iree.compiler.dialects.arith.RemFOp(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None)

Returns the floating point division remainder. The remainder has the same sign as the dividend (lhs operand).

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.RemFOpAdaptor

OPERATION_NAME = 'arith.remf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.RemFOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.remf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.RemSIOp(lhs, rhs, *, results=None, loc=None, ip=None)

Signed integer division remainder. Treats the leading bit as sign, i.e. 6 % -2 = 0.

Division by zero is undefined behavior. When applied to vector and tensor values, the behavior is undefined if _any_ elements are divided by zero.

Example:

```mlir // Scalar signed integer division remainder. %a = arith.remsi %b, %c : i64

// SIMD vector element-wise division remainder. %f = arith.remsi %g, %h : vector<4xi32>

// Tensor element-wise integer division remainder. %x = arith.remsi %y, %z : tensor<4x?xi8> ```

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.RemSIOpAdaptor

OPERATION_NAME = 'arith.remsi'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.RemSIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.remsi'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.RemUIOp(lhs, rhs, *, results=None, loc=None, ip=None)

Unsigned integer division remainder. Treats the leading bit as the most significant, i.e. for i16, 6 % -2 = 6 % (2^16 - 2) = 6.

Division by zero is undefined behavior. When applied to vector and tensor values, the behavior is undefined if _any_ elements are divided by zero.

Example:

```mlir // Scalar unsigned integer division remainder. %a = arith.remui %b, %c : i64

// SIMD vector element-wise division remainder. %f = arith.remui %g, %h : vector<4xi32>

// Tensor element-wise integer division remainder. %x = arith.remui %y, %z : tensor<4x?xi8> ```

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.RemUIOpAdaptor

OPERATION_NAME = 'arith.remui'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.RemUIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.remui'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
enum iree.compiler.dialects.arith.RoundingMode(value)

Floating point rounding mode

Member Type

int

Valid values are as follows:

to_nearest_even = <RoundingMode.to_nearest_even: 0>
downward = <RoundingMode.downward: 1>
upward = <RoundingMode.upward: 2>
toward_zero = <RoundingMode.toward_zero: 3>
to_nearest_away = <RoundingMode.to_nearest_away: 4>
class iree.compiler.dialects.arith.SIToFPOp(out, in_, *, loc=None, ip=None)

Cast from a value interpreted as a signed integer to the corresponding floating-point value. If the value cannot be exactly represented, it is rounded using the default rounding mode. When operating on vectors, casts elementwise.

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.SIToFPOpAdaptor

OPERATION_NAME = 'arith.sitofp'
property in_: iree.compiler._mlir_libs._mlir.ir.Value
property out: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.arith.SIToFPOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.sitofp'
property in_: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.ScalingExtFOp(out, in_, scale, *, fastmath=None, loc=None, ip=None)

This operation upcasts input floating-point values using provided scale values. It expects both scales and the input operand to be of the same shape, making the operation elementwise. Scales are usually calculated per block following the OCP MXFP spec as described in https://arxiv.org/abs/2310.10537.

If scales are calculated per block where blockSize != 1, then scales may require broadcasting to make this operation elementwise. For example, let’s say the input is of shape <dim1 x dim2 x … dimN>. Given blockSize != 1 and assuming quantization happens on the last axis, the input can be reshaped to <dim1 x dim2 x … (dimN/blockSize) x blockSize>. Scales will be calculated per block on the last axis. Therefore, scales will be of shape <dim1 x dim2 x … (dimN/blockSize) x 1>. Scales could also be of some other shape as long as it is broadcast compatible with the input, e.g., <1 x 1 x … (dimN/blockSize) x 1>.

In this example, before calling into arith.scaling_extf, scales must be broadcasted to <dim1 x dim2 x dim3 … (dimN/blockSize) x blockSize>. Note that there could be multiple quantization axes. Internally, arith.scaling_extf would perform the following:

```mlir // Cast scale to result type. %0 = arith.truncf %1 : f32 to f8E8M0FNU %1 = arith.extf %0 : f8E8M0FNU to f16

// Cast input to result type. %2 = arith.extf %3 : f4E2M1FN to f16

// Perform scaling %3 = arith.mulf %2, %1 : f16 ``` It propagates NaN values. Therefore, if either scale or the input element contains NaN, then the output element value will also be a NaN.

Example:

```mlir // Upcast from f4E2M1FN to f32. %a = arith.scaling_extf %b, %c : f4E2M1FN, f8E8M0FNU to f32

// Element-wise upcast with broadcast (blockSize = 32). %f = vector.broadcast %g : vector<1xf8E8M0FNU> to vector<32xf8E8M0FNU> %h = arith.scaling_extf %i, %f : vector<32xf4E2M1FN>, vector<32xf8E8M0FNU> to vector<32xbf16> ```

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.ScalingExtFOpAdaptor

OPERATION_NAME = 'arith.scaling_extf'
property fastmath: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute]
property in_: iree.compiler._mlir_libs._mlir.ir.Value
property out: iree.compiler._mlir_libs._mlir.ir.OpResult
property scale: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.ScalingExtFOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.scaling_extf'
property fastmath: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute]
property in_: iree.compiler._mlir_libs._mlir.ir.Value
property scale: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.ScalingTruncFOp(out, in_, scale, *, roundingmode=None, fastmath=None, loc=None, ip=None)

This operation downcasts input using the provided scale values. It expects both scales and the input operand to be of the same shape and, therefore, makes the operation elementwise. Scales are usually calculated per block following the OCP MXFP spec as described in https://arxiv.org/abs/2310.10537. Users are required to normalize and clamp the scales as necessary before calling passing them to this operation. OCP MXFP spec also does the flushing of denorms on the input operand, which should be handled during lowering by passing appropriate fastMath flag to this operation.

If scales are calculated per block where blockSize != 1, scales may require broadcasting to make this operation elementwise. For example, let’s say the input is of shape <dim1 x dim2 x … dimN>. Given blockSize != 1 and assuming quantization happens on the last axis, the input can be reshaped to <dim1 x dim2 x … (dimN/blockSize) x blockSize>. Scales will be calculated per block on the last axis. Therefore, scales will be of shape <dim1 x dim2 x … (dimN/blockSize) x 1>. Scales could also be of some other shape as long as it is broadcast compatible with the input, e.g., <1 x 1 x … (dimN/blockSize) x 1>.

In this example, before calling into arith.scaling_truncf, scales must be broadcasted to <dim1 x dim2 x dim3 … (dimN/blockSize) x blockSize>. Note that there could be multiple quantization axes. Internally, arith.scaling_truncf would perform the following:

```mlir // Cast scale to input type. %0 = arith.truncf %1 : f32 to f8E8M0FNU %1 = arith.extf %0 : f8E8M0FNU to f16

// Perform scaling. %3 = arith.divf %2, %1 : f16

// Cast to result type. %4 = arith.truncf %3 : f16 to f4E2M1FN ```

Example:

```mlir // Downcast from f32 to f4E2M1FN. %a = arith.scaling_truncf %b, %c : f32, f8E8M0FNU to f4E2M1FN

// Element-wise downcast with broadcast (blockSize = 32). %f = vector.broadcast %g : vector<1xf8E8M0FNU> to vector<32xf8E8M0FNU> %h = arith.scaling_truncf %i, %f : vector<32xbf16>, vector<32xf8E8M0FNU> to vector<32xf4E2M1FN> ```

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.ScalingTruncFOpAdaptor

OPERATION_NAME = 'arith.scaling_truncf'
property fastmath: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute]
property in_: iree.compiler._mlir_libs._mlir.ir.Value
property out: iree.compiler._mlir_libs._mlir.ir.OpResult
property roundingmode: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute]
property scale: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.ScalingTruncFOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.scaling_truncf'
property fastmath: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute]
property in_: iree.compiler._mlir_libs._mlir.ir.Value
property roundingmode: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute]
property scale: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.SelectOp(condition, true_value, false_value, *, results=None, loc=None, ip=None)

The arith.select operation chooses one value based on a binary condition supplied as its first operand.

If the value of the first operand (the condition) is 1, then the second operand is returned, and the third operand is ignored, even if it was poison.

If the value of the first operand (the condition) is 0, then the third operand is returned, and the second operand is ignored, even if it was poison.

If the value of the first operand (the condition) is poison, then the operation returns poison.

The operation applies to vectors and tensors elementwise given the _shape_ of all operands is identical. The choice is made for each element individually based on the value at the same position as the element in the condition operand. If an i1 is provided as the condition, the entire vector or tensor is chosen.

Example:

```mlir // Custom form of scalar selection. %x = arith.select %cond, %true, %false : i32

// Generic form of the same operation. %x = “arith.select”(%cond, %true, %false) : (i1, i32, i32) -> i32

// Element-wise vector selection. %vx = arith.select %vcond, %vtrue, %vfalse : vector<42xi1>, vector<42xf32>

// Full vector selection. %vx = arith.select %cond, %vtrue, %vfalse : vector<42xf32> ```

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.SelectOpAdaptor

OPERATION_NAME = 'arith.select'
property condition: iree.compiler._mlir_libs._mlir.ir.Value
property false_value: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property true_value: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.SelectOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.select'
property condition: iree.compiler._mlir_libs._mlir.ir.Value
property false_value: iree.compiler._mlir_libs._mlir.ir.Value
property true_value: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.ShLIOp(lhs, rhs, *, overflowFlags=None, results=None, loc=None, ip=None)

The shli operation shifts the integer value of the first operand to the left by the integer value of the second operand. The second operand is interpreted as unsigned. The low order bits are filled with zeros. If the value of the second operand is greater or equal than the bitwidth of the first operand, then the operation returns poison.

This op supports nuw/nsw overflow flags which stands for “No Unsigned Wrap” and “No Signed Wrap”, respectively. If the nuw and/or nsw flags are present, and an unsigned/signed overflow occurs (respectively), the result is poison.

Example:

`mlir %1 = arith.constant 5 : i8  // %1 is 0b00000101 %2 = arith.constant 3 : i8 %3 = arith.shli %1, %2 : i8 // %3 is 0b00101000 %4 = arith.shli %1, %2 overflow<nsw, nuw> : i8 `

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.ShLIOpAdaptor

OPERATION_NAME = 'arith.shli'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property overflowFlags: iree.compiler._mlir_libs._mlir.ir.Attribute
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.ShLIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.shli'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property overflowFlags: iree.compiler._mlir_libs._mlir.ir.Attribute
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.ShRSIOp(lhs, rhs, *, isExact=None, results=None, loc=None, ip=None)

The shrsi operation shifts an integer value of the first operand to the right by the value of the second operand. The first operand is interpreted as signed, and the second operand is interpreter as unsigned. The high order bits in the output are filled with copies of the most-significant bit of the shifted value (which means that the sign of the value is preserved). If the value of the second operand is greater or equal than bitwidth of the first operand, then the operation returns poison.

If the exact attribute is present, the result value of shrsi is a poison value if any of the bits shifted out are non-zero.

Example:

`mlir %1 = arith.constant 160 : i8         // %1 is 0b10100000 %2 = arith.constant 3 : i8 %3 = arith.shrsi %1, %2 exact : i8   // %3 is 0b11110100 %4 = arith.constant 98 : i8          // %4 is 0b01100010 %5 = arith.shrsi %4, %2 : i8         // %5 is 0b00001100 `

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.ShRSIOpAdaptor

OPERATION_NAME = 'arith.shrsi'
property isExact: bool
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.ShRSIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.shrsi'
property isExact: bool
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.ShRUIOp(lhs, rhs, *, isExact=None, results=None, loc=None, ip=None)

The shrui operation shifts an integer value of the first operand to the right by the value of the second operand. The first operand is interpreted as unsigned, and the second operand is interpreted as unsigned. The high order bits are always filled with zeros. If the value of the second operand is greater or equal than the bitwidth of the first operand, then the operation returns poison.

If the exact attribute is present, the result value of shrui is a poison value if any of the bits shifted out are non-zero.

Example:

`mlir %1 = arith.constant 160 : i8        // %1 is 0b10100000 %2 = arith.constant 3 : i8 %3 = arith.constant 6 : i8 %4 = arith.shrui %1, %2 exact : i8  // %4 is 0b00010100 %5 = arith.shrui %1, %3 : i8        // %3 is 0b00000010 `

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.ShRUIOpAdaptor

OPERATION_NAME = 'arith.shrui'
property isExact: bool
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.ShRUIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.shrui'
property isExact: bool
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.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.

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.dialects.arith.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.dialects.arith.StridedLayoutAttr(*args, **kwargs)
attr_name = 'builtin.strided_layout'
get = <nanobind.nb_func object>
get_fully_dynamic = <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.dialects.arith.StringAttr(*args, **kwargs)
attr_name = 'builtin.string'
get = <nanobind.nb_func object>
get_typed = <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.dialects.arith.SubFOp(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None)

The subf operation takes two operands and returns one result, each of these is required to be the same type. This type may be a floating point scalar type, a vector whose element type is a floating point type, or a floating point tensor.

Example:

```mlir // Scalar subtraction. %a = arith.subf %b, %c : f64

// SIMD vector subtraction, e.g. for Intel SSE. %f = arith.subf %g, %h : vector<4xf32>

// Tensor subtraction. %x = arith.subf %y, %z : tensor<4x?xbf16> ```

TODO: In the distant future, this will accept optional attributes for fast math, contraction, rounding mode, and other controls.

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.SubFOpAdaptor

OPERATION_NAME = 'arith.subf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.SubFOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.subf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.SubIOp(lhs, rhs, *, overflowFlags=None, results=None, loc=None, ip=None)

Performs N-bit subtraction on the operands. The operands are interpreted as unsigned bitvectors. The result is represented by a bitvector containing the mathematical value of the subtraction modulo 2^n, where n is the bitwidth. Because arith integers use a two’s complement representation, this operation is applicable on both signed and unsigned integer operands.

The subi operation takes two operands and returns one result, each of these is required to be the same type. This type may be an integer scalar type, a vector whose element type is integer, or a tensor of integers.

This op supports nuw/nsw overflow flags which stands for “No Unsigned Wrap” and “No Signed Wrap”, respectively. If the nuw and/or nsw flags are present, and an unsigned/signed overflow occurs (respectively), the result is poison.

Example:

```mlir // Scalar subtraction. %a = arith.subi %b, %c : i64

// Scalar subtraction with overflow flags. %a = arith.subi %b, %c overflow<nsw, nuw> : i64

// SIMD vector element-wise subtraction. %f = arith.subi %g, %h : vector<4xi32>

// Tensor element-wise subtraction. %x = arith.subi %y, %z : tensor<4x?xi8> ```

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.SubIOpAdaptor

OPERATION_NAME = 'arith.subi'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property overflowFlags: iree.compiler._mlir_libs._mlir.ir.Attribute
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.SubIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.subi'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property overflowFlags: iree.compiler._mlir_libs._mlir.ir.Attribute
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.SymbolRefAttr(*args, **kwargs)
attr_name = 'builtin.symbol_ref'
get = <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.dialects.arith.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.dialects.arith.ThreadPool(*args, **kwargs)
get_max_concurrency

Returns the maximum number of threads in the pool.

class iree.compiler.dialects.arith.TruncFOp(out, in_, *, roundingmode=None, fastmath=None, loc=None, ip=None)

Truncate a floating-point value to a smaller floating-point-typed value. The destination type must be strictly narrower than the source type. If the value cannot be exactly represented, it is rounded using the provided rounding mode or the default one if no rounding mode is provided. When operating on vectors, casts elementwise.

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.TruncFOpAdaptor

OPERATION_NAME = 'arith.truncf'
property fastmath: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute]
property in_: iree.compiler._mlir_libs._mlir.ir.Value
property out: iree.compiler._mlir_libs._mlir.ir.OpResult
property roundingmode: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute]
class iree.compiler.dialects.arith.TruncFOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.truncf'
property fastmath: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute]
property in_: iree.compiler._mlir_libs._mlir.ir.Value
property roundingmode: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute]
class iree.compiler.dialects.arith.TruncIOp(out, in_, *, overflowFlags=None, loc=None, ip=None)

The integer truncation operation takes an integer input of width M and an integer destination type of width N. The destination bit-width must be smaller than the input bit-width (N < M). The top-most (N - M) bits of the input are discarded.

This op supports nuw/nsw overflow flags which stands for “No Unsigned Wrap” and “No Signed Wrap”, respectively. If the nuw keyword is present, and any of the truncated bits are non-zero, the result is a poison value. If the nsw keyword is present, and any of the truncated bits are not the same as the top bit of the truncation result, the result is a poison value.

Example:

```mlir

// Scalar truncation. %1 = arith.constant 21 : i5 // %1 is 0b10101 %2 = arith.trunci %1 : i5 to i4 // %2 is 0b0101 %3 = arith.trunci %1 : i5 to i3 // %3 is 0b101

// Vector truncation. %4 = arith.trunci %0 : vector<2 x i32> to vector<2 x i16>

// Scalar truncation with overflow flags. %5 = arith.trunci %a overflow<nsw, nuw> : i32 to i16

```

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.TruncIOpAdaptor

OPERATION_NAME = 'arith.trunci'
property in_: iree.compiler._mlir_libs._mlir.ir.Value
property out: iree.compiler._mlir_libs._mlir.ir.OpResult
property overflowFlags: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.arith.TruncIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.trunci'
property in_: iree.compiler._mlir_libs._mlir.ir.Value
property overflowFlags: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.arith.TupleType(*args, **kwargs)
get_tuple = <nanobind.nb_func object>
get_type

Returns the pos-th type in the tuple type.

property num_types

Returns the number of types contained in a tuple.

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.tuple'
property typeid

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

class iree.compiler.dialects.arith.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.dialects.arith.TypeAttr(*args, **kwargs)
attr_name = 'builtin.type'
get = <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.dialects.arith.TypeID
class iree.compiler.dialects.arith.UIToFPOp(out, in_, *, loc=None, ip=None)

Cast from a value interpreted as unsigned integer to the corresponding floating-point value. If the value cannot be exactly represented, it is rounded using the default rounding mode. When operating on vectors, casts elementwise.

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.UIToFPOpAdaptor

OPERATION_NAME = 'arith.uitofp'
property in_: iree.compiler._mlir_libs._mlir.ir.Value
property out: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.arith.UIToFPOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.uitofp'
property in_: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.UnitAttr(*args, **kwargs)
attr_name = 'builtin.unit'
get = <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.dialects.arith.UnrankedMemRefType(*args, **kwargs)
get = <nanobind.nb_func object>
get_unchecked = <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>
type_name = 'builtin.unranked_memref'
property typeid

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

class iree.compiler.dialects.arith.UnrankedTensorType(*args, **kwargs)
get = <nanobind.nb_func object>
get_unchecked = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.unranked_tensor'
property typeid

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

class iree.compiler.dialects.arith.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.dialects.arith.VectorType(*args, **kwargs)
get = <nanobind.nb_func object>
get_unchecked = <nanobind.nb_func object>
property scalable

(self) -> bool

property scalable_dims

(self) -> list[bool]

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.vector'
property typeid

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

enum iree.compiler.dialects.arith.WalkOrder(value)

Valid values are as follows:

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

Valid values are as follows:

ADVANCE = WalkResult.ADVANCE
INTERRUPT = WalkResult.INTERRUPT
SKIP = WalkResult.SKIP
class iree.compiler.dialects.arith.XOrIOp(lhs, rhs, *, results=None, loc=None, ip=None)

The xori operation takes two operands and returns one result, each of these is required to be the same type. This type may be an integer scalar type, a vector whose element type is integer, or a tensor of integers. It has no standard attributes.

Example:

```mlir // Scalar integer bitwise xor. %a = arith.xori %b, %c : i64

// SIMD vector element-wise bitwise integer xor. %f = arith.xori %g, %h : vector<4xi32>

// Tensor element-wise bitwise integer xor. %x = arith.xori %y, %z : tensor<4x?xi8> ```

Adaptor

alias of iree.compiler.dialects._arith_ops_gen.XOrIOpAdaptor

OPERATION_NAME = 'arith.xori'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.arith.XOrIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'arith.xori'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
iree.compiler.dialects.arith.addf(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.addi(lhs, rhs, *, overflow_flags=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.addui_extended(sum, overflow, lhs, rhs, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResultList
iree.compiler.dialects.arith.andi(lhs, rhs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.append_load_on_create_dialect(dialect: str)
class iree.compiler.dialects.arith.auto(value=_auto_null)

Instances are replaced with an appropriate value in Enum class suites.

iree.compiler.dialects.arith.bitcast(out, in_, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.ceildivsi(lhs, rhs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.ceildivui(lhs, rhs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.cmpf(predicate, lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.cmpi(predicate, lhs, rhs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.constant(result: iree.compiler._mlir_libs._mlir.ir.Type, value: Union[int, float, iree.compiler._mlir_libs._mlir.ir.Attribute, array.array], *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.Value
iree.compiler.dialects.arith.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.dialects.arith.divf(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.divsi(lhs, rhs, *, is_exact=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.divui(lhs, rhs, *, is_exact=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.extf(out, in_, *, fastmath=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.extsi(out, in_, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.extui(out, in_, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.floordivsi(lhs, rhs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.fptosi(out, in_, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.fptoui(out, in_, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.get_dialect_registry()
iree.compiler.dialects.arith.get_load_on_create_dialects()
iree.compiler.dialects.arith.index_cast(out, in_, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.index_castui(out, in_, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.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.dialects.arith.maximumf(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.maxnumf(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.maxsi(lhs, rhs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.maxui(lhs, rhs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.minimumf(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.minnumf(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.minsi(lhs, rhs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.minui(lhs, rhs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.mulf(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.muli(lhs, rhs, *, overflow_flags=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.mulsi_extended(lhs, rhs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResultList
iree.compiler.dialects.arith.mului_extended(lhs, rhs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResultList
iree.compiler.dialects.arith.negf(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.ori(lhs, rhs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.overload(func)

Decorator for overloaded functions/methods.

In a stub file, place two or more stub definitions for the same function in a row, each decorated with @overload.

For example:

@overload
def utf8(value: None) -> None: ...
@overload
def utf8(value: bytes) -> bytes: ...
@overload
def utf8(value: str) -> bytes: ...

In a non-stub file (i.e. a regular .py file), do the same but follow it with an implementation. The implementation should not be decorated with @overload:

@overload
def utf8(value: None) -> None: ...
@overload
def utf8(value: bytes) -> bytes: ...
@overload
def utf8(value: str) -> bytes: ...
def utf8(value):
    ...  # implementation goes here

The overloads for a function can be retrieved at runtime using the get_overloads() function.

iree.compiler.dialects.arith.register_attribute_builder(kind, replace=False)
iree.compiler.dialects.arith.remf(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.remsi(lhs, rhs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.remui(lhs, rhs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.scaling_extf(out, in_, scale, *, fastmath=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.scaling_truncf(out, in_, scale, *, roundingmode=None, fastmath=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.select(condition, true_value, false_value, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.shli(lhs, rhs, *, overflow_flags=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.shrsi(lhs, rhs, *, is_exact=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.shrui(lhs, rhs, *, is_exact=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.sitofp(out, in_, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.subf(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.subi(lhs, rhs, *, overflow_flags=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.truncf(out, in_, *, roundingmode=None, fastmath=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.trunci(out, in_, *, overflow_flags=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.uitofp(out, in_, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.arith.xori(lhs, rhs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult

builtin dialect

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

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

property rhs

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

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

(self) -> int

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

(self) -> int

class iree.compiler.dialects.builtin.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>
maybe_downcast
shift_dims
shift_symbols
simplify_affine_expr = <nanobind.nb_func object>
class iree.compiler.dialects.builtin.AffineExprList
class iree.compiler.dialects.builtin.AffineFloorDivExpr(*args, **kwargs)
get = <nanobind.nb_func object>
class iree.compiler.dialects.builtin.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) -> mlir::python::mlir::PyAffineMapExprList

class iree.compiler.dialects.builtin.AffineMapAttr(*args, **kwargs)
attr_name = 'builtin.affine_map'
get = <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.dialects.builtin.AffineModExpr(*args, **kwargs)
get = <nanobind.nb_func object>
class iree.compiler.dialects.builtin.AffineMulExpr(*args, **kwargs)
get = <nanobind.nb_func object>
class iree.compiler.dialects.builtin.AffineSymbolExpr(*args, **kwargs)
get = <nanobind.nb_func object>
property position

(self) -> int

class iree.compiler.dialects.builtin.ArrayAttr(*args, **kwargs)
attr_name = 'builtin.array'
get = <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.dialects.builtin.ArrayAttributeIterator
class iree.compiler.dialects.builtin.AsmState(*args, **kwargs)
class iree.compiler.dialects.builtin.AttrBuilder
contains = <nanobind.nb_func object>
get = <nanobind.nb_func object>
insert = <nanobind.nb_func object>
class iree.compiler.dialects.builtin.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.dialects.builtin.BF16Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.bf16'
property typeid

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

class iree.compiler.dialects.builtin.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.dialects.builtin.BlockArgument(*args, **kwargs)
property arg_number

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

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.dialects.builtin.BlockArgumentList
property types

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

class iree.compiler.dialects.builtin.BlockIterator
class iree.compiler.dialects.builtin.BlockList
append

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

Returns

The created block.

class iree.compiler.dialects.builtin.BlockPredecessors
class iree.compiler.dialects.builtin.BlockSuccessors
class iree.compiler.dialects.builtin.BoolAttr(*args, **kwargs)
get = <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.dialects.builtin.ComplexType(*args, **kwargs)
property element_type

Returns element type.

get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.complex'
property typeid

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

class iree.compiler.dialects.builtin.Context(load_on_create_dialects=None, thread_pool=None, *args, **kwargs)
class iree.compiler.dialects.builtin.DenseBoolArrayAttr(*args, **kwargs)
get = <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.dialects.builtin.DenseBoolArrayIterator
class iree.compiler.dialects.builtin.DenseElementsAttr(*args, **kwargs)
get = <nanobind.nb_func object>
get_splat = <nanobind.nb_func object>
get_splat_value
property is_splat

(self) -> bool

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.dialects.builtin.DenseF32ArrayAttr(*args, **kwargs)
get = <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.dialects.builtin.DenseF32ArrayIterator
class iree.compiler.dialects.builtin.DenseF64ArrayAttr(*args, **kwargs)
get = <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.dialects.builtin.DenseF64ArrayIterator
class iree.compiler.dialects.builtin.DenseFPElementsAttr(*args, **kwargs)
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.dialects.builtin.DenseI16ArrayAttr(*args, **kwargs)
get = <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.dialects.builtin.DenseI16ArrayIterator
class iree.compiler.dialects.builtin.DenseI32ArrayAttr(*args, **kwargs)
get = <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.dialects.builtin.DenseI32ArrayIterator
class iree.compiler.dialects.builtin.DenseI64ArrayAttr(*args, **kwargs)
get = <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.dialects.builtin.DenseI64ArrayIterator
class iree.compiler.dialects.builtin.DenseI8ArrayAttr(*args, **kwargs)
get = <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.dialects.builtin.DenseI8ArrayIterator
class iree.compiler.dialects.builtin.DenseIntElementsAttr(*args, **kwargs)
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.dialects.builtin.DenseResourceElementsAttr(*args, **kwargs)
attr_name = 'builtin.dense_resource_elements'
get_from_buffer = <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.dialects.builtin.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.dialects.builtin.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.dialects.builtin.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.dialects.builtin.DiagnosticSeverity(value)

Valid values are as follows:

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

Returns the DialectDescriptor for this dialect.

class iree.compiler.dialects.builtin.DialectDescriptor
property namespace

Returns the namespace of the dialect.

class iree.compiler.dialects.builtin.DialectRegistry(*args, **kwargs)
class iree.compiler.dialects.builtin.Dialects
class iree.compiler.dialects.builtin.DictAttr(*args, **kwargs)
attr_name = 'builtin.dictionary'
get = <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.dialects.builtin.F16Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f16'
property typeid

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

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

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

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

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

class iree.compiler.dialects.builtin.FlatSymbolRefAttr(*args, **kwargs)
attr_name = 'builtin.symbol_ref'
get = <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.dialects.builtin.Float4E2M1FNType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f4E2M1FN'
property typeid

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

class iree.compiler.dialects.builtin.FloatAttr(*args, **kwargs)
attr_name = 'builtin.float'
get = <nanobind.nb_func object>
get_f32 = <nanobind.nb_func object>
get_f64 = <nanobind.nb_func object>
get_unchecked = <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.dialects.builtin.FloatTF32Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.tf32'
property typeid

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

class iree.compiler.dialects.builtin.FloatType(*args, **kwargs)
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.dialects.builtin.FunctionType(*args, **kwargs)
get = <nanobind.nb_func object>
property inputs

Returns the list of input types in the FunctionType.

property results

Returns the list of result types in the FunctionType.

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.function'
property typeid

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

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

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

class iree.compiler.dialects.builtin.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.dialects.builtin.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.dialects.builtin.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.dialects.builtin.IntegerAttr(*args, **kwargs)
attr_name = 'builtin.integer'
get = <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.dialects.builtin.IntegerSet
property constraints

(self) -> mlir::python::mlir::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.dialects.builtin.IntegerSetAttr(*args, **kwargs)
attr_name = 'builtin.integer_set'
get = <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.dialects.builtin.IntegerSetConstraint
property expr

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

property is_eq

(self) -> bool

class iree.compiler.dialects.builtin.IntegerSetConstraintList
class iree.compiler.dialects.builtin.IntegerType(*args, **kwargs)
SIGNED = 1
SIGNLESS = 0
enum Signedness(value)

Valid values are as follows:

SIGNLESS = Signedness.SIGNLESS
SIGNED = Signedness.SIGNED
UNSIGNED = Signedness.UNSIGNED
UNSIGNED = 2
get = <nanobind.nb_func object>
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

property signedness

(self) -> iree.compiler._mlir_libs._mlir.ir.IntegerType.Signedness

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.integer'
property typeid

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

property width

Returns the width of the integer type

class iree.compiler.dialects.builtin.Iterable
class iree.compiler.dialects.builtin.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.dialects.builtin.MLIRError(message, error_diagnostics)
An exception with diagnostic information. Has the following fields:

message: str error_diagnostics: List[ir.DiagnosticInfo]

class iree.compiler.dialects.builtin.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>
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>
type_name = 'builtin.memref'
property typeid

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

class iree.compiler.dialects.builtin.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.dialects.builtin.ModuleOp(*, loc=None, ip=None)

Specialization for the module op class.

property body
class iree.compiler.dialects.builtin.ModuleOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'builtin.module'
property sym_name: Optional[iree.compiler._mlir_libs._mlir.ir.StringAttr]
property sym_visibility: Optional[iree.compiler._mlir_libs._mlir.ir.StringAttr]
class iree.compiler.dialects.builtin.NamedAttribute
property attr

The underlying generic attribute of the NamedAttribute binding.

property name

The name of the NamedAttribute binding.

class iree.compiler.dialects.builtin.NoneType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.none'
property typeid

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

class iree.compiler.dialects.builtin.OpAdaptor(*args, **kwargs)
property attributes

Returns the attributes of the adaptor.

property operands

Returns the operands of the adaptor.

class iree.compiler.dialects.builtin.OpAttributeMap
get

Gets an attribute by name or the default value, if it does not exist.

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.dialects.builtin.OpOperand
property operand_number

Returns the operand number in the owning operation.

property owner

Returns the operation that owns this operand.

class iree.compiler.dialects.builtin.OpOperandIterator
class iree.compiler.dialects.builtin.OpOperandList
class iree.compiler.dialects.builtin.OpResult(*args, **kwargs)
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.dialects.builtin.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.dialects.builtin.OpSuccessors
class iree.compiler.dialects.builtin.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.dialects.builtin.OpaqueAttr(*args, **kwargs)
attr_name = 'builtin.opaque'
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>
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.dialects.builtin.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>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.opaque'
property typeid

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

class iree.compiler.dialects.builtin.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.dialects.builtin.OperationIterator
class iree.compiler.dialects.builtin.OperationList
class iree.compiler.dialects.builtin.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>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.tensor'
property typeid

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

class iree.compiler.dialects.builtin.Region
property blocks

Returns a forward-optimized sequence of blocks.

property owner

Returns the operation owning this region.

class iree.compiler.dialects.builtin.RegionIterator
class iree.compiler.dialects.builtin.RegionSequence
class iree.compiler.dialects.builtin.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.

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.dialects.builtin.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.dialects.builtin.StridedLayoutAttr(*args, **kwargs)
attr_name = 'builtin.strided_layout'
get = <nanobind.nb_func object>
get_fully_dynamic = <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.dialects.builtin.StringAttr(*args, **kwargs)
attr_name = 'builtin.string'
get = <nanobind.nb_func object>
get_typed = <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.dialects.builtin.SymbolRefAttr(*args, **kwargs)
attr_name = 'builtin.symbol_ref'
get = <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.dialects.builtin.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.dialects.builtin.ThreadPool(*args, **kwargs)
get_max_concurrency

Returns the maximum number of threads in the pool.

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

Returns the pos-th type in the tuple type.

property num_types

Returns the number of types contained in a tuple.

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.tuple'
property typeid

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

class iree.compiler.dialects.builtin.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.dialects.builtin.TypeAttr(*args, **kwargs)
attr_name = 'builtin.type'
get = <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.dialects.builtin.TypeID
class iree.compiler.dialects.builtin.UnitAttr(*args, **kwargs)
attr_name = 'builtin.unit'
get = <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.dialects.builtin.UnrankedMemRefType(*args, **kwargs)
get = <nanobind.nb_func object>
get_unchecked = <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>
type_name = 'builtin.unranked_memref'
property typeid

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

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

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

class iree.compiler.dialects.builtin.UnrealizedConversionCastOp(outputs, inputs, *, loc=None, ip=None)

An unrealized_conversion_cast operation represents an unrealized conversion from one set of types to another, that is used to enable the inter-mixing of different type systems. This operation should not be attributed any special representational or execution semantics, and is generally only intended to be used to satisfy the temporary intermixing of type systems during the conversion of one type system to another.

This operation may produce results of arity 1-N, and accept as input operands of arity 0-N.

Example:

```mlir // An unrealized 0-1 conversion. These types of conversions are useful in // cases where a type is removed from the type system, but not all uses have // been converted. For example, imagine we have a tuple type that is // expanded to its element types. If only some uses of an empty tuple type // instance are converted we still need an instance of the tuple type, but // have no inputs to the unrealized conversion. %result = unrealized_conversion_cast to !bar.tuple_type<>

// An unrealized 1-1 conversion. %result1 = unrealized_conversion_cast %operand : !foo.type to !bar.lowered_type

// An unrealized 1-N conversion. %results2:2 = unrealized_conversion_cast %tuple_operand : !foo.tuple_type<!foo.type, !foo.type> to !foo.type, !foo.type

// An unrealized N-1 conversion. %result3 = unrealized_conversion_cast %operand, %operand : !foo.type, !foo.type to !bar.tuple_type<!foo.type, !foo.type> ```

Adaptor

alias of iree.compiler.dialects._builtin_ops_gen.UnrealizedConversionCastOpAdaptor

OPERATION_NAME = 'builtin.unrealized_conversion_cast'
property inputs: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property outputs: iree.compiler._mlir_libs._mlir.ir.OpResultList
class iree.compiler.dialects.builtin.UnrealizedConversionCastOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'builtin.unrealized_conversion_cast'
property inputs: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.builtin.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.dialects.builtin.VectorType(*args, **kwargs)
get = <nanobind.nb_func object>
get_unchecked = <nanobind.nb_func object>
property scalable

(self) -> bool

property scalable_dims

(self) -> list[bool]

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.vector'
property typeid

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

enum iree.compiler.dialects.builtin.WalkOrder(value)

Valid values are as follows:

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

Valid values are as follows:

ADVANCE = WalkResult.ADVANCE
INTERRUPT = WalkResult.INTERRUPT
SKIP = WalkResult.SKIP
iree.compiler.dialects.builtin.append_load_on_create_dialect(dialect: str)
iree.compiler.dialects.builtin.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.dialects.builtin.get_dialect_registry()
iree.compiler.dialects.builtin.get_load_on_create_dialects()
iree.compiler.dialects.builtin.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.dialects.builtin.module(*args, **kwargs)
iree.compiler.dialects.builtin.region_op(op_constructor, terminator=None)

Decorator to define an MLIR Op specified as a python function.

Requires that an mlir.ir.InsertionPoint and mlir.ir.Location are active for the current thread (i.e. established in a with block).

Supports “naked” usage i.e., no parens if no args need to be passed to the Op constructor.

When applied as a decorator to a Python function, an entry block will be constructed for the Op with types as specified as type hints on the args of the function. The block arguments will be passed positionally to the Python function.

If a terminator is specified then the return from the decorated function will be passed to the terminator as the last statement in the entry block. Note, the API for the terminator is a (possibly empty) list; terminator accepting single values should be wrapped in a lambda args: term(args[0])

The identifier (name) of the function will become: 1. A single value result if the Op returns a single value; 2. An OpResultList (as a list) if the Op returns multiple values; 3. The Operation if the Op returns no results.

See examples in tensor.py and transform.extras.

iree.compiler.dialects.builtin.register_attribute_builder(kind, replace=False)
iree.compiler.dialects.builtin.unrealized_conversion_cast(outputs, inputs, *, loc=None, ip=None) Union[iree.compiler._mlir_libs._mlir.ir.OpResult, iree.compiler._mlir_libs._mlir.ir.OpResultList, iree.compiler.dialects._builtin_ops_gen.UnrealizedConversionCastOp]

cf dialect

class iree.compiler.dialects.cf.AssertOp(arg, msg, *, loc=None, ip=None)

Assert operation at runtime with single boolean operand and an error message attribute. If the argument is true this operation has no effect. Otherwise, the program execution will abort. The provided error message may be used by a runtime to propagate the error to the user.

Example:

`mlir cf.assert %b, "Expected ... to be true" `

Adaptor

alias of iree.compiler.dialects._cf_ops_gen.AssertOpAdaptor

OPERATION_NAME = 'cf.assert'
property arg: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]
property msg: iree.compiler._mlir_libs._mlir.ir.StringAttr
class iree.compiler.dialects.cf.AssertOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'cf.assert'
property arg: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]
property msg: iree.compiler._mlir_libs._mlir.ir.StringAttr
class iree.compiler.dialects.cf.BranchOp(destOperands, dest, *, loc=None, ip=None)

The cf.br operation represents a direct branch operation to a given block. The operands of this operation are forwarded to the successor block, and the number and type of the operands must match the arguments of the target block.

Example:

```mlir ^bb2:

%2 = call @someFn() cf.br ^bb3(%2 : tensor<*xf32>)

^bb3(%3: tensor<*xf32>): ```

Adaptor

alias of iree.compiler.dialects._cf_ops_gen.BranchOpAdaptor

OPERATION_NAME = 'cf.br'
property destOperands: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.cf.BranchOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'cf.br'
property destOperands: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.cf.CondBranchOp(condition, trueDestOperands, falseDestOperands, trueDest, falseDest, *, branch_weights=None, loc=None, ip=None)

The cf.cond_br terminator operation represents a conditional branch on a boolean (1-bit integer) value. If the bit is set, then the first destination is jumped to; if it is false, the second destination is chosen. The count and types of operands must align with the arguments in the corresponding target blocks.

The MLIR conditional branch operation is not allowed to target the entry block for a region. The two destinations of the conditional branch operation are allowed to be the same.

The following example illustrates a function with a conditional branch operation that targets the same block.

Example:

```mlir func.func @select(%a: i32, %b: i32, %flag: i1) -> i32 {

// Both targets are the same, operands differ cf.cond_br %flag, ^bb1(%a : i32), ^bb1(%b : i32)

^bb1(%xi32) :

return %x : i32

Adaptor

alias of iree.compiler.dialects._cf_ops_gen.CondBranchOpAdaptor

OPERATION_NAME = 'cf.cond_br'
property branch_weights: Optional[iree.compiler._mlir_libs._mlir.ir.DenseI32ArrayAttr]
property condition: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]
property falseDestOperands: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property trueDestOperands: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.cf.CondBranchOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'cf.cond_br'
property branch_weights: Optional[iree.compiler._mlir_libs._mlir.ir.DenseI32ArrayAttr]
property condition: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]
property falseDestOperands: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property trueDestOperands: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.cf.SwitchOp(flag, defaultOperands, caseOperands, case_operand_segments, defaultDestination, caseDestinations, *, case_values=None, loc=None, ip=None)

The cf.switch terminator operation represents a switch on a signless integer value. If the flag matches one of the specified cases, then the corresponding destination is jumped to. If the flag does not match any of the cases, the default destination is jumped to. The count and types of operands must align with the arguments in the corresponding target blocks.

Example:

```mlir cf.switch %flag : i32, [

default: ^bb1(%a : i32), 42: ^bb1(%b : i32), 43: ^bb3(%c : i32)

Adaptor

alias of iree.compiler.dialects._cf_ops_gen.SwitchOpAdaptor

OPERATION_NAME = 'cf.switch'
property caseOperands: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property case_operand_segments: iree.compiler._mlir_libs._mlir.ir.DenseI32ArrayAttr
property case_values: Optional[iree.compiler._mlir_libs._mlir.ir.DenseIntElementsAttr]
property defaultOperands: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property flag: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]
class iree.compiler.dialects.cf.SwitchOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'cf.switch'
property caseOperands: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property case_operand_segments: iree.compiler._mlir_libs._mlir.ir.DenseI32ArrayAttr
property case_values: Optional[iree.compiler._mlir_libs._mlir.ir.DenseIntElementsAttr]
property defaultOperands: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property flag: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]
iree.compiler.dialects.cf.assert_(arg, msg, *, loc=None, ip=None) iree.compiler.dialects._cf_ops_gen.AssertOp
iree.compiler.dialects.cf.br(dest_operands, dest, *, loc=None, ip=None) iree.compiler.dialects._cf_ops_gen.BranchOp
iree.compiler.dialects.cf.cond_br(condition, true_dest_operands, false_dest_operands, true_dest, false_dest, *, branch_weights=None, loc=None, ip=None) iree.compiler.dialects._cf_ops_gen.CondBranchOp
iree.compiler.dialects.cf.switch(flag, default_operands, case_operands, case_operand_segments, default_destination, case_destinations, *, case_values=None, loc=None, ip=None) iree.compiler.dialects._cf_ops_gen.SwitchOp

complex dialect

class iree.compiler.dialects.complex.AbsOp(complex, *, fastmath=None, results=None, loc=None, ip=None)

The abs op takes a single complex number and computes its absolute value.

Example:

`mlir %a = complex.abs %b : complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.AbsOpAdaptor

OPERATION_NAME = 'complex.abs'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.FloatType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.complex.AbsOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.abs'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.complex.AddOp(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None)

The add operation takes two complex numbers and returns their sum.

Example:

`mlir %a = complex.add %b, %c : complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.AddOpAdaptor

OPERATION_NAME = 'complex.add'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.ComplexType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
class iree.compiler.dialects.complex.AddOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.add'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property rhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
class iree.compiler.dialects.complex.AngleOp(complex, *, fastmath=None, results=None, loc=None, ip=None)

The angle op takes a single complex number and computes its argument value with a branch cut along the negative real axis.

Example:

```mlir

%a = complex.angle %b : complex<f32>

```

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.AngleOpAdaptor

OPERATION_NAME = 'complex.angle'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.FloatType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.complex.AngleOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.angle'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.complex.Atan2Op(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None)

For complex numbers it is expressed using complex logarithm atan2(y, x) = -i * log((x + i * y) / sqrt(x**2 + y**2))

Example:

`mlir %a = complex.atan2 %b, %c : complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.Atan2OpAdaptor

OPERATION_NAME = 'complex.atan2'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.ComplexType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
class iree.compiler.dialects.complex.Atan2OpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.atan2'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property rhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
class iree.compiler.dialects.complex.BitcastOp(result, operand, *, loc=None, ip=None)

Example:

```mlir

%a = complex.bitcast %b : complex<f32> -> i64

```

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.BitcastOpAdaptor

OPERATION_NAME = 'complex.bitcast'
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.complex.BitcastOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.bitcast'
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.complex.ConjOp(complex, *, fastmath=None, results=None, loc=None, ip=None)

The conj op takes a single complex number and computes the complex conjugate.

Example:

`mlir %a = complex.conj %b: complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.ConjOpAdaptor

OPERATION_NAME = 'complex.conj'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.ComplexType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.complex.ConjOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.conj'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.complex.ConstantOp(complex, value, *, loc=None, ip=None)

The complex.constant operation creates a constant complex number from an attribute containing the real and imaginary parts.

Example:

`mlir %a = complex.constant [0.1, -1.0] : complex<f64> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.ConstantOpAdaptor

OPERATION_NAME = 'complex.constant'
property complex: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property value: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
class iree.compiler.dialects.complex.ConstantOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.constant'
property value: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
class iree.compiler.dialects.complex.CosOp(complex, *, fastmath=None, results=None, loc=None, ip=None)

The cos op takes a single complex number and computes the cosine of it, i.e. cos(x), where x is the input value.

Example:

`mlir %a = complex.cos %b : complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.CosOpAdaptor

OPERATION_NAME = 'complex.cos'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.ComplexType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.complex.CosOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.cos'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.complex.CreateOp(complex, real, imaginary, *, loc=None, ip=None)

The complex.create operation creates a complex number from two floating-point operands, the real and the imaginary part.

Example:

`mlir %a = complex.create %b, %c : complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.CreateOpAdaptor

OPERATION_NAME = 'complex.create'
property complex: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property imaginary: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.FloatType]
property real: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.FloatType]
class iree.compiler.dialects.complex.CreateOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.create'
property imaginary: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.FloatType]
property real: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.FloatType]
class iree.compiler.dialects.complex.DivOp(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None)

The div operation takes two complex numbers and returns result of their division:

`mlir %a = complex.div %b, %c : complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.DivOpAdaptor

OPERATION_NAME = 'complex.div'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.ComplexType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
class iree.compiler.dialects.complex.DivOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.div'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property rhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
class iree.compiler.dialects.complex.EqualOp(lhs, rhs, *, results=None, loc=None, ip=None)

The eq op takes two complex numbers and returns whether they are equal.

Example:

`mlir %a = complex.eq %b, %c : complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.EqualOpAdaptor

OPERATION_NAME = 'complex.eq'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.IntegerType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
class iree.compiler.dialects.complex.EqualOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.eq'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property rhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
class iree.compiler.dialects.complex.ExpOp(complex, *, fastmath=None, results=None, loc=None, ip=None)

The exp op takes a single complex number and computes the exponential of it, i.e. exp(x) or e^(x), where x is the input value. e denotes Euler’s number and is approximately equal to 2.718281.

Example:

`mlir %a = complex.exp %b : complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.ExpOpAdaptor

OPERATION_NAME = 'complex.exp'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.ComplexType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.complex.ExpOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.exp'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.complex.Expm1Op(complex, *, fastmath=None, results=None, loc=None, ip=None)

complex.expm1(x) := complex.exp(x) - 1

Example:

`mlir %a = complex.expm1 %b : complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.Expm1OpAdaptor

OPERATION_NAME = 'complex.expm1'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.ComplexType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.complex.Expm1OpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.expm1'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.complex.ImOp(complex, *, fastmath=None, results=None, loc=None, ip=None)

The im op takes a single complex number and extracts the imaginary part.

Example:

`mlir %a = complex.im %b : complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.ImOpAdaptor

OPERATION_NAME = 'complex.im'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property imaginary: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.FloatType]
class iree.compiler.dialects.complex.ImOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.im'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.complex.Log1pOp(complex, *, fastmath=None, results=None, loc=None, ip=None)

The log op takes a single complex number and computes the natural logarithm of one plus the given value, i.e. log(1 + x) or log_e(1 + x), where x is the input value. e denotes Euler’s number and is approximately equal to 2.718281.

Example:

`mlir %a = complex.log1p %b : complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.Log1pOpAdaptor

OPERATION_NAME = 'complex.log1p'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.ComplexType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.complex.Log1pOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.log1p'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.complex.LogOp(complex, *, fastmath=None, results=None, loc=None, ip=None)

The log op takes a single complex number and computes the natural logarithm of it, i.e. log(x) or log_e(x), where x is the input value. e denotes Euler’s number and is approximately equal to 2.718281.

Example:

`mlir %a = complex.log %b : complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.LogOpAdaptor

OPERATION_NAME = 'complex.log'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.ComplexType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.complex.LogOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.log'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.complex.MulOp(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None)

The mul operation takes two complex numbers and returns their product:

`mlir %a = complex.mul %b, %c : complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.MulOpAdaptor

OPERATION_NAME = 'complex.mul'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.ComplexType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
class iree.compiler.dialects.complex.MulOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.mul'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property rhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
class iree.compiler.dialects.complex.NegOp(complex, *, fastmath=None, results=None, loc=None, ip=None)

The neg op takes a single complex number complex and returns -complex.

Example:

`mlir %a = complex.neg %b : complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.NegOpAdaptor

OPERATION_NAME = 'complex.neg'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.ComplexType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.complex.NegOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.neg'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.complex.NotEqualOp(lhs, rhs, *, results=None, loc=None, ip=None)

The neq op takes two complex numbers and returns whether they are not equal.

Example:

`mlir %a = complex.neq %b, %c : complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.NotEqualOpAdaptor

OPERATION_NAME = 'complex.neq'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.IntegerType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
class iree.compiler.dialects.complex.NotEqualOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.neq'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property rhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
class iree.compiler.dialects.complex.PowOp(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None)

The pow operation takes a complex number raises it to the given complex exponent.

Example:

`mlir %a = complex.pow %b, %c : complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.PowOpAdaptor

OPERATION_NAME = 'complex.pow'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.ComplexType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
class iree.compiler.dialects.complex.PowOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.pow'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property rhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
class iree.compiler.dialects.complex.PowiOp(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None)

The powi operation takes a base operand of complex type and a power operand of signed integer type and returns one result of the same type as base. The result is base raised to the power of power.

Example:

`mlir %a = complex.powi %b, %c : complex<f32>, i32 `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.PowiOpAdaptor

OPERATION_NAME = 'complex.powi'
property fastmath: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute]
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.ComplexType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]
class iree.compiler.dialects.complex.PowiOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.powi'
property fastmath: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute]
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property rhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]
class iree.compiler.dialects.complex.ReOp(complex, *, fastmath=None, results=None, loc=None, ip=None)

The re op takes a single complex number and extracts the real part.

Example:

`mlir %a = complex.re %b : complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.ReOpAdaptor

OPERATION_NAME = 'complex.re'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property real: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.FloatType]
class iree.compiler.dialects.complex.ReOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.re'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.complex.RsqrtOp(complex, *, fastmath=None, results=None, loc=None, ip=None)

The rsqrt operation computes reciprocal of square root.

Example:

`mlir %a = complex.rsqrt %b : complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.RsqrtOpAdaptor

OPERATION_NAME = 'complex.rsqrt'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.ComplexType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.complex.RsqrtOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.rsqrt'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.complex.SignOp(complex, *, fastmath=None, results=None, loc=None, ip=None)

The sign op takes a single complex number and computes the sign of it, i.e. y = sign(x) = x / |x| if x != 0, otherwise y = 0.

Example:

`mlir %a = complex.sign %b : complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.SignOpAdaptor

OPERATION_NAME = 'complex.sign'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.ComplexType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.complex.SignOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.sign'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.complex.SinOp(complex, *, fastmath=None, results=None, loc=None, ip=None)

The sin op takes a single complex number and computes the sine of it, i.e. sin(x), where x is the input value.

Example:

`mlir %a = complex.sin %b : complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.SinOpAdaptor

OPERATION_NAME = 'complex.sin'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.ComplexType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.complex.SinOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.sin'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.complex.SqrtOp(complex, *, fastmath=None, results=None, loc=None, ip=None)

The sqrt operation takes a complex number and returns its square root.

Example:

`mlir %a = complex.sqrt %b : complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.SqrtOpAdaptor

OPERATION_NAME = 'complex.sqrt'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.ComplexType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.complex.SqrtOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.sqrt'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.complex.SubOp(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None)

The sub operation takes two complex numbers and returns their difference.

Example:

`mlir %a = complex.sub %b, %c : complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.SubOpAdaptor

OPERATION_NAME = 'complex.sub'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.ComplexType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
class iree.compiler.dialects.complex.SubOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.sub'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property rhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
class iree.compiler.dialects.complex.TanOp(complex, *, fastmath=None, results=None, loc=None, ip=None)

The tan op takes a single complex number and computes the tangent of it, i.e. tan(x), where x is the input value.

Example:

`mlir %a = complex.tan %b : complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.TanOpAdaptor

OPERATION_NAME = 'complex.tan'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.ComplexType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.complex.TanOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.tan'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.complex.TanhOp(complex, *, fastmath=None, results=None, loc=None, ip=None)

The tanh operation takes a complex number and returns its hyperbolic tangent.

Example:

`mlir %a = complex.tanh %b : complex<f32> `

Adaptor

alias of iree.compiler.dialects._complex_ops_gen.TanhOpAdaptor

OPERATION_NAME = 'complex.tanh'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.ComplexType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.complex.TanhOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'complex.tanh'
property complex: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.ComplexType]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
iree.compiler.dialects.complex.abs(complex, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.add(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.angle(complex, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.atan2(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.bitcast(result, operand, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.conj(complex, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.constant(complex, value, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.cos(complex, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.create_(complex, real, imaginary, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.div(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.eq(lhs, rhs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.exp(complex, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.expm1(complex, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.im(complex, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.log(complex, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.log1p(complex, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.mul(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.neg(complex, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.neq(lhs, rhs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.pow(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.powi(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.re(complex, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.rsqrt(complex, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.sign(complex, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.sin(complex, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.sqrt(complex, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.sub(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.tan(complex, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.complex.tanh(complex, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult

func dialect

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

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

property rhs

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

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

(self) -> int

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

(self) -> int

class iree.compiler.dialects.func.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>
maybe_downcast
shift_dims
shift_symbols
simplify_affine_expr = <nanobind.nb_func object>
class iree.compiler.dialects.func.AffineExprList
class iree.compiler.dialects.func.AffineFloorDivExpr(*args, **kwargs)
get = <nanobind.nb_func object>
class iree.compiler.dialects.func.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) -> mlir::python::mlir::PyAffineMapExprList

class iree.compiler.dialects.func.AffineMapAttr(*args, **kwargs)
attr_name = 'builtin.affine_map'
get = <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.dialects.func.AffineModExpr(*args, **kwargs)
get = <nanobind.nb_func object>
class iree.compiler.dialects.func.AffineMulExpr(*args, **kwargs)
get = <nanobind.nb_func object>
class iree.compiler.dialects.func.AffineSymbolExpr(*args, **kwargs)
get = <nanobind.nb_func object>
property position

(self) -> int

class iree.compiler.dialects.func.Any(*args, **kwargs)

Special type indicating an unconstrained type.

  • Any is compatible with every type.

  • Any assumed to have all methods.

  • All values assumed to be instances of Any.

Note that all the above statements are true from the point of view of static type checkers. At runtime, Any should not be used with instance checks.

class iree.compiler.dialects.func.ArrayAttr(*args, **kwargs)
attr_name = 'builtin.array'
get = <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.dialects.func.ArrayAttributeIterator
class iree.compiler.dialects.func.AsmState(*args, **kwargs)
class iree.compiler.dialects.func.AttrBuilder
contains = <nanobind.nb_func object>
get = <nanobind.nb_func object>
insert = <nanobind.nb_func object>
class iree.compiler.dialects.func.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.dialects.func.BF16Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.bf16'
property typeid

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

class iree.compiler.dialects.func.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.dialects.func.BlockArgument(*args, **kwargs)
property arg_number

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

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.dialects.func.BlockArgumentList
property types

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

class iree.compiler.dialects.func.BlockIterator
class iree.compiler.dialects.func.BlockList
append

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

Returns

The created block.

class iree.compiler.dialects.func.BlockPredecessors
class iree.compiler.dialects.func.BlockSuccessors
class iree.compiler.dialects.func.BoolAttr(*args, **kwargs)
get = <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.dialects.func.CallIndirectOp(results_, callee, callee_operands, *, arg_attrs=None, res_attrs=None, loc=None, ip=None)

The func.call_indirect operation represents an indirect call to a value of function type. The operands and result types of the call must match the specified function type.

Function values can be created with the [func.constant operation](#funcconstant-constantop).

Example:

`mlir %func = func.constant @my_func : (tensor<16xf32>, tensor<16xf32>) -> tensor<16xf32> %result = func.call_indirect %func(%0, %1) : (tensor<16xf32>, tensor<16xf32>) -> tensor<16xf32> `

Adaptor

alias of iree.compiler.dialects._func_ops_gen.CallIndirectOpAdaptor

OPERATION_NAME = 'func.call_indirect'
property arg_attrs: Optional[iree.compiler._mlir_libs._mlir.ir.ArrayAttr]
property callee: iree.compiler._mlir_libs._mlir.ir.Value
property callee_operands: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property res_attrs: Optional[iree.compiler._mlir_libs._mlir.ir.ArrayAttr]
property results_: iree.compiler._mlir_libs._mlir.ir.OpResultList
class iree.compiler.dialects.func.CallIndirectOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'func.call_indirect'
property arg_attrs: Optional[iree.compiler._mlir_libs._mlir.ir.ArrayAttr]
property callee: iree.compiler._mlir_libs._mlir.ir.Value
property callee_operands: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property res_attrs: Optional[iree.compiler._mlir_libs._mlir.ir.ArrayAttr]
class iree.compiler.dialects.func.CallOp(calleeOrResults: Union[iree.compiler.dialects.func.FuncOp, List[iree.compiler._mlir_libs._mlir.ir.Type]], argumentsOrCallee: Union[List, iree.compiler._mlir_libs._mlir.ir.FlatSymbolRefAttr, str], arguments: Optional[List] = None, *, loc=None, ip=None)

Specialization for the call op class.

class iree.compiler.dialects.func.CallOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'func.call'
property arg_attrs: Optional[iree.compiler._mlir_libs._mlir.ir.ArrayAttr]
property callee: iree.compiler._mlir_libs._mlir.ir.FlatSymbolRefAttr
property no_inline: bool
property operands_: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property res_attrs: Optional[iree.compiler._mlir_libs._mlir.ir.ArrayAttr]
class iree.compiler.dialects.func.ComplexType(*args, **kwargs)
property element_type

Returns element type.

get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.complex'
property typeid

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

class iree.compiler.dialects.func.ConstantOp(result, value, *, loc=None, ip=None)

Specialization for the constant op class.

property type
class iree.compiler.dialects.func.ConstantOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'func.constant'
property value: iree.compiler._mlir_libs._mlir.ir.FlatSymbolRefAttr
class iree.compiler.dialects.func.Context(load_on_create_dialects=None, thread_pool=None, *args, **kwargs)
class iree.compiler.dialects.func.DenseBoolArrayAttr(*args, **kwargs)
get = <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.dialects.func.DenseBoolArrayIterator
class iree.compiler.dialects.func.DenseElementsAttr(*args, **kwargs)
get = <nanobind.nb_func object>
get_splat = <nanobind.nb_func object>
get_splat_value
property is_splat

(self) -> bool

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.dialects.func.DenseF32ArrayAttr(*args, **kwargs)
get = <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.dialects.func.DenseF32ArrayIterator
class iree.compiler.dialects.func.DenseF64ArrayAttr(*args, **kwargs)
get = <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.dialects.func.DenseF64ArrayIterator
class iree.compiler.dialects.func.DenseFPElementsAttr(*args, **kwargs)
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.dialects.func.DenseI16ArrayAttr(*args, **kwargs)
get = <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.dialects.func.DenseI16ArrayIterator
class iree.compiler.dialects.func.DenseI32ArrayAttr(*args, **kwargs)
get = <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.dialects.func.DenseI32ArrayIterator
class iree.compiler.dialects.func.DenseI64ArrayAttr(*args, **kwargs)
get = <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.dialects.func.DenseI64ArrayIterator
class iree.compiler.dialects.func.DenseI8ArrayAttr(*args, **kwargs)
get = <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.dialects.func.DenseI8ArrayIterator
class iree.compiler.dialects.func.DenseIntElementsAttr(*args, **kwargs)
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.dialects.func.DenseResourceElementsAttr(*args, **kwargs)
attr_name = 'builtin.dense_resource_elements'
get_from_buffer = <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.dialects.func.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.dialects.func.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.dialects.func.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.dialects.func.DiagnosticSeverity(value)

Valid values are as follows:

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

Returns the DialectDescriptor for this dialect.

class iree.compiler.dialects.func.DialectDescriptor
property namespace

Returns the namespace of the dialect.

class iree.compiler.dialects.func.DialectRegistry(*args, **kwargs)
class iree.compiler.dialects.func.Dialects
class iree.compiler.dialects.func.DictAttr(*args, **kwargs)
attr_name = 'builtin.dictionary'
get = <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.dialects.func.F16Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f16'
property typeid

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

class iree.compiler.dialects.func.F32Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f32'
property typeid

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

class iree.compiler.dialects.func.F64Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f64'
property typeid

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

class iree.compiler.dialects.func.FlatSymbolRefAttr(*args, **kwargs)
attr_name = 'builtin.symbol_ref'
get = <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.dialects.func.Float4E2M1FNType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f4E2M1FN'
property typeid

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

class iree.compiler.dialects.func.Float6E2M3FNType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f6E2M3FN'
property typeid

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

class iree.compiler.dialects.func.Float6E3M2FNType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f6E3M2FN'
property typeid

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

class iree.compiler.dialects.func.Float8E3M4Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E3M4'
property typeid

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

class iree.compiler.dialects.func.Float8E4M3B11FNUZType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E4M3B11FNUZ'
property typeid

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

class iree.compiler.dialects.func.Float8E4M3FNType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E4M3FN'
property typeid

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

class iree.compiler.dialects.func.Float8E4M3FNUZType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E4M3FNUZ'
property typeid

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

class iree.compiler.dialects.func.Float8E4M3Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E4M3'
property typeid

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

class iree.compiler.dialects.func.Float8E5M2FNUZType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E5M2FNUZ'
property typeid

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

class iree.compiler.dialects.func.Float8E5M2Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E5M2'
property typeid

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

class iree.compiler.dialects.func.Float8E8M0FNUType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E8M0FNU'
property typeid

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

class iree.compiler.dialects.func.FloatAttr(*args, **kwargs)
attr_name = 'builtin.float'
get = <nanobind.nb_func object>
get_f32 = <nanobind.nb_func object>
get_f64 = <nanobind.nb_func object>
get_unchecked = <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.dialects.func.FloatTF32Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.tf32'
property typeid

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

class iree.compiler.dialects.func.FloatType(*args, **kwargs)
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.dialects.func.FuncOp(name, type, *, visibility=None, body_builder=None, loc=None, ip=None)

Specialization for the func op class.

add_entry_block(arg_locs: Optional[Sequence[iree.compiler._mlir_libs._mlir.ir.Location]] = 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 body
property entry_block
classmethod from_py_func(*inputs: iree.compiler._mlir_libs._mlir.ir.Type, results: Optional[Sequence[iree.compiler._mlir_libs._mlir.ir.Type]] = None, name: Optional[str] = None)

Decorator to define an MLIR FuncOp specified as a python function.

Requires that an mlir.ir.InsertionPoint and mlir.ir.Location are active for the current thread (i.e. established in a with block).

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: The func op being defined.

By default, the function name will be the Python function __name__. This can be overriden by passing the name argument to the decorator.

If results is not specified, then the decorator will implicitly insert a ReturnOp with the Value’s returned from the decorated function. It will also set the FuncOp type with the actual return value types. If results is specified, then the decorated function must return None and no implicit ReturnOp is 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 CallOp at 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).

property is_external
property name: iree.compiler._mlir_libs._mlir.ir.StringAttr

Returns the fully qualified name of the operation.

property result_attrs
property type
property visibility
class iree.compiler.dialects.func.FuncOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'func.func'
property arg_attrs: Optional[iree.compiler._mlir_libs._mlir.ir.ArrayAttr]
property function_type: iree.compiler._mlir_libs._mlir.ir.TypeAttr
property no_inline: bool
property res_attrs: Optional[iree.compiler._mlir_libs._mlir.ir.ArrayAttr]
property sym_name: iree.compiler._mlir_libs._mlir.ir.StringAttr
property sym_visibility: Optional[iree.compiler._mlir_libs._mlir.ir.StringAttr]
class iree.compiler.dialects.func.FunctionType(*args, **kwargs)
get = <nanobind.nb_func object>
property inputs

Returns the list of input types in the FunctionType.

property results

Returns the list of result types in the FunctionType.

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.function'
property typeid

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

class iree.compiler.dialects.func.IndexType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.index'
property typeid

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

class iree.compiler.dialects.func.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.dialects.func.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.dialects.func.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.dialects.func.IntegerAttr(*args, **kwargs)
attr_name = 'builtin.integer'
get = <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.dialects.func.IntegerSet
property constraints

(self) -> mlir::python::mlir::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.dialects.func.IntegerSetAttr(*args, **kwargs)
attr_name = 'builtin.integer_set'
get = <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.dialects.func.IntegerSetConstraint
property expr

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

property is_eq

(self) -> bool

class iree.compiler.dialects.func.IntegerSetConstraintList
class iree.compiler.dialects.func.IntegerType(*args, **kwargs)
SIGNED = 1
SIGNLESS = 0
enum Signedness(value)

Valid values are as follows:

SIGNLESS = Signedness.SIGNLESS
SIGNED = Signedness.SIGNED
UNSIGNED = Signedness.UNSIGNED
UNSIGNED = 2
get = <nanobind.nb_func object>
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

property signedness

(self) -> iree.compiler._mlir_libs._mlir.ir.IntegerType.Signedness

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.integer'
property typeid

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

property width

Returns the width of the integer type

class iree.compiler.dialects.func.Iterable
class iree.compiler.dialects.func.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.dialects.func.MLIRError(message, error_diagnostics)
An exception with diagnostic information. Has the following fields:

message: str error_diagnostics: List[ir.DiagnosticInfo]

class iree.compiler.dialects.func.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>
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>
type_name = 'builtin.memref'
property typeid

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

class iree.compiler.dialects.func.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.dialects.func.NamedAttribute
property attr

The underlying generic attribute of the NamedAttribute binding.

property name

The name of the NamedAttribute binding.

class iree.compiler.dialects.func.NoneType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.none'
property typeid

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

class iree.compiler.dialects.func.OpAdaptor(*args, **kwargs)
property attributes

Returns the attributes of the adaptor.

property operands

Returns the operands of the adaptor.

class iree.compiler.dialects.func.OpAttributeMap
get

Gets an attribute by name or the default value, if it does not exist.

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.dialects.func.OpOperand
property operand_number

Returns the operand number in the owning operation.

property owner

Returns the operation that owns this operand.

class iree.compiler.dialects.func.OpOperandIterator
class iree.compiler.dialects.func.OpOperandList
class iree.compiler.dialects.func.OpResult(*args, **kwargs)
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.dialects.func.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.dialects.func.OpSuccessors
class iree.compiler.dialects.func.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.dialects.func.OpaqueAttr(*args, **kwargs)
attr_name = 'builtin.opaque'
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>
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.dialects.func.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>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.opaque'
property typeid

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

class iree.compiler.dialects.func.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.dialects.func.OperationIterator
class iree.compiler.dialects.func.OperationList
class iree.compiler.dialects.func.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>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.tensor'
property typeid

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

class iree.compiler.dialects.func.Region
property blocks

Returns a forward-optimized sequence of blocks.

property owner

Returns the operation owning this region.

class iree.compiler.dialects.func.RegionIterator
class iree.compiler.dialects.func.RegionSequence
class iree.compiler.dialects.func.ReturnOp(operands_, *, loc=None, ip=None)

The func.return operation represents a return operation within a function. The operation takes variable number of operands and produces no results. The operand number and types must match the signature of the function that contains the operation.

Example:

```mlir func.func @foo() -> (i32, f8) {

… return %0, %1 : i32, f8

Adaptor

alias of iree.compiler.dialects._func_ops_gen.ReturnOpAdaptor

OPERATION_NAME = 'func.return'
property operands_: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.func.ReturnOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'func.return'
property operands_: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.func.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.

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.dialects.func.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.dialects.func.StridedLayoutAttr(*args, **kwargs)
attr_name = 'builtin.strided_layout'
get = <nanobind.nb_func object>
get_fully_dynamic = <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.dialects.func.StringAttr(*args, **kwargs)
attr_name = 'builtin.string'
get = <nanobind.nb_func object>
get_typed = <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.dialects.func.SymbolRefAttr(*args, **kwargs)
attr_name = 'builtin.symbol_ref'
get = <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.dialects.func.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.dialects.func.ThreadPool(*args, **kwargs)
get_max_concurrency

Returns the maximum number of threads in the pool.

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

Returns the pos-th type in the tuple type.

property num_types

Returns the number of types contained in a tuple.

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.tuple'
property typeid

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

class iree.compiler.dialects.func.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.dialects.func.TypeAttr(*args, **kwargs)
attr_name = 'builtin.type'
get = <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.dialects.func.TypeID
class iree.compiler.dialects.func.UnitAttr(*args, **kwargs)
attr_name = 'builtin.unit'
get = <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.dialects.func.UnrankedMemRefType(*args, **kwargs)
get = <nanobind.nb_func object>
get_unchecked = <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>
type_name = 'builtin.unranked_memref'
property typeid

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

class iree.compiler.dialects.func.UnrankedTensorType(*args, **kwargs)
get = <nanobind.nb_func object>
get_unchecked = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.unranked_tensor'
property typeid

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

class iree.compiler.dialects.func.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.dialects.func.VectorType(*args, **kwargs)
get = <nanobind.nb_func object>
get_unchecked = <nanobind.nb_func object>
property scalable

(self) -> bool

property scalable_dims

(self) -> list[bool]

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.vector'
property typeid

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

enum iree.compiler.dialects.func.WalkOrder(value)

Valid values are as follows:

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

Valid values are as follows:

ADVANCE = WalkResult.ADVANCE
INTERRUPT = WalkResult.INTERRUPT
SKIP = WalkResult.SKIP
iree.compiler.dialects.func.append_load_on_create_dialect(dialect: str)
iree.compiler.dialects.func.call(result, callee, operands_, *, arg_attrs=None, res_attrs=None, no_inline=None, loc=None, ip=None) Union[iree.compiler._mlir_libs._mlir.ir.OpResult, iree.compiler._mlir_libs._mlir.ir.OpResultList, iree.compiler.dialects._func_ops_gen.CallOp]
iree.compiler.dialects.func.call_indirect(results_, callee, callee_operands, *, arg_attrs=None, res_attrs=None, loc=None, ip=None) Union[iree.compiler._mlir_libs._mlir.ir.OpResult, iree.compiler._mlir_libs._mlir.ir.OpResultList, iree.compiler.dialects._func_ops_gen.CallIndirectOp]
iree.compiler.dialects.func.constant(result, value, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.func.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.dialects.func.func(*inputs: iree.compiler._mlir_libs._mlir.ir.Type, results: Optional[Sequence[iree.compiler._mlir_libs._mlir.ir.Type]] = None, name: Optional[str] = None)

Decorator to define an MLIR FuncOp specified as a python function.

Requires that an mlir.ir.InsertionPoint and mlir.ir.Location are active for the current thread (i.e. established in a with block).

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: The func op being defined.

By default, the function name will be the Python function __name__. This can be overriden by passing the name argument to the decorator.

If results is not specified, then the decorator will implicitly insert a ReturnOp with the Value’s returned from the decorated function. It will also set the FuncOp type with the actual return value types. If results is specified, then the decorated function must return None and no implicit ReturnOp is 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 CallOp at 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).

iree.compiler.dialects.func.get_dialect_registry()
iree.compiler.dialects.func.get_load_on_create_dialects()
iree.compiler.dialects.func.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.dialects.func.register_attribute_builder(kind, replace=False)
iree.compiler.dialects.func.return_(operands_, *, loc=None, ip=None) iree.compiler.dialects._func_ops_gen.ReturnOp

linalg dialect

math dialect

class iree.compiler.dialects.math.AbsFOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

The absf operation computes the absolute value. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type.

Example:

`mlir // Scalar absolute value. %a = math.absf %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.AbsFOpAdaptor

OPERATION_NAME = 'math.absf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.AbsFOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.absf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.AbsIOp(operand, *, results=None, loc=None, ip=None)

The absi operation computes the absolute value. It takes one operand of integer type (i.e., scalar, tensor or vector) and returns one result of the same type.

Example:

`mlir // Scalar absolute value. %a = math.absi %b : i64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.AbsIOpAdaptor

OPERATION_NAME = 'math.absi'
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.AbsIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.absi'
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.AcosOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

The acos operation computes the arcus cosine of a given value. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. It has no standard attributes.

Example:

`mlir // Scalar arcus cosine value. %a = math.acos %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.AcosOpAdaptor

OPERATION_NAME = 'math.acos'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.AcosOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.acos'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.AcoshOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

Syntax:

` operation ::= ssa-id `=` `math.acosh` ssa-use `:` type `

The acosh operation computes the arcus cosine of a given value. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. It has no standard attributes.

Example:

`mlir // Hyperbolic arcus cosine of scalar value. %a = math.acosh %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.AcoshOpAdaptor

OPERATION_NAME = 'math.acosh'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.AcoshOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.acosh'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.AsinOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

Syntax:

` operation ::= ssa-id `=` `math.asin` ssa-use `:` type `

The asin operation computes the arcus sine of a given value. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. It has no standard attributes.

Example:

`mlir // Arcus sine of scalar value. %a = math.asin %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.AsinOpAdaptor

OPERATION_NAME = 'math.asin'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.AsinOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.asin'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.AsinhOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

Syntax:

` operation ::= ssa-id `=` `math.asinh` ssa-use `:` type `

The asinh operation computes the hyperbolic arcus sine of a given value. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. It has no standard attributes.

Example:

`mlir // Hyperbolic arcus sine of scalar value. %a = math.asinh %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.AsinhOpAdaptor

OPERATION_NAME = 'math.asinh'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.AsinhOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.asinh'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.Atan2Op(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None)

The atan2 operation takes two operands and returns one result, all of which must be of the same type. The operands must be of floating point type (i.e., scalar, tensor or vector).

The 2-argument arcus tangent atan2(y, x) returns the angle in the Euclidian plane between the positive x-axis and the ray through the point (x, y). It is a generalization of the 1-argument arcus tangent which returns the angle on the basis of the ratio y/x.

See also https://en.wikipedia.org/wiki/Atan2

Example:

`mlir // Scalar variant. %a = math.atan2 %b, %c : f32 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.Atan2OpAdaptor

OPERATION_NAME = 'math.atan2'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.Atan2OpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.atan2'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.AtanOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

The atan operation computes the arcus tangent of a given value. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. It has no standard attributes.

Example:

`mlir // Arcus tangent of scalar value. %a = math.atan %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.AtanOpAdaptor

OPERATION_NAME = 'math.atan'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.AtanOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.atan'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.AtanhOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

Syntax:

` operation ::= ssa-id `=` `math.atanh` ssa-use `:` type `

The atanh operation computes the hyperbolic arcus tangent of a given value. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. It has no standard attributes.

Example:

`mlir // Hyperbolic arcus tangent of scalar value. %a = math.atanh %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.AtanhOpAdaptor

OPERATION_NAME = 'math.atanh'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.AtanhOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.atanh'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.CbrtOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

The cbrt operation computes the cube root. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. It has no standard attributes.

Example:

`mlir // Scalar cube root value. %a = math.cbrt %b : f64 `

Note: This op is not equivalent to powf(…, 1/3.0).

Adaptor

alias of iree.compiler.dialects._math_ops_gen.CbrtOpAdaptor

OPERATION_NAME = 'math.cbrt'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.CbrtOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.cbrt'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.CeilOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

The ceil operation computes the ceiling of a given value. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. It has no standard attributes.

Example:

`mlir // Scalar ceiling value. %a = math.ceil %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.CeilOpAdaptor

OPERATION_NAME = 'math.ceil'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.CeilOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.ceil'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.ClampFOp(value, min, max, *, fastmath=None, results=None, loc=None, ip=None)

The clampf operation takes three operands and returns one result, each of these is required to be the same type. Operands must be of floating point type (i.e., scalar, tensor or vector).

The semantics of the operation are described by: ```

clampf(value, min, max) = maxf(minf(value, max), min)

``` If min > max the resulting value is poison.

Example:

`mlir %d = math.clampf %value to [%min, %max] : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.ClampFOpAdaptor

OPERATION_NAME = 'math.clampf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property max: iree.compiler._mlir_libs._mlir.ir.Value
property min: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property value: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.ClampFOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.clampf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property max: iree.compiler._mlir_libs._mlir.ir.Value
property min: iree.compiler._mlir_libs._mlir.ir.Value
property value: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.CopySignOp(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None)

The copysign returns a value with the magnitude of the first operand and the sign of the second operand. It takes two operands and returns one result of the same type. The operands must be of floating point type (i.e., scalar, tensor or vector). It has no standard attributes.

Example:

`mlir // Scalar copysign value. %a = math.copysign %b, %c : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.CopySignOpAdaptor

OPERATION_NAME = 'math.copysign'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.CopySignOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.copysign'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.CosOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

The cos operation computes the cosine of a given value. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. It has no standard attributes.

Example:

`mlir // Scalar cosine value. %a = math.cos %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.CosOpAdaptor

OPERATION_NAME = 'math.cos'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.CosOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.cos'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.CoshOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

The cosh operation computes the hyperbolic cosine. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. It has no standard attributes.

Example:

`mlir // Scalar hyperbolic cosine value. %a = math.cosh %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.CoshOpAdaptor

OPERATION_NAME = 'math.cosh'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.CoshOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.cosh'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.CountLeadingZerosOp(operand, *, results=None, loc=None, ip=None)

The ctlz operation computes the number of leading zeros of an integer value. It operates on scalar, tensor or vector.

Example:

`mlir // Scalar ctlz function value. %a = math.ctlz %b : i32 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.CountLeadingZerosOpAdaptor

OPERATION_NAME = 'math.ctlz'
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.CountLeadingZerosOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.ctlz'
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.CountTrailingZerosOp(operand, *, results=None, loc=None, ip=None)

The cttz operation computes the number of trailing zeros of an integer value. It operates on scalar, tensor or vector.

Example:

`mlir // Scalar cttz function value. %a = math.cttz %b : i32 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.CountTrailingZerosOpAdaptor

OPERATION_NAME = 'math.cttz'
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.CountTrailingZerosOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.cttz'
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.CtPopOp(operand, *, results=None, loc=None, ip=None)

The ctpop operation computes the number of set bits of an integer value. It operates on scalar, tensor or vector.

Example:

`mlir // Scalar ctpop function value. %a = math.ctpop %b : i32 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.CtPopOpAdaptor

OPERATION_NAME = 'math.ctpop'
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.CtPopOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.ctpop'
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.ErfOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

The erf operation computes the error function. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. It has no standard attributes.

Example:

`mlir // Scalar error function value. %a = math.erf %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.ErfOpAdaptor

OPERATION_NAME = 'math.erf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.ErfOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.erf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.ErfcOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

The erfc operation computes the complementary error function, defined as 1-erf(x). This function is part of libm and is needed for accuracy, since simply calculating 1-erf(x) when x is close to 1 will give inaccurate results. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. It has no standard attributes.

Example:

`mlir // Scalar error function value. %a = math.erfc %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.ErfcOpAdaptor

OPERATION_NAME = 'math.erfc'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.ErfcOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.erfc'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.Exp2Op(operand, *, fastmath=None, results=None, loc=None, ip=None)

The exp operation takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. It has no standard attributes.

Example:

`mlir // Scalar natural exponential. %a = math.exp2 %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.Exp2OpAdaptor

OPERATION_NAME = 'math.exp2'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.Exp2OpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.exp2'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.ExpM1Op(operand, *, fastmath=None, results=None, loc=None, ip=None)

expm1(x) := exp(x) - 1

The expm1 operation takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. It has no standard attributes.

Example:

`mlir // Scalar natural exponential minus 1. %a = math.expm1 %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.ExpM1OpAdaptor

OPERATION_NAME = 'math.expm1'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.ExpM1OpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.expm1'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.ExpOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

The exp operation takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. It has no standard attributes.

Example:

`mlir // Scalar natural exponential. %a = math.exp %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.ExpOpAdaptor

OPERATION_NAME = 'math.exp'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.ExpOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.exp'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.FPowIOp(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None)

The fpowi operation takes a base operand of floating point type (i.e. scalar, tensor or vector) and a power operand of integer type (also scalar, tensor or vector) and returns one result of the same type as base. The result is base raised to the power of power. The operation is elementwise for non-scalars, e.g.:

`mlir %v = math.fpowi %base, %power : vector<2xf32>, vector<2xi32 `

The result is a vector of:

` [<math.fpowi %base[0], %power[0]>, <math.fpowi %base[1], %power[1]>] `

Example:

`mlir // Scalar exponentiation. %a = math.fpowi %base, %power : f64, i32 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.FPowIOpAdaptor

OPERATION_NAME = 'math.fpowi'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.FPowIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.fpowi'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.FloorOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

The floor operation computes the floor of a given value. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. It has no standard attributes.

Example:

`mlir // Scalar floor value. %a = math.floor %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.FloorOpAdaptor

OPERATION_NAME = 'math.floor'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.FloorOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.floor'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.FmaOp(a, b, c, *, fastmath=None, results=None, loc=None, ip=None)

The fma operation takes three operands and returns one result, each of these is required to be the same type. Operands must be of floating point type (i.e., scalar, tensor or vector).

Example:

`mlir // Scalar fused multiply-add: d = a*b + c %d = math.fma %a, %b, %c : f64 `

The semantics of the operation correspond to those of the llvm.fma [intrinsic](https://llvm.org/docs/LangRef.html#llvm-fma-intrinsic). In the particular case of lowering to LLVM, this is guaranteed to lower to the llvm.fma.* intrinsic.

Adaptor

alias of iree.compiler.dialects._math_ops_gen.FmaOpAdaptor

OPERATION_NAME = 'math.fma'
property a: iree.compiler._mlir_libs._mlir.ir.Value
property b: iree.compiler._mlir_libs._mlir.ir.Value
property c: iree.compiler._mlir_libs._mlir.ir.Value
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.FmaOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.fma'
property a: iree.compiler._mlir_libs._mlir.ir.Value
property b: iree.compiler._mlir_libs._mlir.ir.Value
property c: iree.compiler._mlir_libs._mlir.ir.Value
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.math.IPowIOp(lhs, rhs, *, results=None, loc=None, ip=None)

The ipowi operation takes two operands of integer type (i.e., scalar, tensor or vector) and returns one result of the same type. Operands must have the same type.

Example:

`mlir // Scalar signed integer exponentiation. %a = math.ipowi %b, %c : i32 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.IPowIOpAdaptor

OPERATION_NAME = 'math.ipowi'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.IPowIOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.ipowi'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.IsFiniteOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

Determines if the given floating-point number has finite value i.e. it is normal, subnormal or zero, but not infinite or NaN.

Example:

`mlir %f = math.isfinite %a : f32 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.IsFiniteOpAdaptor

OPERATION_NAME = 'math.isfinite'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.IsFiniteOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.isfinite'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.IsInfOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

Determines if the given floating-point number is positive or negative infinity.

Example:

`mlir %f = math.isinf %a : f32 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.IsInfOpAdaptor

OPERATION_NAME = 'math.isinf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.IsInfOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.isinf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.IsNaNOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

Determines if the given floating-point number is a not-a-number (NaN) value.

Example:

`mlir %f = math.isnan %a : f32 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.IsNaNOpAdaptor

OPERATION_NAME = 'math.isnan'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.IsNaNOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.isnan'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.IsNormalOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

Determines if the given floating-point number is normal, i.e. is neither zero, subnormal, infinite, nor NaN.

Example:

`mlir %f = math.isnormal %a : f32 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.IsNormalOpAdaptor

OPERATION_NAME = 'math.isnormal'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.IsNormalOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.isnormal'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.Log10Op(operand, *, fastmath=None, results=None, loc=None, ip=None)

Computes the base-10 logarithm of the given value. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type.

Example:

`mlir // Scalar log10 operation. %y = math.log10 %x : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.Log10OpAdaptor

OPERATION_NAME = 'math.log10'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.Log10OpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.log10'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.Log1pOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

Computes the base-e logarithm of one plus the given value. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type.

log1p(x) := log(1 + x)

Example:

`mlir // Scalar log1p operation. %y = math.log1p %x : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.Log1pOpAdaptor

OPERATION_NAME = 'math.log1p'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.Log1pOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.log1p'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.Log2Op(operand, *, fastmath=None, results=None, loc=None, ip=None)

Computes the base-2 logarithm of the given value. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type.

Example:

`mlir // Scalar log2 operation. %y = math.log2 %x : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.Log2OpAdaptor

OPERATION_NAME = 'math.log2'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.Log2OpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.log2'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.LogOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

Computes the base-e logarithm of the given value. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type.

Example:

`mlir // Scalar log operation. %y = math.log %x : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.LogOpAdaptor

OPERATION_NAME = 'math.log'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.LogOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.log'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.PowFOp(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None)

The powf operation takes two operands of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. Operands must have the same type.

Example:

`mlir // Scalar exponentiation. %a = math.powf %b, %c : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.PowFOpAdaptor

OPERATION_NAME = 'math.powf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.PowFOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.powf'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.RoundEvenOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

The roundeven operation returns the operand rounded to the nearest integer value in floating-point format. It takes one operand of floating point type (i.e., scalar, tensor or vector) and produces one result of the same type. The operation rounds the argument to the nearest integer value in floating-point format, rounding halfway cases to even, regardless of the current rounding direction.

Example:

`mlir // Scalar round operation. %a = math.roundeven %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.RoundEvenOpAdaptor

OPERATION_NAME = 'math.roundeven'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.RoundEvenOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.roundeven'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.RoundOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

The round operation returns the operand rounded to the nearest integer value in floating-point format. It takes one operand of floating point type (i.e., scalar, tensor or vector) and produces one result of the same type. The operation rounds the argument to the nearest integer value in floating-point format, rounding halfway cases away from zero, regardless of the current rounding direction.

Example:

`mlir // Scalar round operation. %a = math.round %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.RoundOpAdaptor

OPERATION_NAME = 'math.round'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.RoundOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.round'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.RsqrtOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

The rsqrt operation computes the reciprocal of the square root. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. It has no standard attributes.

Example:

`mlir // Scalar reciprocal square root value. %a = math.rsqrt %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.RsqrtOpAdaptor

OPERATION_NAME = 'math.rsqrt'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.RsqrtOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.rsqrt'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.SinOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

The sin operation computes the sine of a given value. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. It has no standard attributes.

Example:

`mlir // Scalar sine value. %a = math.sin %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.SinOpAdaptor

OPERATION_NAME = 'math.sin'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.SinOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.sin'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.SincosOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

The sincos operation computes both the sine and cosine of a given value simultaneously. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns two results of the same type. This operation can be more efficient than computing sine and cosine separately when both values are needed.

Example:

`mlir // Scalar sine and cosine values. %sin, %cos = math.sincos %input : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.SincosOpAdaptor

OPERATION_NAME = 'math.sincos'
property cos: iree.compiler._mlir_libs._mlir.ir.OpResult
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property sin: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.math.SincosOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.sincos'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.SinhOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

The sinh operation computes the hyperbolic sine. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. It has no standard attributes.

Example:

`mlir // Scalar hyperbolic sine value. %a = math.sinh %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.SinhOpAdaptor

OPERATION_NAME = 'math.sinh'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.SinhOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.sinh'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.SqrtOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

The sqrt operation computes the square root. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. It has no standard attributes.

Example:

`mlir // Scalar square root value. %a = math.sqrt %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.SqrtOpAdaptor

OPERATION_NAME = 'math.sqrt'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.SqrtOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.sqrt'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.TanOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

The tan operation computes the tangent. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. It has no standard attributes.

Example:

`mlir // Scalar tangent value. %a = math.tan %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.TanOpAdaptor

OPERATION_NAME = 'math.tan'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.TanOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.tan'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.TanhOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

The tanh operation computes the hyperbolic tangent. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. It has no standard attributes.

Example:

`mlir // Scalar hyperbolic tangent value. %a = math.tanh %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.TanhOpAdaptor

OPERATION_NAME = 'math.tanh'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.TanhOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.tanh'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.math.TruncOp(operand, *, fastmath=None, results=None, loc=None, ip=None)

The trunc operation returns the operand rounded to the nearest integer value in floating-point format. It takes one operand of floating point type (i.e., scalar, tensor or vector) and produces one result of the same type. The operation always rounds to the nearest integer not larger in magnitude than the operand, regardless of the current rounding direction.

Example:

`mlir // Scalar trunc operation. %a = math.trunc %b : f64 `

Adaptor

alias of iree.compiler.dialects._math_ops_gen.TruncOpAdaptor

OPERATION_NAME = 'math.trunc'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.math.TruncOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'math.trunc'
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property operand: iree.compiler._mlir_libs._mlir.ir.Value
iree.compiler.dialects.math.absf(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.absi(operand, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.acos(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.acosh(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.asin(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.asinh(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.atan(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.atan2(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.atanh(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.cbrt(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.ceil(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.clampf(value, min, max, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.copysign(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.cos(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.cosh(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.ctlz(operand, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.ctpop(operand, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.cttz(operand, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.erf(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.erfc(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.exp(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.exp2(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.expm1(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.floor(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.fma(a, b, c, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.fpowi(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.ipowi(lhs, rhs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.isfinite(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.isinf(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.isnan(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.isnormal(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.log(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.log10(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.log1p(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.log2(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.powf(lhs, rhs, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.round(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.roundeven(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.rsqrt(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.sin(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.sincos(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResultList
iree.compiler.dialects.math.sinh(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.sqrt(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.tan(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.tanh(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.math.trunc(operand, *, fastmath=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult

memref dialect

class iree.compiler.dialects.memref.AllocOp(memref, dynamicSizes, symbolOperands, *, alignment=None, loc=None, ip=None)

The alloc operation allocates a region of memory, as specified by its memref type.

Example:

`mlir %0 = memref.alloc() : memref<8x64xf32, 1> `

The optional list of dimension operands are bound to the dynamic dimensions specified in its memref type. In the example below, the ssa value ‘%d’ is bound to the second dimension of the memref (which is dynamic).

`mlir %0 = memref.alloc(%d) : memref<8x?xf32, 1> `

The optional list of symbol operands are bound to the symbols of the memrefs affine map. In the example below, the ssa value ‘%s’ is bound to the symbol ‘s0’ in the affine map specified in the allocs memref type.

```mlir %0 = memref.alloc()[%s] : memref<8x64xf32,

affine_map<(d0, d1)[s0] -> ((d0 + s0), d1)>, 1>

```

This operation returns a single ssa value of memref type, which can be used by subsequent load and store operations.

The optional alignment attribute may be specified to ensure that the region of memory that will be indexed is aligned at the specified byte boundary.

```mlir %0 = memref.alloc()[%s] {alignment = 8} :

memref<8x64xf32, affine_map<(d0, d1)[s0] -> ((d0 + s0), d1)>, 1>

```

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.AllocOpAdaptor

OPERATION_NAME = 'memref.alloc'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property dynamicSizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property memref: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property symbolOperands: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.memref.AllocOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.alloc'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property dynamicSizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property symbolOperands: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.memref.AllocaOp(memref, dynamicSizes, symbolOperands, *, alignment=None, loc=None, ip=None)

The alloca operation allocates memory on the stack, to be automatically released when control transfers back from the region of its closest surrounding operation with an [AutomaticAllocationScope](../Traits/#automaticallocationscope) trait. The amount of memory allocated is specified by its memref and additional operands. For example:

`mlir %0 = memref.alloca() : memref<8x64xf32> `

The optional list of dimension operands are bound to the dynamic dimensions specified in its memref type. In the example below, the SSA value ‘%d’ is bound to the second dimension of the memref (which is dynamic).

`mlir %0 = memref.alloca(%d) : memref<8x?xf32> `

The optional list of symbol operands are bound to the symbols of the memref’s affine map. In the example below, the SSA value ‘%s’ is bound to the symbol ‘s0’ in the affine map specified in the allocs memref type.

```mlir %0 = memref.alloca()[%s] : memref<8x64xf32,

affine_map<(d0, d1)[s0] -> ((d0 + s0), d1)>>

```

This operation returns a single SSA value of memref type, which can be used by subsequent load and store operations. An optional alignment attribute, if specified, guarantees alignment at least to that boundary. If not specified, an alignment on any convenient boundary compatible with the type will be chosen.

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.AllocaOpAdaptor

OPERATION_NAME = 'memref.alloca'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property dynamicSizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property memref: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property symbolOperands: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.memref.AllocaOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.alloca'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property dynamicSizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property symbolOperands: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.memref.AllocaScopeOp(results_, *, loc=None, ip=None)

The memref.alloca_scope operation represents an explicitly-delimited scope for the alloca allocations. Any memref.alloca operations that are used within this scope are going to be cleaned up automatically once the control-flow exits the nested region. For example:

```mlir memref.alloca_scope {

%myalloca = memref.alloca(): memref<4x3xf32> …

Here, %myalloca memref is valid within the explicitly delimited scope and is automatically deallocated at the end of the given region. Conceptually, memref.alloca_scope is a passthrough operation with AutomaticAllocationScope that spans the body of the region within the operation.

memref.alloca_scope may also return results that are defined in the nested region. To return a value, one should use memref.alloca_scope.return operation:

```mlir %result = memref.alloca_scope -> f32 {

%value = arith.constant 1.0 : f32 … memref.alloca_scope.return %value : f32

If memref.alloca_scope returns no value, the `memref.alloca_scope.return ` can be left out, and will be inserted implicitly.

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.AllocaScopeOpAdaptor

OPERATION_NAME = 'memref.alloca_scope'
property bodyRegion: iree.compiler._mlir_libs._mlir.ir.Region
property results_: iree.compiler._mlir_libs._mlir.ir.OpResultList
class iree.compiler.dialects.memref.AllocaScopeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.alloca_scope'
class iree.compiler.dialects.memref.AllocaScopeReturnOp(results_, *, loc=None, ip=None)

memref.alloca_scope.return operation returns zero or more SSA values from the region within memref.alloca_scope. If no values are returned, the return operation may be omitted. Otherwise, it has to be present to indicate which values are going to be returned. For example:

`mlir memref.alloca_scope.return %value : f32 `

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.AllocaScopeReturnOpAdaptor

OPERATION_NAME = 'memref.alloca_scope.return'
property results_: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.memref.AllocaScopeReturnOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.alloca_scope.return'
property results_: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.memref.AssumeAlignmentOp(memref, alignment, *, results=None, loc=None, ip=None)

The assume_alignment operation takes a memref and an integer alignment value. It returns a new SSA value of the same memref type, but associated with the assumption that the underlying buffer is aligned to the given alignment.

If the buffer isn’t aligned to the given alignment, its result is poison. This operation doesn’t affect the semantics of a program where the alignment assumption holds true. It is intended for optimization purposes, allowing the compiler to generate more efficient code based on the alignment assumption. The optimization is best-effort.

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.AssumeAlignmentOpAdaptor

OPERATION_NAME = 'memref.assume_alignment'
property alignment: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.MemRefType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.memref.AssumeAlignmentOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.assume_alignment'
property alignment: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
class iree.compiler.dialects.memref.AtomicRMWOp(kind, value, memref, indices, *, results=None, loc=None, ip=None)

The memref.atomic_rmw operation provides a way to perform a read-modify-write sequence that is free from data races. The kind enumeration specifies the modification to perform. The value operand represents the new value to be applied during the modification. The memref operand represents the buffer that the read and write will be performed against, as accessed by the specified indices. The arity of the indices is the rank of the memref. The result represents the latest value that was stored.

Example:

`mlir %x = memref.atomic_rmw "addf" %value, %I[%i] : (f32, memref<10xf32>) -> f32 `

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.AtomicRMWOpAdaptor

OPERATION_NAME = 'memref.atomic_rmw'
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property kind: iree.compiler._mlir_libs._mlir.ir.Attribute
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property value: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.memref.AtomicRMWOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.atomic_rmw'
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property kind: iree.compiler._mlir_libs._mlir.ir.Attribute
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property value: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.memref.AtomicYieldOp(result, *, loc=None, ip=None)

“memref.atomic_yield” yields an SSA value from a GenericAtomicRMWOp region.

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.AtomicYieldOpAdaptor

OPERATION_NAME = 'memref.atomic_yield'
property result: iree.compiler._mlir_libs._mlir.ir.Value

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.memref.AtomicYieldOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.atomic_yield'
property result: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.memref.CastOp(dest, source, *, loc=None, ip=None)

The memref.cast operation converts a memref from one type to an equivalent type with a compatible shape. The source and destination types are compatible if:

a. Both are ranked memref types with the same element type, address space, and rank and:

  1. Both have the same layout or both have compatible strided layouts.

  2. The individual sizes (resp. offset and strides in the case of strided memrefs) may convert constant dimensions to dynamic dimensions and vice-versa.

If the cast converts any dimensions from an unknown to a known size, then it acts as an assertion that fails at runtime if the dynamic dimensions disagree with resultant destination size.

Example:

```mlir // Assert that the input dynamic shape matches the destination static shape. %2 = memref.cast %1 : memref<?x?xf32> to memref<4x4xf32> // Erase static shape information, replacing it with dynamic information. %3 = memref.cast %1 : memref<4xf32> to memref<?xf32>

// The same holds true for offsets and strides.

// Assert that the input dynamic shape matches the destination static stride. %4 = memref.cast %1 : memref<12x4xf32, strided<[?, ?], offset: ?>> to

memref<12x4xf32, strided<[4, 1], offset: 5>>

// Erase static offset and stride information, replacing it with // dynamic information. %5 = memref.cast %1 : memref<12x4xf32, strided<[4, 1], offset: 5>> to

memref<12x4xf32, strided<[?, ?], offset: ?>>

```

b. Either or both memref types are unranked with the same element type, and address space.

Example:

```mlir // Cast to concrete shape. %4 = memref.cast %1 : memref<*xf32> to memref<4x?xf32>

// Erase rank information. %5 = memref.cast %1 : memref<4x?xf32> to memref<*xf32> ```

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.CastOpAdaptor

OPERATION_NAME = 'memref.cast'
property dest: iree.compiler._mlir_libs._mlir.ir.OpResult
property source: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.memref.CastOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.cast'
property source: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.memref.CollapseShapeOp(result, src, reassociation, *, loc=None, ip=None)

The memref.collapse_shape op produces a new view with a smaller rank whose sizes are a reassociation of the original view. The operation is limited to such reassociations, where subsequent, contiguous dimensions are collapsed into a single dimension. Such reassociations never require additional allocs or copies.

Collapsing non-contiguous dimensions is undefined behavior. When a group of dimensions can be statically proven to be non-contiguous, collapses of such groups are rejected in the verifier on a best-effort basis. In the general case, collapses of dynamically-sized dims with dynamic strides cannot be proven to be contiguous or non-contiguous due to limitations in the memref type.

A reassociation is defined as a continuous grouping of dimensions and is represented with an array of DenseI64ArrayAttr attribute.

Note: Only the dimensions within a reassociation group must be contiguous. The remaining dimensions may be non-contiguous.

The result memref type can be zero-ranked if the source memref type is statically shaped with all dimensions being unit extent. In such a case, the reassociation indices must be empty.

Examples:

```mlir // Dimension collapse (i, j) -> i’ and k -> k’ %1 = memref.collapse_shape %0 [[0, 1], [2]] :

memref<?x?x?xf32, stride_spec> into memref<?x?xf32, stride_spec_2>

```

For simplicity, this op may not be used to cast dynamicity of dimension sizes and/or strides. I.e., a result dimension must be dynamic if and only if at least one dimension in the corresponding reassociation group is dynamic. Similarly, the stride of a result dimension must be dynamic if and only if the corresponding start dimension in the source type is dynamic.

Note: This op currently assumes that the inner strides are of the source/result layout map are the faster-varying ones.

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.CollapseShapeOpAdaptor

OPERATION_NAME = 'memref.collapse_shape'
property reassociation: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.MemRefType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property src: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
class iree.compiler.dialects.memref.CollapseShapeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.collapse_shape'
property reassociation: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property src: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
class iree.compiler.dialects.memref.CopyOp(source, target, *, loc=None, ip=None)

Copies the data from the source to the destination memref.

Usage:

`mlir memref.copy %arg0, %arg1 : memref<?xf32> to memref<?xf32> `

Source and destination are expected to have the same element type and shape. Otherwise, the result is undefined. They may have different layouts.

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.CopyOpAdaptor

OPERATION_NAME = 'memref.copy'
property source: iree.compiler._mlir_libs._mlir.ir.Value
property target: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.memref.CopyOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.copy'
property source: iree.compiler._mlir_libs._mlir.ir.Value
property target: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.memref.DeallocOp(memref, *, loc=None, ip=None)

The dealloc operation frees the region of memory referenced by a memref which was originally created by the alloc operation. The dealloc operation should not be called on memrefs which alias an alloc’d memref (e.g. memrefs returned by view operations).

Example:

`mlir %0 = memref.alloc() : memref<8x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1> memref.dealloc %0 : memref<8x64xf32,  affine_map<(d0, d1) -> (d0, d1)>, 1> `

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.DeallocOpAdaptor

OPERATION_NAME = 'memref.dealloc'
property memref: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.memref.DeallocOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.dealloc'
property memref: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.memref.DimOp(source, index, *, results=None, loc=None, ip=None)

The dim operation takes a memref and a dimension operand of type index. It returns the size of the requested dimension of the given memref. If the dimension index is out of bounds the behavior is undefined.

The specified memref type is that of the first operand.

Example:

```mlir // Always returns 4, can be constant folded: %c0 = arith.constant 0 : index %x = memref.dim %A, %c0 : memref<4 x ? x f32>

// Returns the dynamic dimension of %A. %c1 = arith.constant 1 : index %y = memref.dim %A, %c1 : memref<4 x ? x f32>

// Equivalent generic form: %x = “memref.dim”(%A, %c0) : (memref<4 x ? x f32>, index) -> index %y = “memref.dim”(%A, %c1) : (memref<4 x ? x f32>, index) -> index ```

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.DimOpAdaptor

OPERATION_NAME = 'memref.dim'
property index: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IndexType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.IndexType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property source: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.memref.DimOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.dim'
property index: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IndexType]
property source: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.memref.DistinctObjectsOp(operands_, *, results=None, loc=None, ip=None)

The distinct_objects operation takes a list of memrefs and returns the same memrefs, with the additional assumption that accesses to them will never alias with each other. This means that loads and stores to different memrefs in the list can be safely reordered.

If the memrefs do alias, the load/store behavior is undefined. This operation doesn’t affect the semantics of a valid program. It is intended for optimization purposes, allowing the compiler to generate more efficient code based on the non-aliasing assumption. The optimization is best-effort.

Example:

`mlir %1, %2 = memref.distinct_objects %a, %b : memref<?xf32>, memref<?xf32> `

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.DistinctObjectsOpAdaptor

OPERATION_NAME = 'memref.distinct_objects'
property operands_: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property results_: iree.compiler._mlir_libs._mlir.ir.OpResultList
class iree.compiler.dialects.memref.DistinctObjectsOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.distinct_objects'
property operands_: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.memref.DmaStartOp(operands_, *, loc=None, ip=None)

Syntax:

``` operation ::= memref.dma_start ssa-use`[ssa-use-list]` ,

ssa-use`[ssa-use-list]` , ssa-use , ssa-use`[ssa-use-list]` (, ssa-use , ssa-use)?

: memref-type , memref-type , memref-type

```

DmaStartOp starts a non-blocking DMA operation that transfers data from a source memref to a destination memref. The source and destination memref need not be of the same dimensionality, but need to have the same elemental type. The operands include the source and destination memref’s each followed by its indices, size of the data transfer in terms of the number of elements (of the elemental type of the memref), a tag memref with its indices, and optionally at the end, a stride and a number_of_elements_per_stride arguments. The tag location is used by a DmaWaitOp to check for completion. The indices of the source memref, destination memref, and the tag memref have the same restrictions as any load/store. The optional stride arguments should be of ‘index’ type, and specify a stride for the slower memory space (memory space with a lower memory space id), transferring chunks of number_of_elements_per_stride every stride until %num_elements are transferred. Either both or no stride arguments should be specified. If the source and destination locations overlap the behavior of this operation is not defined.

For example, a DmaStartOp operation that transfers 256 elements of a memref ‘%src’ in memory space 0 at indices [%i, %j] to memref ‘%dst’ in memory space 1 at indices [%k, %l], would be specified as follows:

```mlir %num_elements = arith.constant 256 : index %idx = arith.constant 0 : index %tag = memref.alloc() : memref<1 x i32, affine_map<(d0) -> (d0)>, 2> memref.dma_start %src[%i, %j], %dst[%k, %l], %num_elements, %tag[%idx] :

memref<40 x 128 x f32, affine_map<(d0, d1) -> (d0, d1)>, 0>, memref<2 x 1024 x f32, affine_map<(d0, d1) -> (d0, d1)>, 1>, memref<1 x i32, affine_map<(d0) -> (d0)>, 2>

```

If %stride and %num_elt_per_stride are specified, the DMA is expected to transfer %num_elt_per_stride elements every %stride elements apart from memory space 0 until %num_elements are transferred.

```mlir memref.dma_start %src[%i, %j], %dst[%k, %l], %num_elements, %tag[%idx], %stride,

%num_elt_per_stride :

```

  • TODO: add additional operands to allow source and destination striding, and

multiple stride levels. * TODO: Consider replacing src/dst memref indices with view memrefs.

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.DmaStartOpAdaptor

OPERATION_NAME = 'memref.dma_start'
property operands_: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.memref.DmaStartOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.dma_start'
property operands_: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.memref.DmaWaitOp(tagMemRef, tagIndices, numElements, *, loc=None, ip=None)

DmaWaitOp blocks until the completion of a DMA operation associated with the tag element ‘%tag[%index]’. %tag is a memref, and %index has to be an index with the same restrictions as any load/store index. %num_elements is the number of elements associated with the DMA operation.

Example:

```mlir
memref.dma_start %src[%i, %j], %dst[%k, %l], %num_elements, %tag[%index] :

memref<2048 x f32, affine_map<(d0) -> (d0)>, 0>, memref<256 x f32, affine_map<(d0) -> (d0)>, 1>, memref<1 x i32, affine_map<(d0) -> (d0)>, 2>

dma_wait %tag[%index], %num_elements : memref<1 x i32, affine_map<(d0) -> (d0)>, 2> ```

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.DmaWaitOpAdaptor

OPERATION_NAME = 'memref.dma_wait'
property numElements: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IndexType]
property tagIndices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property tagMemRef: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
class iree.compiler.dialects.memref.DmaWaitOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.dma_wait'
property numElements: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IndexType]
property tagIndices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property tagMemRef: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
class iree.compiler.dialects.memref.ExpandShapeOp(result, src, reassociation, output_shape, static_output_shape, *, loc=None, ip=None)

The memref.expand_shape op produces a new view with a higher rank whose sizes are a reassociation of the original view. The operation is limited to such reassociations, where a dimension is expanded into one or multiple contiguous dimensions. Such reassociations never require additional allocs or copies.

A reassociation is defined as a grouping of dimensions and is represented with an array of DenseI64ArrayAttr attributes.

Example:

```mlir %r = memref.expand_shape %0 [[0, 1], [2]] output_shape [%sz0, %sz1, 32]

: memref<?x32xf32> into memref<?x?x32xf32>

```

If an op can be statically proven to be invalid (e.g, an expansion from memref<10xf32> to memref<2x6xf32>), it is rejected by the verifier. If it cannot statically be proven invalid (e.g., the full example above; it is unclear whether the first source dimension is divisible by 5), the op is accepted by the verifier. However, if the op is in fact invalid at runtime, the behavior is undefined.

The source memref can be zero-ranked. In that case, the reassociation indices must be empty and the result shape may only consist of unit dimensions.

For simplicity, this op may not be used to cast dynamicity of dimension sizes and/or strides. I.e., if and only if a source dimension is dynamic, there must be a dynamic result dimension in the corresponding reassociation group. Same for strides.

The representation for the output shape supports a partially-static specification via attributes specified through the static_output_shape argument. A special sentinel value ShapedType::kDynamic encodes that the corresponding entry has a dynamic value. There must be exactly as many SSA inputs in output_shape as there are ShapedType::kDynamic entries in static_output_shape.

Note: This op currently assumes that the inner strides are of the source/result layout map are the faster-varying ones.

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.ExpandShapeOpAdaptor

OPERATION_NAME = 'memref.expand_shape'
property output_shape: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property reassociation: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.MemRefType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property src: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property static_output_shape: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
class iree.compiler.dialects.memref.ExpandShapeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.expand_shape'
property output_shape: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property reassociation: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property src: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property static_output_shape: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
class iree.compiler.dialects.memref.ExtractAlignedPointerAsIndexOp(source, *, results=None, loc=None, ip=None)

Extracts the underlying aligned pointer as an index.

This operation is useful for lowering to lower-level dialects while still avoiding the need to define a pointer type in higher-level dialects such as the memref dialect.

This operation is intended solely as step during lowering, it has no side effects. A reverse operation that creates a memref from an index interpreted as a pointer is explicitly discouraged.

Example:

```

%0 = memref.extract_aligned_pointer_as_index %arg : memref<4x4xf32> -> index %1 = arith.index_cast %0 : index to i64 %2 = llvm.inttoptr %1 : i64 to !llvm.ptr call @foo(%2) : (!llvm.ptr) ->()

```

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.ExtractAlignedPointerAsIndexOpAdaptor

OPERATION_NAME = 'memref.extract_aligned_pointer_as_index'
property aligned_pointer: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.IndexType]
property source: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.memref.ExtractAlignedPointerAsIndexOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.extract_aligned_pointer_as_index'
property source: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.memref.ExtractStridedMetadataOp(source, *, results=None, loc=None, ip=None)

Extracts a base buffer, offset and strides. This op allows additional layers of transformations and foldings to be added as lowering progresses from higher-level dialect to lower-level dialects such as the LLVM dialect.

The op requires a strided memref source operand. If the source operand is not a strided memref, then verification fails.

This operation is also useful for completeness to the existing memref.dim op. While accessing strides, offsets and the base pointer independently is not available, this is useful for composing with its natural complement op: memref.reinterpret_cast.

Intended Use Cases:

The main use case is to expose the logic for manipulate memref metadata at a higher level than the LLVM dialect. This makes lowering more progressive and brings the following benefits:

  • not all users of MLIR want to lower to LLVM and the information to e.g. lower to library calls—like libxsmm—or to SPIR-V was not available.

  • foldings and canonicalizations can happen at a higher level in MLIR: before this op existed, lowering to LLVM would create large amounts of LLVMIR. Even when LLVM does a good job at folding the low-level IR from a performance perspective, it is unnecessarily opaque and inefficient to send unkempt IR to LLVM.

Example:

```mlir
%base, %offset, %sizes:2, %strides:2 =
memref.extract_strided_metadata %memrefmemref<10x?xf32>

-> memref<f32>, index, index, index, index, index

// After folding, the type of %m2 can be memref<10x?xf32> and further // folded to %memref. %m2 = memref.reinterpret_cast %base to

offset: [%offset], sizes: [%sizes#0, %sizes#1], strides: [%strides#0, %strides#1]

: memref<f32> to memref<?x?xf32, strided<[?, ?], offset:?>>

```

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.ExtractStridedMetadataOpAdaptor

OPERATION_NAME = 'memref.extract_strided_metadata'
property base_buffer: iree.compiler._mlir_libs._mlir.ir.OpResult
property offset: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.IndexType]
property sizes: iree.compiler._mlir_libs._mlir.ir.OpResultList
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property strides: iree.compiler._mlir_libs._mlir.ir.OpResultList
class iree.compiler.dialects.memref.ExtractStridedMetadataOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.extract_strided_metadata'
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
class iree.compiler.dialects.memref.GenericAtomicRMWOp(result, memref, indices, *, loc=None, ip=None)

The memref.generic_atomic_rmw operation provides a way to perform a read-modify-write sequence that is free from data races. The memref operand represents the buffer that the read and write will be performed against, as accessed by the specified indices. The arity of the indices is the rank of the memref. The result represents the latest value that was stored. The region contains the code for the modification itself. The entry block has a single argument that represents the value stored in memref[indices] before the write is performed. No side-effecting ops are allowed in the body of GenericAtomicRMWOp.

Example:

```mlir %x = memref.generic_atomic_rmw %I[%i] : memref<10xf32> {

^bb0(%current_valuef32):

%c1 = arith.constant 1.0 : f32 %inc = arith.addf %c1, %current_value : f32 memref.atomic_yield %inc : f32

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.GenericAtomicRMWOpAdaptor

OPERATION_NAME = 'memref.generic_atomic_rmw'
property atomic_body: iree.compiler._mlir_libs._mlir.ir.Region
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.memref.GenericAtomicRMWOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.generic_atomic_rmw'
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
class iree.compiler.dialects.memref.GetGlobalOp(result, name, *, loc=None, ip=None)

The memref.get_global operation retrieves the memref pointing to a named global variable. If the global variable is marked constant, writing to the result memref (such as through a memref.store operation) is undefined.

Example:

`mlir %x = memref.get_global @foo : memref<2xf32> `

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.GetGlobalOpAdaptor

OPERATION_NAME = 'memref.get_global'
property name: iree.compiler._mlir_libs._mlir.ir.FlatSymbolRefAttr

Returns the fully qualified name of the operation.

property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.MemRefType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.memref.GetGlobalOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.get_global'
property name: iree.compiler._mlir_libs._mlir.ir.FlatSymbolRefAttr
class iree.compiler.dialects.memref.GlobalOp(sym_name, type_, *, sym_visibility=None, initial_value=None, constant=None, alignment=None, loc=None, ip=None)

The memref.global operation declares or defines a named global memref variable. The backing memory for the variable is allocated statically and is described by the type of the variable (which should be a statically shaped memref type). The operation is a declaration if no initial_value is specified, else it is a definition. The initial_value can either be a unit attribute to represent a definition of an uninitialized global variable, or an elements attribute to represent the definition of a global variable with an initial value. The global variable can also be marked constant using the constant unit attribute. Writing to such constant global variables is undefined.

The global variable can be accessed by using the memref.get_global to retrieve the memref for the global variable. Note that the memref for such global variable itself is immutable (i.e., memref.get_global for a given global variable will always return the same memref descriptor).

Example:

```mlir // Private variable with an initial value. memref.global “private” @x : memref<2xf32> = dense<[0.0, 2.0]>

// Private variable with an initial value and an alignment (power of 2). memref.global “private” @x : memref<2xf32> = dense<[0.0, 2.0]> {alignment = 64}

// Declaration of an external variable. memref.global “private” @y : memref<4xi32>

// Uninitialized externally visible variable. memref.global @z : memref<3xf16> = uninitialized

// Externally visible constant variable. memref.global constant @c : memref<2xi32> = dense<[1, 4]> ```

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.GlobalOpAdaptor

OPERATION_NAME = 'memref.global'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property constant: bool
property initial_value: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute]
property sym_name: iree.compiler._mlir_libs._mlir.ir.StringAttr
property sym_visibility: Optional[iree.compiler._mlir_libs._mlir.ir.StringAttr]
property type_: iree.compiler._mlir_libs._mlir.ir.TypeAttr
class iree.compiler.dialects.memref.GlobalOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.global'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property constant: bool
property initial_value: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute]
property sym_name: iree.compiler._mlir_libs._mlir.ir.StringAttr
property sym_visibility: Optional[iree.compiler._mlir_libs._mlir.ir.StringAttr]
property type_: iree.compiler._mlir_libs._mlir.ir.TypeAttr
class iree.compiler.dialects.memref.IndexType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.index'
property typeid

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

class iree.compiler.dialects.memref.IntegerType(*args, **kwargs)
SIGNED = 1
SIGNLESS = 0
enum Signedness(value)

Valid values are as follows:

SIGNLESS = Signedness.SIGNLESS
SIGNED = Signedness.SIGNED
UNSIGNED = Signedness.UNSIGNED
UNSIGNED = 2
get = <nanobind.nb_func object>
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

property signedness

(self) -> iree.compiler._mlir_libs._mlir.ir.IntegerType.Signedness

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.integer'
property typeid

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

property width

Returns the width of the integer type

class iree.compiler.dialects.memref.LoadOp(memref, indices, *, nontemporal=None, alignment=None, results=None, loc=None, ip=None)

The load op reads an element from a memref at the specified indices.

The number of indices must match the rank of the memref. The indices must be in-bounds: 0 <= idx < dim_size.

Lowerings of memref.load may emit attributes, e.g. inbouds + nuw when converting to LLVM’s llvm.getelementptr, that would cause undefined behavior if indices are out of bounds or if computing the offset in the memref would cause signed overflow of the index type.

The single result of memref.load is a value with the same type as the element type of the memref.

A set nontemporal attribute indicates that this load is not expected to be reused in the cache. For details, refer to the [LLVM load instruction](https://llvm.org/docs/LangRef.html#load-instruction).

An optional alignment attribute allows to specify the byte alignment of the load operation. It must be a positive power of 2. The operation must access memory at an address aligned to this boundary. Violations may lead to architecture-specific faults or performance penalties. A value of 0 indicates no specific alignment requirement. Example:

`mlir %0 = memref.load %A[%a, %b] : memref<8x?xi32, #layout, memspace0> `

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.LoadOpAdaptor

OPERATION_NAME = 'memref.load'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property nontemporal: Optional[iree.compiler._mlir_libs._mlir.ir.BoolAttr]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.memref.LoadOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.load'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property nontemporal: Optional[iree.compiler._mlir_libs._mlir.ir.BoolAttr]
class iree.compiler.dialects.memref.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>
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>
type_name = 'builtin.memref'
property typeid

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

class iree.compiler.dialects.memref.MemorySpaceCastOp(dest, source, *, loc=None, ip=None)

This operation casts memref values between memory spaces. The input and result will be memrefs of the same types and shape that alias the same underlying memory, though, for some casts on some targets, the underlying values of the pointer stored in the memref may be affected by the cast.

The input and result must have the same shape, element type, rank, and layout.

If the source and target address spaces are the same, this operation is a noop.

Finally, if the target memory-space is the generic/default memory-space, then it is assumed this cast can be bubbled down safely. See the docs of MemorySpaceCastOpInterface interface for more details.

Example:

```mlir // Cast a GPU private memory attribution into a generic pointer %2 = memref.memory_space_cast %1 : memref<?xf32, 5> to memref<?xf32> // Cast a generic pointer to workgroup-local memory %4 = memref.memory_space_cast %3 : memref<5x4xi32> to memref<5x34xi32, 3> // Cast between two non-default memory spaces %6 = memref.memory_space_cast %5

: memref<*xmemref<?xf32>, 5> to memref<*xmemref<?xf32>, 3>

```

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.MemorySpaceCastOpAdaptor

OPERATION_NAME = 'memref.memory_space_cast'
property dest: iree.compiler._mlir_libs._mlir.ir.OpResult
property source: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.memref.MemorySpaceCastOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.memory_space_cast'
property source: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.memref.PrefetchOp(memref, indices, isWrite, localityHint, isDataCache, *, loc=None, ip=None)

The “prefetch” op prefetches data from a memref location described with subscript indices similar to memref.load, and with three attributes: a read/write specifier, a locality hint, and a cache type specifier as shown below:

`mlir memref.prefetch %0[%i, %j], read, locality<3>, data : memref<400x400xi32> `

The read/write specifier is either ‘read’ or ‘write’, the locality hint ranges from locality<0> (no locality) to locality<3> (extremely local keep in cache). The cache type specifier is either ‘data’ or ‘instr’ and specifies whether the prefetch is performed on data cache or on instruction cache.

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.PrefetchOpAdaptor

OPERATION_NAME = 'memref.prefetch'
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property isDataCache: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property isWrite: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property localityHint: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
class iree.compiler.dialects.memref.PrefetchOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.prefetch'
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property isDataCache: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property isWrite: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property localityHint: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
class iree.compiler.dialects.memref.RankOp(memref, *, results=None, loc=None, ip=None)

The memref.rank operation takes a memref operand and returns its rank.

Example:

`mlir %0 = memref.rank %arg0 : memref<*xf32> %1 = memref.rank %arg1 : memref<?x?xf32> `

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.RankOpAdaptor

OPERATION_NAME = 'memref.rank'
property memref: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.memref.RankOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.rank'
property memref: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.memref.ReallocOp(result, source, *, dynamicResultSize=None, alignment=None, loc=None, ip=None)

The realloc operation changes the size of a memory region. The memory region is specified by a 1D source memref and the size of the new memory region is specified by a 1D result memref type and an optional dynamic Value of Index type. The source and the result memref must be in the same memory space and have the same element type.

The operation may move the memory region to a new location. In this case, the content of the memory block is preserved up to the lesser of the new and old sizes. If the new size if larger, the value of the extended memory is undefined. This is consistent with the ISO C realloc.

The operation returns an SSA value for the memref.

Example:

`mlir %0 = memref.realloc %src : memref<64xf32> to memref<124xf32> `

The source memref may have a dynamic shape, in which case, the compiler will generate code to extract its size from the runtime data structure for the memref.

`mlir %1 = memref.realloc %src : memref<?xf32> to memref<124xf32> `

If the result memref has a dynamic shape, a result dimension operand is needed to spefify its dynamic dimension. In the example below, the ssa value ‘%d’ specifies the unknown dimension of the result memref.

`mlir %2 = memref.realloc %src(%d) : memref<?xf32> to memref<?xf32> `

An optional alignment attribute may be specified to ensure that the region of memory that will be indexed is aligned at the specified byte boundary. This is consistent with the fact that memref.alloc supports such an optional alignment attribute. Note that in ISO C standard, neither alloc nor realloc supports alignment, though there is aligned_alloc but not aligned_realloc.

`mlir %3 = memref.realloc %src {alignment = 8} : memref<64xf32> to memref<124xf32> `

Referencing the memref through the old SSA value after realloc is undefined behavior.

`mlir %new = memref.realloc %old : memref<64xf32> to memref<124xf32> %4 = memref.load %new[%index] : memref<124xf32> // ok %5 = memref.load %old[%index] : memref<64xf32>  // undefined behavior `

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.ReallocOpAdaptor

OPERATION_NAME = 'memref.realloc'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property dynamicResultSize: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IndexType]]
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
class iree.compiler.dialects.memref.ReallocOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.realloc'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property dynamicResultSize: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IndexType]]
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
class iree.compiler.dialects.memref.ReinterpretCastOp(result, source, offsets, sizes, strides, static_offsets, static_sizes, static_strides, *, loc=None, ip=None)

Modify offset, sizes and strides of an unranked/ranked memref.

Example 1:

Consecutive reinterpret_cast operations on memref’s with static dimensions.

We distinguish between underlying memory — the sequence of elements as they appear in the contiguous memory of the memref — and the strided memref, which refers to the underlying memory interpreted according to specified offsets, sizes, and strides.

```mlir %result1 = memref.reinterpret_cast %arg0 to

offset: [9], sizes: [4, 4], strides: [16, 2]

: memref<8x8xf32, strided<[8, 1], offset: 0>> to

memref<4x4xf32, strided<[16, 2], offset: 9>>

%result2 = memref.reinterpret_cast %result1 to

offset: [0], sizes: [2, 2], strides: [4, 2]

: memref<4x4xf32, strided<[16, 2], offset: 9>> to

memref<2x2xf32, strided<[4, 2], offset: 0>>

```

The underlying memory of %arg0 consists of a linear sequence of integers from 1 to 64. Its memref has the following 8x8 elements:

`mlir [[1,  2,  3,  4,  5,  6,  7,  8], [9,  10, 11, 12, 13, 14, 15, 16], [17, 18, 19, 20, 21, 22, 23, 24], [25, 26, 27, 28, 29, 30, 31, 32], [33, 34, 35, 36, 37, 38, 39, 40], [41, 42, 43, 44, 45, 46, 47, 48], [49, 50, 51, 52, 53, 54, 55, 56], [57, 58, 59, 60, 61, 62, 63, 64]] `

Following the first reinterpret_cast, the strided memref elements of %result1 are:

`mlir [[10, 12, 14, 16], [26, 28, 30, 32], [42, 44, 46, 48], [58, 60, 62, 64]] `

Note: The offset and strides are relative to the underlying memory of %arg0.

The second reinterpret_cast results in the following strided memref for %result2:

`mlir [[1, 3], [5, 7]] `

Notice that it does not matter if you use %result1 or %arg0 as a source for the second reinterpret_cast operation. Only the underlying memory pointers will be reused.

The offset and stride are relative to the base underlying memory of the memref, starting at 1, not at 10 as seen in the output of %result1. This behavior contrasts with the subview operator, where values are relative to the strided memref (refer to subview examples). Consequently, the second reinterpret_cast behaves as if %arg0 were passed directly as its argument.

Example 2: ```mlir memref.reinterpret_cast %ranked to

offset: [0], sizes: [%size0, 10], strides: [1, %stride1]

: memref<?x?xf32> to memref<?x10xf32, strided<[1, ?], offset: 0>>

memref.reinterpret_cast %unranked to

offset: [%offset], sizes: [%size0, %size1], strides: [%stride0, %stride1]

: memref<*xf32> to memref<?x?xf32, strided<[?, ?], offset: ?>> ```

This operation creates a new memref descriptor using the base of the source and applying the input arguments to the other metadata. In other words: ```mlir %dst = memref.reinterpret_cast %src to

offset: [%offset], sizes: [%sizes], strides: [%strides] : memref<*xf32> to memref<?x?xf32, strided<[?, ?], offset: ?>>

` means that `%dst`'s descriptor will be: ```mlir %dst.base = %src.base %dst.aligned = %src.aligned %dst.offset = %offset %dst.sizes = %sizes %dst.strides = %strides `

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.ReinterpretCastOpAdaptor

OPERATION_NAME = 'memref.reinterpret_cast'
property offsets: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.MemRefType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property sizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property source: iree.compiler._mlir_libs._mlir.ir.Value
property static_offsets: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property static_sizes: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property static_strides: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property strides: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.memref.ReinterpretCastOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.reinterpret_cast'
property offsets: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property sizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property source: iree.compiler._mlir_libs._mlir.ir.Value
property static_offsets: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property static_sizes: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property static_strides: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property strides: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.memref.ReshapeOp(result, source, shape, *, loc=None, ip=None)

The reshape operation converts a memref from one type to an equivalent type with a provided shape. The data is never copied or modified. The source and destination types are compatible if both have the same element type, same number of elements, address space and identity layout map. The following combinations are possible:

a. Source type is ranked or unranked. Shape argument has static size. Result type is ranked.

```mlir // Reshape statically-shaped memref. %dst = memref.reshape %src(%shape)

: (memref<4x1xf32>, memref<1xi32>) -> memref<4xf32>

%dst0 = memref.reshape %src(%shape0)

: (memref<4x1xf32>, memref<2xi32>) -> memref<2x2xf32>

// Flatten unranked memref. %dst = memref.reshape %src(%shape)

: (memref<*xf32>, memref<1xi32>) -> memref<?xf32>

```

b. Source type is ranked or unranked. Shape argument has dynamic size. Result type is unranked.

```mlir // Reshape dynamically-shaped 1D memref. %dst = memref.reshape %src(%shape)

: (memref<?xf32>, memref<?xi32>) -> memref<*xf32>

// Reshape unranked memref. %dst = memref.reshape %src(%shape)

: (memref<*xf32>, memref<?xi32>) -> memref<*xf32>

```

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.ReshapeOpAdaptor

OPERATION_NAME = 'memref.reshape'
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property shape: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property source: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.memref.ReshapeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.reshape'
property shape: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property source: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.memref.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.

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.dialects.memref.StoreOp(value, memref, indices, *, nontemporal=None, alignment=None, loc=None, ip=None)

The store op stores an element into a memref at the specified indices.

The number of indices must match the rank of the memref. The indices must be in-bounds: 0 <= idx < dim_size.

Lowerings of memref.store may emit attributes, e.g. inbouds + nuw when converting to LLVM’s llvm.getelementptr, that would cause undefined behavior if indices are out of bounds or if computing the offset in the memref would cause signed overflow of the index type.

A set nontemporal attribute indicates that this store is not expected to be reused in the cache. For details, refer to the [LLVM store instruction](https://llvm.org/docs/LangRef.html#store-instruction).

An optional alignment attribute allows to specify the byte alignment of the store operation. It must be a positive power of 2. The operation must access memory at an address aligned to this boundary. Violations may lead to architecture-specific faults or performance penalties. A value of 0 indicates no specific alignment requirement. Example:

`mlir memref.store %val, %A[%a, %b] : memref<8x?xi32, #layout, memspace0> `

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.StoreOpAdaptor

OPERATION_NAME = 'memref.store'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property nontemporal: Optional[iree.compiler._mlir_libs._mlir.ir.BoolAttr]
property value: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.memref.StoreOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.store'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property nontemporal: Optional[iree.compiler._mlir_libs._mlir.ir.BoolAttr]
property value: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.memref.StridedLayoutAttr(*args, **kwargs)
attr_name = 'builtin.strided_layout'
get = <nanobind.nb_func object>
get_fully_dynamic = <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.dialects.memref.SubViewOp(result, source, offsets, sizes, strides, static_offsets, static_sizes, static_strides, *, loc=None, ip=None)

The subview operation converts a memref type to a memref type which represents a reduced-size view of the original memref as specified by the operation’s offsets, sizes and strides arguments.

The subview operation supports the following arguments:

  • source: the “base” memref on which to create a “view” memref.

  • offsets: memref-rank number of offsets into the “base” memref at which to

    create the “view” memref.

  • sizes: memref-rank number of sizes which specify the sizes of the result

    “view” memref type.

  • strides: memref-rank number of strides that compose multiplicatively with

    the base memref strides in each dimension.

The representation based on offsets, sizes and strides support a partially-static specification via attributes specified through the static_offsets, static_sizes and static_strides arguments. A special sentinel value ShapedType::kDynamic encodes that the corresponding entry has a dynamic value.

A subview operation may additionally reduce the rank of the resulting view by removing dimensions that are statically known to be of size 1.

In the absence of rank reductions, the resulting memref type is computed as follows: ` result_sizes[i] = size_operands[i] result_strides[i] = src_strides[i] * stride_operands[i] result_offset = src_offset + dot_product(offset_operands, src_strides) `

The offset, size and stride operands must be in-bounds with respect to the source memref. When possible, the static operation verifier will detect out-of-bounds subviews. Subviews that cannot be confirmed to be in-bounds or out-of-bounds based on compile-time information are valid. However, performing an out-of-bounds subview at runtime is undefined behavior.

Example 1:

Consecutive subview operations on memref’s with static dimensions.

We distinguish between underlying memory — the sequence of elements as they appear in the contiguous memory of the memref — and the strided memref, which refers to the underlying memory interpreted according to specified offsets, sizes, and strides.

```mlir %result1 = memref.subview %arg0[1, 1][4, 4][2, 2] : memref<8x8xf32, strided<[8, 1], offset: 0>> to

memref<4x4xf32, strided<[16, 2], offset: 9>>

%result2 = memref.subview %result1[1, 1][2, 2][2, 2] : memref<4x4xf32, strided<[16, 2], offset: 9>> to

memref<2x2xf32, strided<[32, 4], offset: 27>>

```

The underlying memory of %arg0 consists of a linear sequence of integers from 1 to 64. Its memref has the following 8x8 elements:

`mlir [[1,  2,  3,  4,  5,  6,  7,  8], [9,  10, 11, 12, 13, 14, 15, 16], [17, 18, 19, 20, 21, 22, 23, 24], [25, 26, 27, 28, 29, 30, 31, 32], [33, 34, 35, 36, 37, 38, 39, 40], [41, 42, 43, 44, 45, 46, 47, 48], [49, 50, 51, 52, 53, 54, 55, 56], [57, 58, 59, 60, 61, 62, 63, 64]] `

Following the first subview, the strided memref elements of %result1 are:

`mlir [[10, 12, 14, 16], [26, 28, 30, 32], [42, 44, 46, 48], [58, 60, 62, 64]] `

Note: The offset and strides are relative to the strided memref of %arg0 (compare to the corresponding reinterpret_cast example).

The second subview results in the following strided memref for %result2:

`mlir [[28, 32], [60, 64]] `

Unlike the reinterpret_cast, the values are relative to the strided memref of the input (%result1 in this case) and not its underlying memory.

Example 2:

```mlir // Subview of static memref with strided layout at static offsets, sizes // and strides. %1 = memref.subview %0[4, 2][8, 2][3, 2]

: memref<64x4xf32, strided<[7, 9], offset: 91>> to

memref<8x2xf32, strided<[21, 18], offset: 137>>

```

Example 3:

```mlir // Subview of static memref with identity layout at dynamic offsets, sizes // and strides. %1 = memref.subview %0[%off0, %off1][%sz0, %sz1][%str0, %str1]

: memref<64x4xf32> to memref<?x?xf32, strided<[?, ?], offset: ?>>

```

Example 4:

```mlir // Subview of dynamic memref with strided layout at dynamic offsets and // strides, but static sizes. %1 = memref.subview %0[%off0, %off1][4, 4][%str0, %str1]

: memref<?x?xf32, strided<[?, ?], offset: ?>> to

memref<4x4xf32, strided<[?, ?], offset: ?>>

```

Example 5:

```mlir // Rank-reducing subviews. %1 = memref.subview %0[0, 0, 0][1, 16, 4][1, 1, 1]

: memref<8x16x4xf32> to memref<16x4xf32>

%3 = memref.subview %2[3, 4, 2][1, 6, 3][1, 1, 1]

: memref<8x16x4xf32> to memref<6x3xf32, strided<[4, 1], offset: 210>>

```

Example 6:

```mlir // Identity subview. The subview is the full source memref. %1 = memref.subview %0[0, 0, 0] [8, 16, 4] [1, 1, 1]

: memref<8x16x4xf32> to memref<8x16x4xf32>

```

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.SubViewOpAdaptor

OPERATION_NAME = 'memref.subview'
property offsets: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.MemRefType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property sizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property static_offsets: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property static_sizes: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property static_strides: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property strides: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.memref.SubViewOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.subview'
property offsets: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property sizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property static_offsets: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property static_sizes: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property static_strides: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property strides: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.memref.TransposeOp(result, in_, permutation, *, loc=None, ip=None)

The transpose op produces a strided memref whose sizes and strides are a permutation of the original in memref. This is purely a metadata transformation.

Example:

`mlir %1 = memref.transpose %0 (i, j) -> (j, i) : memref<?x?xf32> to memref<?x?xf32, affine_map<(d0, d1)[s0] -> (d1 * s0 + d0)>> `

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.TransposeOpAdaptor

OPERATION_NAME = 'memref.transpose'
property in_: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property permutation: iree.compiler._mlir_libs._mlir.ir.AffineMapAttr
class iree.compiler.dialects.memref.TransposeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.transpose'
property in_: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property permutation: iree.compiler._mlir_libs._mlir.ir.AffineMapAttr
class iree.compiler.dialects.memref.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.dialects.memref.ViewOp(result, source, byte_shift, sizes, *, loc=None, ip=None)

The “view” operation extracts an N-D contiguous memref with empty layout map with arbitrary element type from a 1-D contiguous memref with empty layout map of i8 element type. The ViewOp supports the following arguments:

  • A single dynamic byte-shift operand must be specified which represents a a shift of the base 1-D memref pointer from which to create the resulting contiguous memref view with identity layout.

  • A dynamic size operand that must be specified for each dynamic dimension in the resulting view memref type.

The “view” operation gives a structured indexing form to a flat 1-D buffer. Unlike “subview” it can perform a type change. The type change behavior requires the op to have special semantics because, e.g. a byte shift of 3 cannot be represented as an offset on f64. For now, a “view” op:

  1. Only takes a contiguous source memref with 0 offset and empty layout.

  2. Must specify a byte_shift operand (in the future, a special integer attribute may be added to support the folded case).

  3. Returns a contiguous memref with 0 offset and empty layout.

Example:

```mlir // Allocate a flat 1D/i8 memref. %0 = memref.alloc() : memref<2048xi8>

// ViewOp with dynamic offset and static sizes. %1 = memref.view %0[%offset_1024][] : memref<2048xi8> to memref<64x4xf32>

// ViewOp with dynamic offset and two dynamic size. %2 = memref.view %0[%offset_1024][%size0, %size1] :

memref<2048xi8> to memref<?x4x?xf32>

```

Adaptor

alias of iree.compiler.dialects._memref_ops_gen.ViewOpAdaptor

OPERATION_NAME = 'memref.view'
property byte_shift: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IndexType]
property sizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
class iree.compiler.dialects.memref.ViewOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'memref.view'
property byte_shift: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IndexType]
property sizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
class iree.compiler.dialects.memref.accumulate(iterable, func=None, *, initial=None)

Return series of accumulated sums (or other binary function results).

iree.compiler.dialects.memref.alloc(memref, dynamic_sizes, symbol_operands, *, alignment=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.memref.alloca(memref, dynamic_sizes, symbol_operands, *, alignment=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.memref.alloca_scope(results_, *, loc=None, ip=None) Union[iree.compiler._mlir_libs._mlir.ir.OpResult, iree.compiler._mlir_libs._mlir.ir.OpResultList, iree.compiler.dialects._memref_ops_gen.AllocaScopeOp]
iree.compiler.dialects.memref.alloca_scope_return(results_, *, loc=None, ip=None) iree.compiler.dialects._memref_ops_gen.AllocaScopeReturnOp
iree.compiler.dialects.memref.assume_alignment(memref, alignment, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.memref.atomic_rmw(kind, value, memref, indices, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.memref.atomic_yield(result, *, loc=None, ip=None) iree.compiler.dialects._memref_ops_gen.AtomicYieldOp
iree.compiler.dialects.memref.cast(dest, source, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.memref.collapse_shape(result, src, reassociation, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.memref.copy(source, target, *, loc=None, ip=None) iree.compiler.dialects._memref_ops_gen.CopyOp
iree.compiler.dialects.memref.dealloc(memref, *, loc=None, ip=None) iree.compiler.dialects._memref_ops_gen.DeallocOp
iree.compiler.dialects.memref.dim(source, index, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.memref.distinct_objects(operands_, *, results=None, loc=None, ip=None) Union[iree.compiler._mlir_libs._mlir.ir.OpResult, iree.compiler._mlir_libs._mlir.ir.OpResultList, iree.compiler.dialects._memref_ops_gen.DistinctObjectsOp]
iree.compiler.dialects.memref.dma_start(operands_, *, loc=None, ip=None) iree.compiler.dialects._memref_ops_gen.DmaStartOp
iree.compiler.dialects.memref.dma_wait(tag_mem_ref, tag_indices, num_elements, *, loc=None, ip=None) iree.compiler.dialects._memref_ops_gen.DmaWaitOp
iree.compiler.dialects.memref.expand_shape(result, src, reassociation, output_shape, static_output_shape, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.memref.extract_aligned_pointer_as_index(source, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.memref.extract_strided_metadata(source, *, results=None, loc=None, ip=None) Union[iree.compiler._mlir_libs._mlir.ir.OpResult, iree.compiler._mlir_libs._mlir.ir.OpResultList, iree.compiler.dialects._memref_ops_gen.ExtractStridedMetadataOp]
iree.compiler.dialects.memref.generic_atomic_rmw(result, memref, indices, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.memref.get_global(result, name, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.memref.global_(sym_name, type_, *, sym_visibility=None, initial_value=None, constant=None, alignment=None, loc=None, ip=None) iree.compiler.dialects._memref_ops_gen.GlobalOp
iree.compiler.dialects.memref.load(memref, indices, *, nontemporal=None, alignment=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.memref.memory_space_cast(dest, source, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.memref.prefetch(memref, indices, is_write, locality_hint, is_data_cache, *, loc=None, ip=None) iree.compiler.dialects._memref_ops_gen.PrefetchOp
iree.compiler.dialects.memref.rank(memref, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.memref.realloc(result, source, *, dynamic_result_size=None, alignment=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.memref.reinterpret_cast(result, source, offsets, sizes, strides, static_offsets, static_sizes, static_strides, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.memref.reshape(result, source, shape, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.memref.store(value, memref, indices, *, nontemporal=None, alignment=None, loc=None, ip=None) iree.compiler.dialects._memref_ops_gen.StoreOp
iree.compiler.dialects.memref.subview(source: iree.compiler._mlir_libs._mlir.ir.Value, offsets: Union[Sequence[Union[int, iree.compiler._mlir_libs._mlir.ir.IntegerAttr, iree.compiler._mlir_libs._mlir.ir.Operation, iree.compiler._mlir_libs._mlir.ir.OpView, iree.compiler._mlir_libs._mlir.ir.Value]], iree.compiler._mlir_libs._mlir.ir.ArrayAttr, iree.compiler._mlir_libs._mlir.ir.Operation, iree.compiler._mlir_libs._mlir.ir.OpView, iree.compiler._mlir_libs._mlir.ir.Value], sizes: Union[Sequence[Union[int, iree.compiler._mlir_libs._mlir.ir.IntegerAttr, iree.compiler._mlir_libs._mlir.ir.Operation, iree.compiler._mlir_libs._mlir.ir.OpView, iree.compiler._mlir_libs._mlir.ir.Value]], iree.compiler._mlir_libs._mlir.ir.ArrayAttr, iree.compiler._mlir_libs._mlir.ir.Operation, iree.compiler._mlir_libs._mlir.ir.OpView, iree.compiler._mlir_libs._mlir.ir.Value], strides: Union[Sequence[Union[int, iree.compiler._mlir_libs._mlir.ir.IntegerAttr, iree.compiler._mlir_libs._mlir.ir.Operation, iree.compiler._mlir_libs._mlir.ir.OpView, iree.compiler._mlir_libs._mlir.ir.Value]], iree.compiler._mlir_libs._mlir.ir.ArrayAttr, iree.compiler._mlir_libs._mlir.ir.Operation, iree.compiler._mlir_libs._mlir.ir.OpView, iree.compiler._mlir_libs._mlir.ir.Value], *, result_type: Optional[iree.compiler._mlir_libs._mlir.ir.MemRefType] = None, loc=None, ip=None)
iree.compiler.dialects.memref.transpose(result, in_, permutation, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.memref.view(result, source, byte_shift, sizes, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult

pdl dialect

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

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

property rhs

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

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

(self) -> int

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

(self) -> int

class iree.compiler.dialects.pdl.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>
maybe_downcast
shift_dims
shift_symbols
simplify_affine_expr = <nanobind.nb_func object>
class iree.compiler.dialects.pdl.AffineExprList
class iree.compiler.dialects.pdl.AffineFloorDivExpr(*args, **kwargs)
get = <nanobind.nb_func object>
class iree.compiler.dialects.pdl.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) -> mlir::python::mlir::PyAffineMapExprList

class iree.compiler.dialects.pdl.AffineMapAttr(*args, **kwargs)
attr_name = 'builtin.affine_map'
get = <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.dialects.pdl.AffineModExpr(*args, **kwargs)
get = <nanobind.nb_func object>
class iree.compiler.dialects.pdl.AffineMulExpr(*args, **kwargs)
get = <nanobind.nb_func object>
class iree.compiler.dialects.pdl.AffineSymbolExpr(*args, **kwargs)
get = <nanobind.nb_func object>
property position

(self) -> int

class iree.compiler.dialects.pdl.ApplyNativeConstraintOp(results_, name, args, *, isNegated=None, loc=None, ip=None)

pdl.apply_native_constraint operations apply a native C++ constraint, that has been registered externally with the consumer of PDL, to a given set of entities and optionally return a number of values.

Example:

`mlir // Apply `myConstraint` to the entities defined by `input`, `attr`, and `op`. pdl.apply_native_constraint "myConstraint"(%input, %attr, %op : !pdl.value, !pdl.attribute, !pdl.operation) // Apply constraint `with_result` to `root`. This constraint returns an attribute. %attr = pdl.apply_native_constraint "with_result"(%root : !pdl.operation) : !pdl.attribute `

Adaptor

alias of iree.compiler.dialects._pdl_ops_gen.ApplyNativeConstraintOpAdaptor

OPERATION_NAME = 'pdl.apply_native_constraint'
property args: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property isNegated: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property name: iree.compiler._mlir_libs._mlir.ir.StringAttr

Returns the fully qualified name of the operation.

property results_: iree.compiler._mlir_libs._mlir.ir.OpResultList
class iree.compiler.dialects.pdl.ApplyNativeConstraintOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'pdl.apply_native_constraint'
property args: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property isNegated: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property name: iree.compiler._mlir_libs._mlir.ir.StringAttr
class iree.compiler.dialects.pdl.ApplyNativeRewriteOp(results_, name, args, *, loc=None, ip=None)

pdl.apply_native_rewrite operations apply a native C++ function, that has been registered externally with the consumer of PDL, to perform a rewrite and optionally return a number of values. The native function may accept any number of arguments. This operation is used within a pdl.rewrite region to enable the interleaving of native rewrite methods with other pdl constructs.

Example:

`mlir // Apply a native rewrite method that returns an attribute. %ret = pdl.apply_native_rewrite "myNativeFunc"(%arg0, %attr1) : !pdl.attribute `

```c++ // The native rewrite as defined in C++: static Attribute myNativeFunc(PatternRewriter &rewriter, Value arg0, Attribute arg1) {

// Just return the second arg. return arg1;

}

void registerNativeRewrite(PDLPatternModule &pdlModule) {

pdlModule.registerRewriteFunction(“myNativeFunc”, myNativeFunc);

Adaptor

alias of iree.compiler.dialects._pdl_ops_gen.ApplyNativeRewriteOpAdaptor

OPERATION_NAME = 'pdl.apply_native_rewrite'
property args: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property name: iree.compiler._mlir_libs._mlir.ir.StringAttr

Returns the fully qualified name of the operation.

property results_: iree.compiler._mlir_libs._mlir.ir.OpResultList
class iree.compiler.dialects.pdl.ApplyNativeRewriteOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'pdl.apply_native_rewrite'
property args: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property name: iree.compiler._mlir_libs._mlir.ir.StringAttr
class iree.compiler.dialects.pdl.ArrayAttr(*args, **kwargs)
attr_name = 'builtin.array'
get = <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.dialects.pdl.ArrayAttributeIterator
class iree.compiler.dialects.pdl.AsmState(*args, **kwargs)
class iree.compiler.dialects.pdl.AttrBuilder
contains = <nanobind.nb_func object>
get = <nanobind.nb_func object>
insert = <nanobind.nb_func object>
class iree.compiler.dialects.pdl.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.dialects.pdl.AttributeOp(valueType: Optional[Union[iree.compiler._mlir_libs._mlir.ir.OpView, iree.compiler._mlir_libs._mlir.ir.Operation, iree.compiler._mlir_libs._mlir.ir.Value]] = None, value: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute] = None, *, loc=None, ip=None)

Specialization for PDL attribute op class.

class iree.compiler.dialects.pdl.AttributeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'pdl.attribute'
property value: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute]
property valueType: Optional[iree.compiler._mlir_libs._mlir.ir.Value]
class iree.compiler.dialects.pdl.AttributeType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'pdl.attribute'
property typeid

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

class iree.compiler.dialects.pdl.BF16Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.bf16'
property typeid

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

class iree.compiler.dialects.pdl.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.dialects.pdl.BlockArgument(*args, **kwargs)
property arg_number

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

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.dialects.pdl.BlockArgumentList
property types

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

class iree.compiler.dialects.pdl.BlockIterator
class iree.compiler.dialects.pdl.BlockList
append

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

Returns

The created block.

class iree.compiler.dialects.pdl.BlockPredecessors
class iree.compiler.dialects.pdl.BlockSuccessors
class iree.compiler.dialects.pdl.BoolAttr(*args, **kwargs)
get = <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.dialects.pdl.ComplexType(*args, **kwargs)
property element_type

Returns element type.

get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.complex'
property typeid

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

class iree.compiler.dialects.pdl.Context(load_on_create_dialects=None, thread_pool=None, *args, **kwargs)
class iree.compiler.dialects.pdl.DenseBoolArrayAttr(*args, **kwargs)
get = <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.dialects.pdl.DenseBoolArrayIterator
class iree.compiler.dialects.pdl.DenseElementsAttr(*args, **kwargs)
get = <nanobind.nb_func object>
get_splat = <nanobind.nb_func object>
get_splat_value
property is_splat

(self) -> bool

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.dialects.pdl.DenseF32ArrayAttr(*args, **kwargs)
get = <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.dialects.pdl.DenseF32ArrayIterator
class iree.compiler.dialects.pdl.DenseF64ArrayAttr(*args, **kwargs)
get = <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.dialects.pdl.DenseF64ArrayIterator
class iree.compiler.dialects.pdl.DenseFPElementsAttr(*args, **kwargs)
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.dialects.pdl.DenseI16ArrayAttr(*args, **kwargs)
get = <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.dialects.pdl.DenseI16ArrayIterator
class iree.compiler.dialects.pdl.DenseI32ArrayAttr(*args, **kwargs)
get = <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.dialects.pdl.DenseI32ArrayIterator
class iree.compiler.dialects.pdl.DenseI64ArrayAttr(*args, **kwargs)
get = <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.dialects.pdl.DenseI64ArrayIterator
class iree.compiler.dialects.pdl.DenseI8ArrayAttr(*args, **kwargs)
get = <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.dialects.pdl.DenseI8ArrayIterator
class iree.compiler.dialects.pdl.DenseIntElementsAttr(*args, **kwargs)
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.dialects.pdl.DenseResourceElementsAttr(*args, **kwargs)
attr_name = 'builtin.dense_resource_elements'
get_from_buffer = <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.dialects.pdl.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.dialects.pdl.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.dialects.pdl.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.dialects.pdl.DiagnosticSeverity(value)

Valid values are as follows:

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

Returns the DialectDescriptor for this dialect.

class iree.compiler.dialects.pdl.DialectDescriptor
property namespace

Returns the namespace of the dialect.

class iree.compiler.dialects.pdl.DialectRegistry(*args, **kwargs)
class iree.compiler.dialects.pdl.Dialects
class iree.compiler.dialects.pdl.DictAttr(*args, **kwargs)
attr_name = 'builtin.dictionary'
get = <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.dialects.pdl.EraseOp(opValue, *, loc=None, ip=None)

pdl.erase operations are used within pdl.rewrite regions to specify that an input operation should be marked as erased. The semantics of this operation correspond with the eraseOp method on a PatternRewriter.

Example:

`mlir pdl.erase %root `

Adaptor

alias of iree.compiler.dialects._pdl_ops_gen.EraseOpAdaptor

OPERATION_NAME = 'pdl.erase'
property opValue: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.pdl.EraseOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'pdl.erase'
property opValue: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.pdl.F16Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f16'
property typeid

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

class iree.compiler.dialects.pdl.F32Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f32'
property typeid

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

class iree.compiler.dialects.pdl.F64Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f64'
property typeid

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

class iree.compiler.dialects.pdl.FlatSymbolRefAttr(*args, **kwargs)
attr_name = 'builtin.symbol_ref'
get = <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.dialects.pdl.Float4E2M1FNType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f4E2M1FN'
property typeid

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

class iree.compiler.dialects.pdl.Float6E2M3FNType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f6E2M3FN'
property typeid

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

class iree.compiler.dialects.pdl.Float6E3M2FNType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f6E3M2FN'
property typeid

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

class iree.compiler.dialects.pdl.Float8E3M4Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E3M4'
property typeid

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

class iree.compiler.dialects.pdl.Float8E4M3B11FNUZType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E4M3B11FNUZ'
property typeid

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

class iree.compiler.dialects.pdl.Float8E4M3FNType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E4M3FN'
property typeid

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

class iree.compiler.dialects.pdl.Float8E4M3FNUZType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E4M3FNUZ'
property typeid

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

class iree.compiler.dialects.pdl.Float8E4M3Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E4M3'
property typeid

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

class iree.compiler.dialects.pdl.Float8E5M2FNUZType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E5M2FNUZ'
property typeid

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

class iree.compiler.dialects.pdl.Float8E5M2Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E5M2'
property typeid

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

class iree.compiler.dialects.pdl.Float8E8M0FNUType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E8M0FNU'
property typeid

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

class iree.compiler.dialects.pdl.FloatAttr(*args, **kwargs)
attr_name = 'builtin.float'
get = <nanobind.nb_func object>
get_f32 = <nanobind.nb_func object>
get_f64 = <nanobind.nb_func object>
get_unchecked = <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.dialects.pdl.FloatTF32Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.tf32'
property typeid

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

class iree.compiler.dialects.pdl.FloatType(*args, **kwargs)
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.dialects.pdl.FunctionType(*args, **kwargs)
get = <nanobind.nb_func object>
property inputs

Returns the list of input types in the FunctionType.

property results

Returns the list of result types in the FunctionType.

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.function'
property typeid

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

class iree.compiler.dialects.pdl.IndexType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.index'
property typeid

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

class iree.compiler.dialects.pdl.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.dialects.pdl.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.dialects.pdl.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.dialects.pdl.IntegerAttr(*args, **kwargs)
attr_name = 'builtin.integer'
get = <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.dialects.pdl.IntegerSet
property constraints

(self) -> mlir::python::mlir::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.dialects.pdl.IntegerSetAttr(*args, **kwargs)
attr_name = 'builtin.integer_set'
get = <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.dialects.pdl.IntegerSetConstraint
property expr

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

property is_eq

(self) -> bool

class iree.compiler.dialects.pdl.IntegerSetConstraintList
class iree.compiler.dialects.pdl.IntegerType(*args, **kwargs)
SIGNED = 1
SIGNLESS = 0
enum Signedness(value)

Valid values are as follows:

SIGNLESS = Signedness.SIGNLESS
SIGNED = Signedness.SIGNED
UNSIGNED = Signedness.UNSIGNED
UNSIGNED = 2
get = <nanobind.nb_func object>
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

property signedness

(self) -> iree.compiler._mlir_libs._mlir.ir.IntegerType.Signedness

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.integer'
property typeid

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

property width

Returns the width of the integer type

class iree.compiler.dialects.pdl.Iterable
class iree.compiler.dialects.pdl.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.dialects.pdl.MLIRError(message, error_diagnostics)
An exception with diagnostic information. Has the following fields:

message: str error_diagnostics: List[ir.DiagnosticInfo]

class iree.compiler.dialects.pdl.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>
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>
type_name = 'builtin.memref'
property typeid

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

class iree.compiler.dialects.pdl.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.dialects.pdl.NamedAttribute
property attr

The underlying generic attribute of the NamedAttribute binding.

property name

The name of the NamedAttribute binding.

class iree.compiler.dialects.pdl.NewType(name, tp)

NewType creates simple unique types with almost zero runtime overhead.

NewType(name, tp) is considered a subtype of tp by static type checkers. At runtime, NewType(name, tp) returns a dummy callable that simply returns its argument.

Usage:

UserId = NewType('UserId', int)

def name_by_id(user_id: UserId) -> str:
    ...

UserId('user')          # Fails type check

name_by_id(42)          # Fails type check
name_by_id(UserId(42))  # OK

num = UserId(5) + 1     # type: int
class iree.compiler.dialects.pdl.NoneType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.none'
property typeid

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

class iree.compiler.dialects.pdl.OpAdaptor(*args, **kwargs)
property attributes

Returns the attributes of the adaptor.

property operands

Returns the operands of the adaptor.

class iree.compiler.dialects.pdl.OpAttributeMap
get

Gets an attribute by name or the default value, if it does not exist.

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.dialects.pdl.OpOperand
property operand_number

Returns the operand number in the owning operation.

property owner

Returns the operation that owns this operand.

class iree.compiler.dialects.pdl.OpOperandIterator
class iree.compiler.dialects.pdl.OpOperandList
class iree.compiler.dialects.pdl.OpResult(*args, **kwargs)
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.dialects.pdl.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.dialects.pdl.OpSuccessors
class iree.compiler.dialects.pdl.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.dialects.pdl.OpaqueAttr(*args, **kwargs)
attr_name = 'builtin.opaque'
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>
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.dialects.pdl.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>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.opaque'
property typeid

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

class iree.compiler.dialects.pdl.OperandOp(type: Optional[Union[iree.compiler._mlir_libs._mlir.ir.OpView, iree.compiler._mlir_libs._mlir.ir.Operation, iree.compiler._mlir_libs._mlir.ir.Value]] = None, *, loc=None, ip=None)

Specialization for PDL operand op class.

class iree.compiler.dialects.pdl.OperandOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'pdl.operand'
property valueType: Optional[iree.compiler._mlir_libs._mlir.ir.Value]
class iree.compiler.dialects.pdl.OperandsOp(types: Optional[Union[iree.compiler._mlir_libs._mlir.ir.OpView, iree.compiler._mlir_libs._mlir.ir.Operation, iree.compiler._mlir_libs._mlir.ir.Value]] = None, *, loc=None, ip=None)

Specialization for PDL operands op class.

class iree.compiler.dialects.pdl.OperandsOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'pdl.operands'
property valueType: Optional[iree.compiler._mlir_libs._mlir.ir.Value]
class iree.compiler.dialects.pdl.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.dialects.pdl.OperationIterator
class iree.compiler.dialects.pdl.OperationList
class iree.compiler.dialects.pdl.OperationOp(name: Optional[Union[str, iree.compiler._mlir_libs._mlir.ir.StringAttr]] = None, args: Optional[Sequence[Union[iree.compiler._mlir_libs._mlir.ir.OpView, iree.compiler._mlir_libs._mlir.ir.Operation, iree.compiler._mlir_libs._mlir.ir.Value]]] = None, attributes: Optional[Mapping[str, Union[iree.compiler._mlir_libs._mlir.ir.OpView, iree.compiler._mlir_libs._mlir.ir.Operation, iree.compiler._mlir_libs._mlir.ir.Value]]] = None, types: Optional[Sequence[Union[iree.compiler._mlir_libs._mlir.ir.OpView, iree.compiler._mlir_libs._mlir.ir.Operation, iree.compiler._mlir_libs._mlir.ir.Value]]] = None, *, loc=None, ip=None)

Specialization for PDL operand op class.

class iree.compiler.dialects.pdl.OperationOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'pdl.operation'
property attributeValueNames: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property attributeValues: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property opName: Optional[iree.compiler._mlir_libs._mlir.ir.StringAttr]
property operandValues: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property typeValues: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.pdl.OperationType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'pdl.operation'
property typeid

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

class iree.compiler.dialects.pdl.PDLType(*args, **kwargs)
property static_typeid
property typeid

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

class iree.compiler.dialects.pdl.PatternOp(benefit: Union[iree.compiler._mlir_libs._mlir.ir.IntegerAttr, int], name: Optional[Union[str, iree.compiler._mlir_libs._mlir.ir.StringAttr]] = None, *, loc=None, ip=None)

Specialization for PDL pattern op class.

property body

Return the body (block) of the pattern.

class iree.compiler.dialects.pdl.PatternOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'pdl.pattern'
property benefit: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property sym_name: Optional[iree.compiler._mlir_libs._mlir.ir.StringAttr]
class iree.compiler.dialects.pdl.RangeOp(result, arguments, *, loc=None, ip=None)

pdl.range operations construct a range from a given set of PDL entities, which all share the same underlying element type. For example, a !pdl.range<value> may be constructed from a list of !pdl.value or !pdl.range<value> entities.

Example:

```mlir // Construct a range of values. %valueRange = pdl.range %inputValue, %inputRange : !pdl.value, !pdl.range<value>

// Construct a range of types. %typeRange = pdl.range %inputType, %inputRange : !pdl.type, !pdl.range<type>

// Construct an empty range of types. %valueRange = pdl.range : !pdl.range<type> ```

TODO: Range construction is currently limited to rewrites, but it could be extended to constraints under certain circustances; i.e., if we can determine how to extract the underlying elements. If we can’t, e.g. if there are multiple sub ranges used for construction, we won’t be able to determine their sizes during constraint time.

Adaptor

alias of iree.compiler.dialects._pdl_ops_gen.RangeOpAdaptor

OPERATION_NAME = 'pdl.range'
property arguments: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.pdl.RangeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'pdl.range'
property arguments: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.pdl.RangeType(*args, **kwargs)
property element_type

Get the element type.

get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'pdl.range'
property typeid

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

class iree.compiler.dialects.pdl.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>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.tensor'
property typeid

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

class iree.compiler.dialects.pdl.Region
property blocks

Returns a forward-optimized sequence of blocks.

property owner

Returns the operation owning this region.

class iree.compiler.dialects.pdl.RegionIterator
class iree.compiler.dialects.pdl.RegionSequence
class iree.compiler.dialects.pdl.ReplaceOp(op: Union[iree.compiler._mlir_libs._mlir.ir.OpView, iree.compiler._mlir_libs._mlir.ir.Operation, iree.compiler._mlir_libs._mlir.ir.Value], *, with_op: Optional[Union[iree.compiler._mlir_libs._mlir.ir.OpView, iree.compiler._mlir_libs._mlir.ir.Operation, iree.compiler._mlir_libs._mlir.ir.Value]] = None, with_values: Optional[Sequence[Union[iree.compiler._mlir_libs._mlir.ir.OpView, iree.compiler._mlir_libs._mlir.ir.Operation, iree.compiler._mlir_libs._mlir.ir.Value]]] = None, loc=None, ip=None)

Specialization for PDL replace op class.

class iree.compiler.dialects.pdl.ReplaceOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'pdl.replace'
property opValue: iree.compiler._mlir_libs._mlir.ir.Value
property replOperation: Optional[iree.compiler._mlir_libs._mlir.ir.Value]
property replValues: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.pdl.ResultOp(parent: Union[iree.compiler._mlir_libs._mlir.ir.OpView, iree.compiler._mlir_libs._mlir.ir.Operation, iree.compiler._mlir_libs._mlir.ir.Value], index: Union[iree.compiler._mlir_libs._mlir.ir.IntegerAttr, int], *, loc=None, ip=None)

Specialization for PDL result op class.

class iree.compiler.dialects.pdl.ResultOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'pdl.result'
property index: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property parent: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.pdl.ResultsOp(val, parent, *, index=None, loc=None, ip=None)

pdl.results operations extract a result group from an operation within a pattern or rewrite region. If an index is provided, this operation extracts a result group as defined by the ODS definition of the operation. In this case the result of this operation may be either a single pdl.value or a pdl.range<value>, depending on the constraint of the result in ODS. If no index is provided, this operation extracts the full result range of the operation.

Example:

```mlir // Extract all of the results of an operation: %operation = pdl.operation … %results = pdl.results of %operation

// Extract the results in the first result group of an operation, which is // variadic: %operation = pdl.operation … %results = pdl.results 0 of %operation -> !pdl.range<value>

// Extract the results in the second result group of an operation, which is // not variadic: %operation = pdl.operation … %results = pdl.results 1 of %operation -> !pdl.value ```

Adaptor

alias of iree.compiler.dialects._pdl_ops_gen.ResultsOpAdaptor

OPERATION_NAME = 'pdl.results'
property index: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property parent: iree.compiler._mlir_libs._mlir.ir.Value

Returns the parent operation, or None if at top level.

property val: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.pdl.ResultsOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'pdl.results'
property index: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property parent: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.pdl.RewriteOp(root: Optional[Union[iree.compiler._mlir_libs._mlir.ir.OpView, iree.compiler._mlir_libs._mlir.ir.Operation, iree.compiler._mlir_libs._mlir.ir.Value]] = None, name: Optional[Union[str, iree.compiler._mlir_libs._mlir.ir.StringAttr]] = None, args: Optional[Sequence[Union[iree.compiler._mlir_libs._mlir.ir.OpView, iree.compiler._mlir_libs._mlir.ir.Operation, iree.compiler._mlir_libs._mlir.ir.Value]]] = None, *, loc=None, ip=None)

Specialization for PDL rewrite op class.

add_body()

Add body (block) to the rewrite.

property body

Return the body (block) of the rewrite.

class iree.compiler.dialects.pdl.RewriteOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'pdl.rewrite'
property externalArgs: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property name: Optional[iree.compiler._mlir_libs._mlir.ir.StringAttr]
property root: Optional[iree.compiler._mlir_libs._mlir.ir.Value]
class iree.compiler.dialects.pdl.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.

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.dialects.pdl.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.dialects.pdl.StridedLayoutAttr(*args, **kwargs)
attr_name = 'builtin.strided_layout'
get = <nanobind.nb_func object>
get_fully_dynamic = <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.dialects.pdl.StringAttr(*args, **kwargs)
attr_name = 'builtin.string'
get = <nanobind.nb_func object>
get_typed = <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.dialects.pdl.SymbolRefAttr(*args, **kwargs)
attr_name = 'builtin.symbol_ref'
get = <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.dialects.pdl.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.dialects.pdl.ThreadPool(*args, **kwargs)
get_max_concurrency

Returns the maximum number of threads in the pool.

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

Returns the pos-th type in the tuple type.

property num_types

Returns the number of types contained in a tuple.

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.tuple'
property typeid

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

class iree.compiler.dialects.pdl.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.dialects.pdl.TypeAttr(*args, **kwargs)
attr_name = 'builtin.type'
get = <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.dialects.pdl.TypeID
class iree.compiler.dialects.pdl.TypeOp(constantType: Optional[Union[iree.compiler._mlir_libs._mlir.ir.TypeAttr, iree.compiler._mlir_libs._mlir.ir.Type]] = None, *, loc=None, ip=None)

Specialization for PDL type op class.

class iree.compiler.dialects.pdl.TypeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'pdl.type'
property constantType: Optional[iree.compiler._mlir_libs._mlir.ir.TypeAttr]
class iree.compiler.dialects.pdl.TypeType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'pdl.type'
property typeid

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

class iree.compiler.dialects.pdl.TypesOp(constantTypes: Optional[Sequence[Union[iree.compiler._mlir_libs._mlir.ir.TypeAttr, iree.compiler._mlir_libs._mlir.ir.Type]]] = None, *, loc=None, ip=None)

Specialization for PDL types op class.

class iree.compiler.dialects.pdl.TypesOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'pdl.types'
property constantTypes: Optional[iree.compiler._mlir_libs._mlir.ir.ArrayAttr]
class iree.compiler.dialects.pdl.UnitAttr(*args, **kwargs)
attr_name = 'builtin.unit'
get = <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.dialects.pdl.UnrankedMemRefType(*args, **kwargs)
get = <nanobind.nb_func object>
get_unchecked = <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>
type_name = 'builtin.unranked_memref'
property typeid

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

class iree.compiler.dialects.pdl.UnrankedTensorType(*args, **kwargs)
get = <nanobind.nb_func object>
get_unchecked = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.unranked_tensor'
property typeid

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

class iree.compiler.dialects.pdl.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.dialects.pdl.ValueType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'pdl.value'
property typeid

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

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

(self) -> bool

property scalable_dims

(self) -> list[bool]

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.vector'
property typeid

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

enum iree.compiler.dialects.pdl.WalkOrder(value)

Valid values are as follows:

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

Valid values are as follows:

ADVANCE = WalkResult.ADVANCE
INTERRUPT = WalkResult.INTERRUPT
SKIP = WalkResult.SKIP
iree.compiler.dialects.pdl.append_load_on_create_dialect(dialect: str)
iree.compiler.dialects.pdl.apply_native_constraint(results_, name, args, *, is_negated=None, loc=None, ip=None) Union[iree.compiler._mlir_libs._mlir.ir.OpResult, iree.compiler._mlir_libs._mlir.ir.OpResultList, iree.compiler.dialects._pdl_ops_gen.ApplyNativeConstraintOp]
iree.compiler.dialects.pdl.apply_native_rewrite(results_, name, args, *, loc=None, ip=None) Union[iree.compiler._mlir_libs._mlir.ir.OpResult, iree.compiler._mlir_libs._mlir.ir.OpResultList, iree.compiler.dialects._pdl_ops_gen.ApplyNativeRewriteOp]
iree.compiler.dialects.pdl.attribute(attr, *, value_type=None, value=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.pdl.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.dialects.pdl.erase(op_value, *, loc=None, ip=None) iree.compiler.dialects._pdl_ops_gen.EraseOp
iree.compiler.dialects.pdl.get_dialect_registry()
iree.compiler.dialects.pdl.get_load_on_create_dialects()
iree.compiler.dialects.pdl.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.dialects.pdl.op_t() iree.compiler.dialects.pdl.OperationType
iree.compiler.dialects.pdl.operand(value, *, value_type=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.pdl.operands_(value, *, value_type=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.pdl.operation_(op, operand_values, attribute_values, attribute_value_names, type_values, *, op_name=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.pdl.pattern(*args, **kwargs)
iree.compiler.dialects.pdl.range(result, arguments, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.pdl.region_op(op_constructor, terminator=None)

Decorator to define an MLIR Op specified as a python function.

Requires that an mlir.ir.InsertionPoint and mlir.ir.Location are active for the current thread (i.e. established in a with block).

Supports “naked” usage i.e., no parens if no args need to be passed to the Op constructor.

When applied as a decorator to a Python function, an entry block will be constructed for the Op with types as specified as type hints on the args of the function. The block arguments will be passed positionally to the Python function.

If a terminator is specified then the return from the decorated function will be passed to the terminator as the last statement in the entry block. Note, the API for the terminator is a (possibly empty) list; terminator accepting single values should be wrapped in a lambda args: term(args[0])

The identifier (name) of the function will become: 1. A single value result if the Op returns a single value; 2. An OpResultList (as a list) if the Op returns multiple values; 3. The Operation if the Op returns no results.

See examples in tensor.py and transform.extras.

iree.compiler.dialects.pdl.register_attribute_builder(kind, replace=False)
iree.compiler.dialects.pdl.replace(op_value, repl_values, *, repl_operation=None, loc=None, ip=None) iree.compiler.dialects._pdl_ops_gen.ReplaceOp
iree.compiler.dialects.pdl.result(val, parent, index, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.pdl.results_(val, parent, *, index=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.pdl.rewrite(*args, **kwargs)
iree.compiler.dialects.pdl.type_(result, *, constant_type=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.pdl.types(result, *, constant_types=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult

scf dialect

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

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

property rhs

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

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

(self) -> int

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

(self) -> int

class iree.compiler.dialects.scf.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>
maybe_downcast
shift_dims
shift_symbols
simplify_affine_expr = <nanobind.nb_func object>
class iree.compiler.dialects.scf.AffineExprList
class iree.compiler.dialects.scf.AffineFloorDivExpr(*args, **kwargs)
get = <nanobind.nb_func object>
class iree.compiler.dialects.scf.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) -> mlir::python::mlir::PyAffineMapExprList

class iree.compiler.dialects.scf.AffineMapAttr(*args, **kwargs)
attr_name = 'builtin.affine_map'
get = <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.dialects.scf.AffineModExpr(*args, **kwargs)
get = <nanobind.nb_func object>
class iree.compiler.dialects.scf.AffineMulExpr(*args, **kwargs)
get = <nanobind.nb_func object>
class iree.compiler.dialects.scf.AffineSymbolExpr(*args, **kwargs)
get = <nanobind.nb_func object>
property position

(self) -> int

class iree.compiler.dialects.scf.ArrayAttr(*args, **kwargs)
attr_name = 'builtin.array'
get = <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.dialects.scf.ArrayAttributeIterator
class iree.compiler.dialects.scf.AsmState(*args, **kwargs)
class iree.compiler.dialects.scf.AttrBuilder
contains = <nanobind.nb_func object>
get = <nanobind.nb_func object>
insert = <nanobind.nb_func object>
class iree.compiler.dialects.scf.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.dialects.scf.BF16Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.bf16'
property typeid

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

class iree.compiler.dialects.scf.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.dialects.scf.BlockArgument(*args, **kwargs)
property arg_number

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

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.dialects.scf.BlockArgumentList
property types

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

class iree.compiler.dialects.scf.BlockIterator
class iree.compiler.dialects.scf.BlockList
append

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

Returns

The created block.

class iree.compiler.dialects.scf.BlockPredecessors
class iree.compiler.dialects.scf.BlockSuccessors
class iree.compiler.dialects.scf.BoolAttr(*args, **kwargs)
get = <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.dialects.scf.ComplexType(*args, **kwargs)
property element_type

Returns element type.

get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.complex'
property typeid

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

class iree.compiler.dialects.scf.ConditionOp(condition, args, *, loc=None, ip=None)

This operation accepts the continuation (i.e., inverse of exit) condition of the scf.while construct. If its first argument is true, the “after” region of scf.while is executed, with the remaining arguments forwarded to the entry block of the region. Otherwise, the loop terminates.

Adaptor

alias of iree.compiler.dialects._scf_ops_gen.ConditionOpAdaptor

OPERATION_NAME = 'scf.condition'
property args: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property condition: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]
class iree.compiler.dialects.scf.ConditionOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'scf.condition'
property args: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property condition: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]
class iree.compiler.dialects.scf.Context(load_on_create_dialects=None, thread_pool=None, *args, **kwargs)
class iree.compiler.dialects.scf.DenseBoolArrayAttr(*args, **kwargs)
get = <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.dialects.scf.DenseBoolArrayIterator
class iree.compiler.dialects.scf.DenseElementsAttr(*args, **kwargs)
get = <nanobind.nb_func object>
get_splat = <nanobind.nb_func object>
get_splat_value
property is_splat

(self) -> bool

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.dialects.scf.DenseF32ArrayAttr(*args, **kwargs)
get = <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.dialects.scf.DenseF32ArrayIterator
class iree.compiler.dialects.scf.DenseF64ArrayAttr(*args, **kwargs)
get = <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.dialects.scf.DenseF64ArrayIterator
class iree.compiler.dialects.scf.DenseFPElementsAttr(*args, **kwargs)
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.dialects.scf.DenseI16ArrayAttr(*args, **kwargs)
get = <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.dialects.scf.DenseI16ArrayIterator
class iree.compiler.dialects.scf.DenseI32ArrayAttr(*args, **kwargs)
get = <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.dialects.scf.DenseI32ArrayIterator
class iree.compiler.dialects.scf.DenseI64ArrayAttr(*args, **kwargs)
get = <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.dialects.scf.DenseI64ArrayIterator
class iree.compiler.dialects.scf.DenseI8ArrayAttr(*args, **kwargs)
get = <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.dialects.scf.DenseI8ArrayIterator
class iree.compiler.dialects.scf.DenseIntElementsAttr(*args, **kwargs)
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.dialects.scf.DenseResourceElementsAttr(*args, **kwargs)
attr_name = 'builtin.dense_resource_elements'
get_from_buffer = <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.dialects.scf.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.dialects.scf.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.dialects.scf.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.dialects.scf.DiagnosticSeverity(value)

Valid values are as follows:

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

Returns the DialectDescriptor for this dialect.

class iree.compiler.dialects.scf.DialectDescriptor
property namespace

Returns the namespace of the dialect.

class iree.compiler.dialects.scf.DialectRegistry(*args, **kwargs)
class iree.compiler.dialects.scf.Dialects
class iree.compiler.dialects.scf.DictAttr(*args, **kwargs)
attr_name = 'builtin.dictionary'
get = <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.dialects.scf.ExecuteRegionOp(result, *, no_inline=None, loc=None, ip=None)

The scf.execute_region operation is used to allow multiple blocks within SCF and other operations which can hold only one block. The scf.execute_region operation executes the region held exactly once and cannot have any operands. As such, its region has no arguments. All SSA values that dominate the op can be accessed inside the op. The op’s region can have multiple blocks and the blocks can have multiple distinct terminators. Values returned from this op’s region define the op’s results. The optional ‘no_inline’ flag can be set to request the ExecuteRegionOp to be preserved as much as possible and not being inlined in the parent block until an explicit lowering step.

Example:

```mlir scf.for %i = 0 to 128 step %c1 {

%y = scf.execute_region -> i32 {

%x = load %A[%i] : memref<128xi32> scf.yield %x : i32

}

}

// the same as above but with no_inline attribute scf.for %i = 0 to 128 step %c1 {

%y = scf.execute_region -> i32 no_inline {

%x = load %A[%i] : memref<128xi32> scf.yield %x : i32

}

}

affine.for %i = 0 to 100 {

“foo”() : () -> () %v = scf.execute_region -> i64 {

cf.cond_br %cond, ^bb1, ^bb2

^bb1:

%c1 = arith.constant 1 : i64 cf.br ^bb3(%c1 : i64)

^bb2:

%c2 = arith.constant 2 : i64 cf.br ^bb3(%c2 : i64)

^bb3(%xi64):

scf.yield %x : i64

} “bar”(%v) : (i64) -> ()

Adaptor

alias of iree.compiler.dialects._scf_ops_gen.ExecuteRegionOpAdaptor

OPERATION_NAME = 'scf.execute_region'
property no_inline: bool
property region: iree.compiler._mlir_libs._mlir.ir.Region
class iree.compiler.dialects.scf.ExecuteRegionOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'scf.execute_region'
property no_inline: bool
class iree.compiler.dialects.scf.F16Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f16'
property typeid

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

class iree.compiler.dialects.scf.F32Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f32'
property typeid

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

class iree.compiler.dialects.scf.F64Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f64'
property typeid

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

class iree.compiler.dialects.scf.FlatSymbolRefAttr(*args, **kwargs)
attr_name = 'builtin.symbol_ref'
get = <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.dialects.scf.Float4E2M1FNType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f4E2M1FN'
property typeid

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

class iree.compiler.dialects.scf.Float6E2M3FNType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f6E2M3FN'
property typeid

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

class iree.compiler.dialects.scf.Float6E3M2FNType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f6E3M2FN'
property typeid

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

class iree.compiler.dialects.scf.Float8E3M4Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E3M4'
property typeid

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

class iree.compiler.dialects.scf.Float8E4M3B11FNUZType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E4M3B11FNUZ'
property typeid

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

class iree.compiler.dialects.scf.Float8E4M3FNType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E4M3FN'
property typeid

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

class iree.compiler.dialects.scf.Float8E4M3FNUZType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E4M3FNUZ'
property typeid

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

class iree.compiler.dialects.scf.Float8E4M3Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E4M3'
property typeid

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

class iree.compiler.dialects.scf.Float8E5M2FNUZType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E5M2FNUZ'
property typeid

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

class iree.compiler.dialects.scf.Float8E5M2Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E5M2'
property typeid

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

class iree.compiler.dialects.scf.Float8E8M0FNUType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E8M0FNU'
property typeid

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

class iree.compiler.dialects.scf.FloatAttr(*args, **kwargs)
attr_name = 'builtin.float'
get = <nanobind.nb_func object>
get_f32 = <nanobind.nb_func object>
get_f64 = <nanobind.nb_func object>
get_unchecked = <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.dialects.scf.FloatTF32Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.tf32'
property typeid

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

class iree.compiler.dialects.scf.FloatType(*args, **kwargs)
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.dialects.scf.ForOp(lower_bound, upper_bound, step, iter_args: Optional[Union[iree.compiler._mlir_libs._mlir.ir.Operation, iree.compiler._mlir_libs._mlir.ir.OpView, Sequence[iree.compiler._mlir_libs._mlir.ir.Value]]] = None, *, loc=None, ip=None)

Specialization for the SCF for op class.

property body

Returns the body (block) of the loop.

property induction_variable

Returns the induction variable of the loop.

property inner_iter_args

Returns the loop-carried arguments usable within the loop.

To obtain the loop-carried operands, use iter_args.

class iree.compiler.dialects.scf.ForOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'scf.for'
property initArgs: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property lowerBound: iree.compiler._mlir_libs._mlir.ir.Value
property step: iree.compiler._mlir_libs._mlir.ir.Value
property unsignedCmp: bool
property upperBound: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.scf.ForallOp(lower_bounds: Sequence[Union[iree.compiler._mlir_libs._mlir.ir.Operation, iree.compiler._mlir_libs._mlir.ir.OpView, iree.compiler._mlir_libs._mlir.ir.Value, int]], upper_bounds: Sequence[Union[iree.compiler._mlir_libs._mlir.ir.Operation, iree.compiler._mlir_libs._mlir.ir.OpView, iree.compiler._mlir_libs._mlir.ir.Value, int]], steps: Sequence[Union[iree.compiler._mlir_libs._mlir.ir.Value, int]], shared_outs: Optional[Union[iree.compiler._mlir_libs._mlir.ir.Operation, iree.compiler._mlir_libs._mlir.ir.OpView, Sequence[iree.compiler._mlir_libs._mlir.ir.Value]]] = None, *, mapping=None, loc=None, ip=None)

Specialization for the SCF forall op class.

property body: iree.compiler._mlir_libs._mlir.ir.Block

Returns the body (block) of the loop.

property induction_variables: iree.compiler._mlir_libs._mlir.ir.BlockArgumentList

Returns the induction variables usable within the loop.

property inner_iter_args: iree.compiler._mlir_libs._mlir.ir.BlockArgumentList

Returns the loop-carried arguments usable within the loop.

To obtain the loop-carried operands, use iter_args.

property rank: int

Returns the number of induction variables the loop has.

terminator() iree.compiler.dialects._scf_ops_gen.InParallelOp

Returns the loop terminator if it exists. Otherwise, creates a new one.

class iree.compiler.dialects.scf.ForallOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'scf.forall'
property dynamicLowerBound: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property dynamicStep: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property dynamicUpperBound: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property mapping: Optional[iree.compiler._mlir_libs._mlir.ir.ArrayAttr]
property outputs: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property staticLowerBound: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property staticStep: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property staticUpperBound: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
class iree.compiler.dialects.scf.FunctionType(*args, **kwargs)
get = <nanobind.nb_func object>
property inputs

Returns the list of input types in the FunctionType.

property results

Returns the list of result types in the FunctionType.

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.function'
property typeid

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

class iree.compiler.dialects.scf.IfOp(cond, results_=None, *, has_else=False, loc=None, ip=None)

Specialization for the SCF if op class.

property else_block: Optional[iree.compiler._mlir_libs._mlir.ir.Block]

Returns the else block of the if operation.

property then_block: iree.compiler._mlir_libs._mlir.ir.Block

Returns the then block of the if operation.

class iree.compiler.dialects.scf.IfOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'scf.if'
property condition: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]
class iree.compiler.dialects.scf.InParallelOp(loc=None, ip=None)

Specialization of the SCF forall.in_parallel op class.

property block: iree.compiler._mlir_libs._mlir.ir.Block
class iree.compiler.dialects.scf.InParallelOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'scf.forall.in_parallel'
class iree.compiler.dialects.scf.IndexSwitchOp(results, arg, cases, case_body_builder=None, default_body_builder=None, loc=None, ip=None)

The scf.index_switch is a control-flow operation that branches to one of the given regions based on the values of the argument and the cases. The argument is always of type index.

The operation always has a “default” region and any number of case regions denoted by integer constants. Control-flow transfers to the case region whose constant value equals the value of the argument. If the argument does not equal any of the case values, control-flow transfer to the “default” region.

Example:

```mlir %0 = scf.index_switch %arg0 : index -> i32 case 2 {

%1 = arith.constant 10 : i32 scf.yield %1 : i32

} case 5 {

%2 = arith.constant 20 : i32 scf.yield %2 : i32

} default {

%3 = arith.constant 30 : i32 scf.yield %3 : i32

case_block(i: int) iree.compiler._mlir_libs._mlir.ir.Block
property case_blocks: Sequence[iree.compiler._mlir_libs._mlir.ir.Block]
case_region(i: int) iree.compiler._mlir_libs._mlir.ir.Region
property case_regions: Sequence[iree.compiler._mlir_libs._mlir.ir.Region]
property default_block: iree.compiler._mlir_libs._mlir.ir.Block
property default_region: iree.compiler._mlir_libs._mlir.ir.Region
class iree.compiler.dialects.scf.IndexSwitchOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'scf.index_switch'
property arg: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IndexType]
property cases: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
class iree.compiler.dialects.scf.IndexType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.index'
property typeid

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

class iree.compiler.dialects.scf.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.dialects.scf.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.dialects.scf.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.dialects.scf.IntegerAttr(*args, **kwargs)
attr_name = 'builtin.integer'
get = <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.dialects.scf.IntegerSet
property constraints

(self) -> mlir::python::mlir::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.dialects.scf.IntegerSetAttr(*args, **kwargs)
attr_name = 'builtin.integer_set'
get = <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.dialects.scf.IntegerSetConstraint
property expr

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

property is_eq

(self) -> bool

class iree.compiler.dialects.scf.IntegerSetConstraintList
class iree.compiler.dialects.scf.IntegerType(*args, **kwargs)
SIGNED = 1
SIGNLESS = 0
enum Signedness(value)

Valid values are as follows:

SIGNLESS = Signedness.SIGNLESS
SIGNED = Signedness.SIGNED
UNSIGNED = Signedness.UNSIGNED
UNSIGNED = 2
get = <nanobind.nb_func object>
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

property signedness

(self) -> iree.compiler._mlir_libs._mlir.ir.IntegerType.Signedness

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.integer'
property typeid

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

property width

Returns the width of the integer type

class iree.compiler.dialects.scf.Iterable
class iree.compiler.dialects.scf.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.dialects.scf.MLIRError(message, error_diagnostics)
An exception with diagnostic information. Has the following fields:

message: str error_diagnostics: List[ir.DiagnosticInfo]

class iree.compiler.dialects.scf.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>
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>
type_name = 'builtin.memref'
property typeid

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

class iree.compiler.dialects.scf.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.dialects.scf.NamedAttribute
property attr

The underlying generic attribute of the NamedAttribute binding.

property name

The name of the NamedAttribute binding.

class iree.compiler.dialects.scf.NoneType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.none'
property typeid

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

class iree.compiler.dialects.scf.OpAdaptor(*args, **kwargs)
property attributes

Returns the attributes of the adaptor.

property operands

Returns the operands of the adaptor.

class iree.compiler.dialects.scf.OpAttributeMap
get

Gets an attribute by name or the default value, if it does not exist.

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.dialects.scf.OpOperand
property operand_number

Returns the operand number in the owning operation.

property owner

Returns the operation that owns this operand.

class iree.compiler.dialects.scf.OpOperandIterator
class iree.compiler.dialects.scf.OpOperandList
class iree.compiler.dialects.scf.OpResult(*args, **kwargs)
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.dialects.scf.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.dialects.scf.OpSuccessors
class iree.compiler.dialects.scf.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.dialects.scf.OpaqueAttr(*args, **kwargs)
attr_name = 'builtin.opaque'
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>
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.dialects.scf.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>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.opaque'
property typeid

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

class iree.compiler.dialects.scf.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.dialects.scf.OperationIterator
class iree.compiler.dialects.scf.OperationList
class iree.compiler.dialects.scf.ParallelOp(results_, lowerBound, upperBound, step, initVals, *, loc=None, ip=None)

The scf.parallel operation represents a loop nest taking 4 groups of SSA values as operands that represent the lower bounds, upper bounds, steps and initial values, respectively. The operation defines a variadic number of SSA values for its induction variables. It has one region capturing the loop body. The induction variables are represented as an argument of this region. These SSA values always have type index, which is the size of the machine word. The steps are values of type index, required to be positive. The lower and upper bounds specify a half-open range: the range includes the lower bound but does not include the upper bound. The initial values have the same types as results of scf.parallel. If there are no results, the keyword init can be omitted.

Semantically we require that the iteration space can be iterated in any order, and the loop body can be executed in parallel. If there are data races, the behavior is undefined.

The parallel loop operation supports reduction of values produced by individual iterations into a single result. This is modeled using the scf.reduce terminator operation (see scf.reduce for details). The i-th result of an scf.parallel operation is associated with the i-th initial value operand, the i-th operand of the scf.reduce operation (the value to be reduced) and the i-th region of the scf.reduce operation (the reduction function). Consequently, we require that the number of results of an scf.parallel op matches the number of initial values and the the number of reductions in the scf.reduce terminator.

The body region must contain exactly one block that terminates with a scf.reduce operation. If an scf.parallel op has no reductions, the terminator has no operands and no regions. The scf.parallel parser will automatically insert the terminator for ops that have no reductions if it is absent.

Example:

```mlir %init = arith.constant 0.0 : f32 %r:2 = scf.parallel (%iv) = (%lb) to (%ub) step (%step) init (%init, %init)

-> f32, f32 {

%elem_to_reduce1 = load %buffer1[%iv] : memref<100xf32> %elem_to_reduce2 = load %buffer2[%iv] : memref<100xf32> scf.reduce(%elem_to_reduce1, %elem_to_reduce2 : f32, f32) {

^bb0(%lhsf32, %rhs: f32):

%res = arith.addf %lhs, %rhs : f32 scf.reduce.return %res : f32

}, {
^bb0(%lhsf32, %rhs: f32):

%res = arith.mulf %lhs, %rhs : f32 scf.reduce.return %res : f32

}

Adaptor

alias of iree.compiler.dialects._scf_ops_gen.ParallelOpAdaptor

OPERATION_NAME = 'scf.parallel'
property initVals: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property lowerBound: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property region: iree.compiler._mlir_libs._mlir.ir.Region
property results_: iree.compiler._mlir_libs._mlir.ir.OpResultList
property step: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property upperBound: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.scf.ParallelOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'scf.parallel'
property initVals: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property lowerBound: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property step: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property upperBound: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.scf.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>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.tensor'
property typeid

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

class iree.compiler.dialects.scf.ReduceOp(operands_, num_reductions, *, loc=None, ip=None)

The scf.reduce operation is the terminator for scf.parallel operations. It can model an arbitrary number of reductions. It has one region per reduction. Each region has one block with two arguments which have the same type as the corresponding operand of scf.reduce. The operands of the op are the values that should be reduce; one value per reduction.

The i-th reduction (i.e., the i-th region and the i-th operand) corresponds the i-th initial value and the i-th result of the enclosing scf.parallel op.

The scf.reduce operation contains regions whose entry blocks expect two arguments of the same type as the corresponding operand. As the iteration order of the enclosing parallel loop and hence reduction order is unspecified, the results of the reductions may be non-deterministic unless the reductions are associative and commutative.

The result of a reduction region (scf.reduce.return operand) must have the same type as the corresponding scf.reduce operand and the corresponding scf.parallel initial value.

Example:

```mlir %operand = arith.constant 1.0 : f32 scf.reduce(%operand : f32) {

^bb0(%lhsf32, %rhs: f32):

%res = arith.addf %lhs, %rhs : f32 scf.reduce.return %res : f32

Adaptor

alias of iree.compiler.dialects._scf_ops_gen.ReduceOpAdaptor

OPERATION_NAME = 'scf.reduce'
property operands_: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property reductions: iree.compiler._mlir_libs._mlir.ir.RegionSequence
class iree.compiler.dialects.scf.ReduceOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'scf.reduce'
property operands_: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.scf.ReduceReturnOp(result, *, loc=None, ip=None)

The scf.reduce.return operation is a special terminator operation for the block inside scf.reduce regions. It terminates the region. It should have the same operand type as the corresponding operand of the enclosing scf.reduce op.

Example:

`mlir scf.reduce.return %res : f32 `

Adaptor

alias of iree.compiler.dialects._scf_ops_gen.ReduceReturnOpAdaptor

OPERATION_NAME = 'scf.reduce.return'
property result: iree.compiler._mlir_libs._mlir.ir.Value

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.scf.ReduceReturnOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'scf.reduce.return'
property result: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.scf.Region
property blocks

Returns a forward-optimized sequence of blocks.

property owner

Returns the operation owning this region.

class iree.compiler.dialects.scf.RegionIterator
class iree.compiler.dialects.scf.RegionSequence
class iree.compiler.dialects.scf.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.

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.dialects.scf.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.dialects.scf.StridedLayoutAttr(*args, **kwargs)
attr_name = 'builtin.strided_layout'
get = <nanobind.nb_func object>
get_fully_dynamic = <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.dialects.scf.StringAttr(*args, **kwargs)
attr_name = 'builtin.string'
get = <nanobind.nb_func object>
get_typed = <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.dialects.scf.SymbolRefAttr(*args, **kwargs)
attr_name = 'builtin.symbol_ref'
get = <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.dialects.scf.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.dialects.scf.ThreadPool(*args, **kwargs)
get_max_concurrency

Returns the maximum number of threads in the pool.

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

Returns the pos-th type in the tuple type.

property num_types

Returns the number of types contained in a tuple.

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.tuple'
property typeid

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

class iree.compiler.dialects.scf.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.dialects.scf.TypeAttr(*args, **kwargs)
attr_name = 'builtin.type'
get = <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.dialects.scf.TypeID
class iree.compiler.dialects.scf.UnitAttr(*args, **kwargs)
attr_name = 'builtin.unit'
get = <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.dialects.scf.UnrankedMemRefType(*args, **kwargs)
get = <nanobind.nb_func object>
get_unchecked = <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>
type_name = 'builtin.unranked_memref'
property typeid

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

class iree.compiler.dialects.scf.UnrankedTensorType(*args, **kwargs)
get = <nanobind.nb_func object>
get_unchecked = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.unranked_tensor'
property typeid

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

class iree.compiler.dialects.scf.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.dialects.scf.VectorType(*args, **kwargs)
get = <nanobind.nb_func object>
get_unchecked = <nanobind.nb_func object>
property scalable

(self) -> bool

property scalable_dims

(self) -> list[bool]

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.vector'
property typeid

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

enum iree.compiler.dialects.scf.WalkOrder(value)

Valid values are as follows:

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

Valid values are as follows:

ADVANCE = WalkResult.ADVANCE
INTERRUPT = WalkResult.INTERRUPT
SKIP = WalkResult.SKIP
class iree.compiler.dialects.scf.WhileOp(results_, inits, *, loc=None, ip=None)

This operation represents a generic “while”/”do-while” loop that keeps iterating as long as a condition is satisfied. There is no restriction on the complexity of the condition. It consists of two regions (with single block each): “before” region and “after” region. The names of regions indicates whether they execute before or after the condition check. Therefore, if the main loop payload is located in the “before” region, the operation is a “do-while” loop. Otherwise, it is a “while” loop.

The “before” region terminates with a special operation, scf.condition, that accepts as its first operand an i1 value indicating whether to proceed to the “after” region (value is true) or not. The two regions communicate by means of region arguments. Initially, the “before” region accepts as arguments the operands of the scf.while operation and uses them to evaluate the condition. It forwards the trailing, non-condition operands of the scf.condition terminator either to the “after” region if the control flow is transferred there or to results of the scf.while operation otherwise. The “after” region takes as arguments the values produced by the “before” region and uses scf.yield to supply new arguments for the “before” region, into which it transfers the control flow unconditionally.

A simple “while” loop can be represented as follows.

```mlir %res = scf.while (%arg1 = %init1) : (f32) -> f32 {

// “Before” region. // In a “while” loop, this region computes the condition. %condition = call @evaluate_condition(%arg1) : (f32) -> i1

// Forward the argument (as result or “after” region argument). scf.condition(%condition) %arg1 : f32

} do { ^bb0(%arg2: f32):

// “After” region. // In a “while” loop, this region is the loop body. %next = call @payload(%arg2) : (f32) -> f32

// Forward the new value to the “before” region. // The operand types must match the types of the scf.while operands. scf.yield %next : f32

A simple “do-while” loop can be represented by reducing the “after” block to a simple forwarder.

```mlir %res = scf.while (%arg1 = %init1) : (f32) -> f32 {

// “Before” region. // In a “do-while” loop, this region contains the loop body. %next = call @payload(%arg1) : (f32) -> f32

// And also evaluates the condition. %condition = call @evaluate_condition(%arg1) : (f32) -> i1

// Loop through the “after” region. scf.condition(%condition) %next : f32

} do { ^bb0(%arg2: f32):

// “After” region. // Forwards the values back to “before” region unmodified. scf.yield %arg2 : f32

Note that the types of region arguments need not to match with each other. The op expects the operand types to match with argument types of the “before” region; the result types to match with the trailing operand types of the terminator of the “before” region, and with the argument types of the “after” region. The following scheme can be used to share the results of some operations executed in the “before” region with the “after” region, avoiding the need to recompute them.

```mlir %res = scf.while (%arg1 = %init1) : (f32) -> i64 {

// One can perform some computations, e.g., necessary to evaluate the // condition, in the “before” region and forward their results to the // “after” region. %shared = call @shared_compute(%arg1) : (f32) -> i64

// Evaluate the condition. %condition = call @evaluate_condition(%arg1, %shared) : (f32, i64) -> i1

// Forward the result of the shared computation to the “after” region. // The types must match the arguments of the “after” region as well as // those of the scf.while results. scf.condition(%condition) %shared : i64

} do { ^bb0(%arg2: i64) {

// Use the partial result to compute the rest of the payload in the // “after” region. %res = call @payload(%arg2) : (i64) -> f32

// Forward the new value to the “before” region. // The operand types must match the types of the scf.while operands. scf.yield %res : f32

The custom syntax for this operation is as follows.

``` op ::= scf.while assignments : function-type region do region

attributes attribute-dict

initializer ::= /* empty */ | ( assignment-list ) assignment-list ::= assignment | assignment , assignment-list assignment ::= ssa-value = ssa-value ```

Adaptor

alias of iree.compiler.dialects._scf_ops_gen.WhileOpAdaptor

OPERATION_NAME = 'scf.while'
property after: iree.compiler._mlir_libs._mlir.ir.Region
property before: iree.compiler._mlir_libs._mlir.ir.Region
property inits: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property results_: iree.compiler._mlir_libs._mlir.ir.OpResultList
class iree.compiler.dialects.scf.WhileOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'scf.while'
property inits: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.scf.YieldOp(results_, *, loc=None, ip=None)

The scf.yield operation yields an SSA value from the SCF dialect op region and terminates the regions. The semantics of how the values are yielded is defined by the parent operation. If scf.yield has any operands, the operands must match the parent operation’s results. If the parent operation defines no values, then the scf.yield may be left out in the custom syntax and the builders will insert one implicitly. Otherwise, it has to be present in the syntax to indicate which values are yielded.

Adaptor

alias of iree.compiler.dialects._scf_ops_gen.YieldOpAdaptor

OPERATION_NAME = 'scf.yield'
property results_: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.scf.YieldOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'scf.yield'
property results_: iree.compiler._mlir_libs._mlir.ir.OpOperandList
iree.compiler.dialects.scf.append_load_on_create_dialect(dialect: str)
iree.compiler.dialects.scf.condition(condition, args, *, loc=None, ip=None) iree.compiler.dialects._scf_ops_gen.ConditionOp
iree.compiler.dialects.scf.constant(result: iree.compiler._mlir_libs._mlir.ir.Type, value: Union[int, float, iree.compiler._mlir_libs._mlir.ir.Attribute, array.array], *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.Value
iree.compiler.dialects.scf.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.dialects.scf.execute_region(result, *, no_inline=None, loc=None, ip=None) Union[iree.compiler._mlir_libs._mlir.ir.OpResult, iree.compiler._mlir_libs._mlir.ir.OpResultList, iree.compiler.dialects._scf_ops_gen.ExecuteRegionOp]
iree.compiler.dialects.scf.for_(start, stop=None, step=None, iter_args: Optional[Sequence[iree.compiler._mlir_libs._mlir.ir.Value]] = None, *, loc=None, ip=None)
iree.compiler.dialects.scf.forall(results_, dynamic_lower_bound, dynamic_upper_bound, dynamic_step, static_lower_bound, static_upper_bound, static_step, outputs, *, mapping=None, loc=None, ip=None) Union[iree.compiler._mlir_libs._mlir.ir.OpResult, iree.compiler._mlir_libs._mlir.ir.OpResultList, iree.compiler.dialects._scf_ops_gen.ForallOp]
iree.compiler.dialects.scf.forall_in_parallel(*, loc=None, ip=None) iree.compiler.dialects._scf_ops_gen.InParallelOp
iree.compiler.dialects.scf.get_dialect_registry()
iree.compiler.dialects.scf.get_load_on_create_dialects()
iree.compiler.dialects.scf.if_(results_, condition, *, loc=None, ip=None) Union[iree.compiler._mlir_libs._mlir.ir.OpResult, iree.compiler._mlir_libs._mlir.ir.OpResultList, iree.compiler.dialects._scf_ops_gen.IfOp]
iree.compiler.dialects.scf.index_switch(results, arg, cases, case_body_builder=None, default_body_builder=None, loc=None, ip=None) Union[iree.compiler._mlir_libs._mlir.ir.OpResult, iree.compiler._mlir_libs._mlir.ir.OpResultList, iree.compiler.dialects.scf.IndexSwitchOp]
iree.compiler.dialects.scf.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.dialects.scf.parallel(results_, lower_bound, upper_bound, step, init_vals, *, loc=None, ip=None) Union[iree.compiler._mlir_libs._mlir.ir.OpResult, iree.compiler._mlir_libs._mlir.ir.OpResultList, iree.compiler.dialects._scf_ops_gen.ParallelOp]
iree.compiler.dialects.scf.reduce(operands_, num_reductions, *, loc=None, ip=None) iree.compiler.dialects._scf_ops_gen.ReduceOp
iree.compiler.dialects.scf.reduce_return(result, *, loc=None, ip=None) iree.compiler.dialects._scf_ops_gen.ReduceReturnOp
iree.compiler.dialects.scf.register_attribute_builder(kind, replace=False)
iree.compiler.dialects.scf.while_(results_, inits, *, loc=None, ip=None) Union[iree.compiler._mlir_libs._mlir.ir.OpResult, iree.compiler._mlir_libs._mlir.ir.OpResultList, iree.compiler.dialects._scf_ops_gen.WhileOp]
iree.compiler.dialects.scf.yield_(results_, *, loc=None, ip=None) iree.compiler.dialects._scf_ops_gen.YieldOp

shape dialect

class iree.compiler.dialects.shape.AddOp(lhs, rhs, *, results=None, loc=None, ip=None)

Adds two sizes or indices. If either operand is an error it will be propagated to the result. The operands can be of type size or index. If at least one of the operands can hold an error, i.e. if it is of type size, the result must be of type size. If error propagation is not possible because both operands are of type index then the result may be of type size or index.

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.AddOpAdaptor

OPERATION_NAME = 'shape.add'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.AddOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.add'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.AnyOp(result, inputs, *, loc=None, ip=None)

This operation takes multiple input shapes or extent tensors and returns some combination of their dimensions. This can be best seen with examples below.

The result is undefined, but still side-effect free, in cases where the inputs have differing ranks or differ in extents of shared dimensions.

Example: `mlir %s0 = shape.any [2,?], [?,3] // [2,3] %s1 = shape.any [?,?], [1,2] // [1,2] `

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.AnyOpAdaptor

OPERATION_NAME = 'shape.any'
property inputs: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.shape.AnyOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.any'
property inputs: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.shape.AssumingAllOp(inputs, *, results=None, loc=None, ip=None)

Used to simplify constraints as any single failing precondition is enough to prevent execution.

“assuming” operations represent an execution order restriction to the compiler, information for dependent code to rely on (by assuming), and nothing else. They should not exist after a program is fully lowered and ready to execute.

Example: `mlir %w0 = shape.cstr_broadcastable [2,2], [3,1,2] // Passing %w1 = shape.cstr_broadcastable [2,2], [3,2] // Failure %w2 = shape.cstr_eq [1,2], [1,2], [1,2] // Passing %wf = shape.assuming_all %w0, %w1 // Failure %wt = shape.assuming_all %w0, %w2 // Passing `

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.AssumingAllOpAdaptor

OPERATION_NAME = 'shape.assuming_all'
property inputs: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.shape.AssumingAllOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.assuming_all'
property inputs: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.shape.AssumingOp(results_, witness, *, loc=None, ip=None)

Executes the region assuming all witnesses are true.

“assuming” operations represent an execution order restriction to the compiler, information for dependent code to rely on (by assuming), and nothing else. They should not exist after a program is fully lowered and ready to execute.

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.AssumingOpAdaptor

OPERATION_NAME = 'shape.assuming'
property doRegion: iree.compiler._mlir_libs._mlir.ir.Region
property results_: iree.compiler._mlir_libs._mlir.ir.OpResultList
property witness: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.AssumingOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.assuming'
property witness: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.AssumingYieldOp(operands_, *, loc=None, ip=None)

This yield operation represents a return operation within the shape.assuming operation region. The operation takes variable number of operands and produces no results. The operand number and types must match the number and types of parent shape.assuming results.

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.AssumingYieldOpAdaptor

OPERATION_NAME = 'shape.assuming_yield'
property operands_: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.shape.AssumingYieldOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.assuming_yield'
property operands_: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.shape.BroadcastOp(result, shapes, *, error=None, loc=None, ip=None)

Returns the broadcasted shape for input shapes or extent tensors. The rest of this description is simplified for the 2 input case but can be extended to more inputs. Both operands can be of type shape.shape or tensor<?xindex>. The result is of type shape.shape and, if both operands are tensors, may be of type tensor<?xindex>.

If the two operand shapes are of different rank the smaller one is padded with 1’s from the left. The resulting broadcasted shape is then defined as

result[i] = lhs[i] if lhs[i] == rhs[i]

= lhs[i] if rhs[i] == 1 = rhs[i] if lhs[i] == 1.

In case the resulting shape is undefined, i.e. if corresponding extents are different from each other but none is 1, the result is an error shape. Likewise error values are propagated if any of the operands holds an error value. If the result type is an extent tensor (and can therefore not hold the error value) the behavior may be undefined. The optional string attribute can be used to describe the error case.

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.BroadcastOpAdaptor

OPERATION_NAME = 'shape.broadcast'
property error: Optional[iree.compiler._mlir_libs._mlir.ir.StringAttr]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property shapes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.shape.BroadcastOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.broadcast'
property error: Optional[iree.compiler._mlir_libs._mlir.ir.StringAttr]
property shapes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.shape.ConcatOp(result, lhs, rhs, *, loc=None, ip=None)

Creates a shape whose dimensions consist of first the dimensions from lhs followed by the dimensions of rhs.

Example: concat([2,3], [4,5]) -> [2,3,4,5] concat([], []) -> [] concat([], [4,5,6]) -> [4,5,6]

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.ConcatOpAdaptor

OPERATION_NAME = 'shape.concat'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.ConcatOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.concat'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.ConstShapeOp(shape, *, results=None, loc=None, ip=None)

Creates a constant shape or extent tensor. The individual extents are given as the shape attribute. The number of these values equals the shape’s rank.

`mlir %0 = shape.const_shape [] : !shape.shape %1 = shape.const_shape [1, 2, 3] : !shape.shape %2 = shape.const_shape [4, 5, 6] : tensor<3xindex> `

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.ConstShapeOpAdaptor

OPERATION_NAME = 'shape.const_shape'
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property shape: iree.compiler._mlir_libs._mlir.ir.DenseIntElementsAttr
class iree.compiler.dialects.shape.ConstShapeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.const_shape'
property shape: iree.compiler._mlir_libs._mlir.ir.DenseIntElementsAttr
class iree.compiler.dialects.shape.ConstSizeOp(value, *, results=None, loc=None, ip=None)

Creates a shape.size type representing the constant size given by value.

`mlir %x = shape.const_size 10 `

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.ConstSizeOpAdaptor

OPERATION_NAME = 'shape.const_size'
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property value: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
class iree.compiler.dialects.shape.ConstSizeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.const_size'
property value: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
class iree.compiler.dialects.shape.ConstWitnessOp(passing, *, results=None, loc=None, ip=None)

This operation represents a statically known witness result. This can be often used to canonicalize/fold constraint and assuming code that will always pass.

`mlir %0 = shape.const_shape [1,2,3] %1 = shape.const_shape [1,2,3] %w0 = shape.cstr_eq(%0, %1) // Can be folded to "const_witness true" %w1 = shape.const_witness true %w2 = shape.assuming_all(%w0, %w2) // Can be folded to "const_witness true" `

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.ConstWitnessOpAdaptor

OPERATION_NAME = 'shape.const_witness'
property passing: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.shape.ConstWitnessOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.const_witness'
property passing: iree.compiler._mlir_libs._mlir.ir.BoolAttr
class iree.compiler.dialects.shape.CstrBroadcastableOp(shapes, *, results=None, loc=None, ip=None)

Given input shapes or extent tensors, return a witness specifying if they are broadcastable. This broadcastable follows the same logic as what shape.broadcast documents.

“cstr” operations represent runtime assertions.

Example: `mlir %w0 = shape.cstr_broadcastable [2,2], [3,1,2] // Passing %w1 = shape.cstr_broadcastable [2,2], [3,2] // Failure `

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.CstrBroadcastableOpAdaptor

OPERATION_NAME = 'shape.cstr_broadcastable'
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property shapes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.shape.CstrBroadcastableOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.cstr_broadcastable'
property shapes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.shape.CstrEqOp(shapes, *, results=None, loc=None, ip=None)

Given 1 or more input shapes, determine if all shapes are the exact same.

“cstr” operations represent runtime assertions.

Example: `mlir %w0 = shape.cstr_eq [1,2], [1,2], [1,2] // Passing %w1 = shape.cstr_eq [2,2], [1,2] // Failure `

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.CstrEqOpAdaptor

OPERATION_NAME = 'shape.cstr_eq'
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property shapes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.shape.CstrEqOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.cstr_eq'
property shapes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.shape.CstrRequireOp(pred, msg, *, results=None, loc=None, ip=None)

Represents a runtime assertion that an i1 is true. It returns a !shape.witness to order this assertion.

For simplicity, prefer using other cstr_* ops if they are available for a given constraint.

Example: `mlir %bool = ... %w0 = shape.cstr_require %bool, "msg" // Passing if `%bool` is true. `

Since this op can be used to express many different possible assertions (depending on whatever computation calculated pred), the msg should clarify the nature of the assertion for users.

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.CstrRequireOpAdaptor

OPERATION_NAME = 'shape.cstr_require'
property msg: iree.compiler._mlir_libs._mlir.ir.StringAttr
property pred: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.shape.CstrRequireOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.cstr_require'
property msg: iree.compiler._mlir_libs._mlir.ir.StringAttr
property pred: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IntegerType]
class iree.compiler.dialects.shape.DebugPrintOp(output, input, *, loc=None, ip=None)

Prints the input dim or shape and passes through input.

Note: This is intended for testing and debugging only.

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.DebugPrintOpAdaptor

OPERATION_NAME = 'shape.debug_print'
property input: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.shape.DebugPrintOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.debug_print'
property input: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.DimOp(value, index, *, results=None, loc=None, ip=None)

Gets the extent indexed by dim from the shape of the value operand. If the index is error or out-of-bound then it returns an invalid size if the return type carries error information else the behavior is undefined.

This is a convenience op that performs the equivalent of getting the extent of a shape (e.g., dim(x, i) == get_extent(shape_of(x), i)).

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.DimOpAdaptor

OPERATION_NAME = 'shape.dim'
property extent: iree.compiler._mlir_libs._mlir.ir.OpResult
property index: iree.compiler._mlir_libs._mlir.ir.Value
property value: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.DimOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.dim'
property index: iree.compiler._mlir_libs._mlir.ir.Value
property value: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.DivOp(lhs, rhs, *, results=None, loc=None, ip=None)

Divides two sizes or indices. If either operand is an error it will be propagated to the result. The operands can be of type size or index. If at least one of the operands can hold an error, i.e. if it is of type size, the result must be of type size. If error propagation is not possible because both operands are of type index then the result may be of type size or index. If both operands and result are of type index, their runtime values could be negative. The result is rounded toward negative infinity, i.e. floor(lhs / rhs), such that

div(lhs, rhs) * rhs + mod(lhs, rhs) = lhs

always holds. If any of the values is of type size, the behavior for negative value is undefined.

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.DivOpAdaptor

OPERATION_NAME = 'shape.div'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.DivOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.div'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.FromExtentTensorOp(input, *, results=None, loc=None, ip=None)

Creates a shape from a 1D integral tensor of extents. The rank of the resulting shape equals the number of elements in the tensor, and the extents match the values of the elements.

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.FromExtentTensorOpAdaptor

OPERATION_NAME = 'shape.from_extent_tensor'
property input: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.shape.FromExtentTensorOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.from_extent_tensor'
property input: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
class iree.compiler.dialects.shape.FromExtentsOp(extents, *, results=None, loc=None, ip=None)

Creates a shape from multiple SSA values representing the extents of the shape.

`mlir // Rank 2 shape. %s0 = shape.from_extents %a, %b // Rank 0 shape. %s1 = shape.from_extents `

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.FromExtentsOpAdaptor

OPERATION_NAME = 'shape.from_extents'
property extents: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property shape: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.shape.FromExtentsOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.from_extents'
property extents: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.shape.FuncOp(sym_name, function_type, *, arg_attrs=None, res_attrs=None, sym_visibility=None, loc=None, ip=None)

An operation with a name containing a single SSACFG region which represents a shape transfer function or helper function for shape transfer function.

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.FuncOpAdaptor

OPERATION_NAME = 'shape.func'
property arg_attrs: Optional[iree.compiler._mlir_libs._mlir.ir.ArrayAttr]
property body: iree.compiler._mlir_libs._mlir.ir.Region
property function_type: iree.compiler._mlir_libs._mlir.ir.TypeAttr
property res_attrs: Optional[iree.compiler._mlir_libs._mlir.ir.ArrayAttr]
property sym_name: iree.compiler._mlir_libs._mlir.ir.StringAttr
property sym_visibility: Optional[iree.compiler._mlir_libs._mlir.ir.StringAttr]
class iree.compiler.dialects.shape.FuncOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.func'
property arg_attrs: Optional[iree.compiler._mlir_libs._mlir.ir.ArrayAttr]
property function_type: iree.compiler._mlir_libs._mlir.ir.TypeAttr
property res_attrs: Optional[iree.compiler._mlir_libs._mlir.ir.ArrayAttr]
property sym_name: iree.compiler._mlir_libs._mlir.ir.StringAttr
property sym_visibility: Optional[iree.compiler._mlir_libs._mlir.ir.StringAttr]
class iree.compiler.dialects.shape.FunctionLibraryOp(sym_name, mapping, *, sym_visibility=None, loc=None, ip=None)

Represents a list of shape functions and the ops whose shape transfer functions they represent.

Example:

```mlir shape.function_library {

func @same_result_shape(%arg: !shape.value_shape) -> !shape.shape {

%0 = shape_of %arg : !shape.value_shape -> !shape.shape return %0 : !shape.shape

}

} mapping {

std.atan = @same_result_shape

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.FunctionLibraryOpAdaptor

OPERATION_NAME = 'shape.function_library'
property body: iree.compiler._mlir_libs._mlir.ir.Region
property mapping: iree.compiler._mlir_libs._mlir.ir.DictAttr
property sym_name: iree.compiler._mlir_libs._mlir.ir.StringAttr
property sym_visibility: Optional[iree.compiler._mlir_libs._mlir.ir.StringAttr]
class iree.compiler.dialects.shape.FunctionLibraryOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.function_library'
property mapping: iree.compiler._mlir_libs._mlir.ir.DictAttr
property sym_name: iree.compiler._mlir_libs._mlir.ir.StringAttr
property sym_visibility: Optional[iree.compiler._mlir_libs._mlir.ir.StringAttr]
class iree.compiler.dialects.shape.GetExtentOp(shape, dim, *, results=None, loc=None, ip=None)

Gets the extent indexed by dim from the shape operand. If the shape is an error then it returns an invalid size.

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.GetExtentOpAdaptor

OPERATION_NAME = 'shape.get_extent'
property dim: iree.compiler._mlir_libs._mlir.ir.Value
property extent: iree.compiler._mlir_libs._mlir.ir.OpResult
property shape: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.GetExtentOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.get_extent'
property dim: iree.compiler._mlir_libs._mlir.ir.Value
property shape: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.IndexToSizeOp(arg, *, results=None, loc=None, ip=None)

Converts a standard index to a shape.size. This operation and its inverse, size_to_index, facilitate index conversion between the standard and the shape dialect.

The behavior is undefined for negative indices.

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.IndexToSizeOpAdaptor

OPERATION_NAME = 'shape.index_to_size'
property arg: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IndexType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.shape.IndexToSizeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.index_to_size'
property arg: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IndexType]
class iree.compiler.dialects.shape.IsBroadcastableOp(shapes, *, results=None, loc=None, ip=None)

Given multiple input shapes or extent tensors, return a predicate specifying if they are broadcastable. This broadcastable follows the same logic as what shape.broadcast documents.

Concretely, shape.is_broadcastable returning true implies that shape.broadcast will not give an error, and shape.cstr_broadcastable will not result in an assertion failure. Similarly, false implies an error or assertion failure.

Example: `mlir %true = shape.is_broadcastable [2,2], [3,1,2] %false = shape.is_broadcastable [2,2], [3,2] `

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.IsBroadcastableOpAdaptor

OPERATION_NAME = 'shape.is_broadcastable'
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.IntegerType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property shapes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.shape.IsBroadcastableOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.is_broadcastable'
property shapes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.shape.MaxOp(lhs, rhs, *, results=None, loc=None, ip=None)

Computes the elementwise maximum of two sizes or shapes with equal ranks. If either operand is an error, then an error will be propagated to the result. If the input types mismatch or the ranks do not match, then the result is an error.

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.MaxOpAdaptor

OPERATION_NAME = 'shape.max'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.MaxOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.max'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.MeetOp(arg0, arg1, *, error=None, results=None, loc=None, ip=None)

An operation that computes the least general shape or dim of input operands. This effectively asserts that corresponding static dimensions are equal. The behavior is to match each element of the shape/size and propagate the most restrictive information, returning an invalid shape if there are contradictory requirements. E.g., using pseudo code

` shape.meet([*], [*]) -> [*] shape.meet([*], [1, ?]) -> [1, ?] shape.meet([1, 2], [1, ?]) -> [1, 2] shape.meet([*], [1, 2]) -> [1, 2] shape.meet([], []) -> [] shape.meet([], [*]) -> [] shape.meet([], [?, ?]) -> [invalid] shape.meet([1, ?], [2, ?, ?]) -> [invalid] `

shape.meet also allows specifying an optional error string, that may be used to return an error to the user upon mismatch of dimensions.

`mlir %c = shape.meet %a, %b, error="<reason>" : !shape.shape, !shape.shape -> !shape.shape `

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.MeetOpAdaptor

OPERATION_NAME = 'shape.meet'
property arg0: iree.compiler._mlir_libs._mlir.ir.Value
property arg1: iree.compiler._mlir_libs._mlir.ir.Value
property error: Optional[iree.compiler._mlir_libs._mlir.ir.StringAttr]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.shape.MeetOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.meet'
property arg0: iree.compiler._mlir_libs._mlir.ir.Value
property arg1: iree.compiler._mlir_libs._mlir.ir.Value
property error: Optional[iree.compiler._mlir_libs._mlir.ir.StringAttr]
class iree.compiler.dialects.shape.MinOp(lhs, rhs, *, results=None, loc=None, ip=None)

Computes the elementwise minimum of two sizes or shapes with equal ranks. If either operand is an error, then an error will be propagated to the result. If the input types mismatch or the ranks do not match, then the result is an error.

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.MinOpAdaptor

OPERATION_NAME = 'shape.min'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.MinOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.min'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.MulOp(lhs, rhs, *, results=None, loc=None, ip=None)

Multiplies two sizes or indices. If either operand is an error it will be propagated to the result. The operands can be of type size or index. If at least one of the operands can hold an error, i.e. if it is of type size, the result must be of type size. If error propagation is not possible because both operands are of type index then the result may be of type size or index.

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.MulOpAdaptor

OPERATION_NAME = 'shape.mul'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.MulOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.mul'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.NumElementsOp(shape, *, results=None, loc=None, ip=None)

Returns the number of elements for a given shape which is the product of its extents. If the argument is of type shape then the result will be of type size and potential errors will be propagated. Otherwise, if the argument is and extent tensor tensor<?xindex> then the result will be of type index.

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.NumElementsOpAdaptor

OPERATION_NAME = 'shape.num_elements'
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property shape: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.NumElementsOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.num_elements'
property shape: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.RankOp(shape, *, results=None, loc=None, ip=None)

Returns the rank of the shape or extent tensor, i.e. the number of extents.

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.RankOpAdaptor

OPERATION_NAME = 'shape.rank'
property rank: iree.compiler._mlir_libs._mlir.ir.OpResult
property shape: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.RankOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.rank'
property shape: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.ReduceOp(result, shape, initVals, *, loc=None, ip=None)

An operation that takes as input a shape or extent tensor, and a number of initial values. This operation has a region that is applied repeatedly for every extent of the input. Starting with the initial values, the individual extents are then aggregated as defined by the associated region.

Conceptually this op performs the following reduction:

``` res[] = init; for (int i = 0, i < shape.rank(); i++) {

res = reduce(i, shape[i], res[0], …, res[n]);

Where reduce represents the region attached and the result of the reduce op is the last computed output of the reduce region. As an example, the number of elements can be computed as follows:

```mlir func.func @reduce(%shape : !shape.shape, %init : !shape.size) ->

!shape.size {

%num_elements = shape.reduce(%shape, %init) -> !shape.size {
^bb0(%index: index, %dim: !shape.size, %acc: !shape.size):
%updated_acc = “shape.mul”(%acc, %dim) :

(!shape.size, !shape.size) -> !shape.size

shape.yield %updated_acc : !shape.size

} return %num_elements : !shape.size

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.ReduceOpAdaptor

OPERATION_NAME = 'shape.reduce'
property initVals: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property region: iree.compiler._mlir_libs._mlir.ir.Region
property result: iree.compiler._mlir_libs._mlir.ir.OpResultList

Shortcut to get an op result if it has only one (throws an error otherwise).

property shape: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.ReduceOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.reduce'
property initVals: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property shape: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.ReturnOp(operands_, *, loc=None, ip=None)

The shape.return operation represents a return operation within a function. The operation takes variable number of operands and produces no results.

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.ReturnOpAdaptor

OPERATION_NAME = 'shape.return'
property operands_: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.shape.ReturnOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.return'
property operands_: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.shape.ShapeEqOp(shapes, *, results=None, loc=None, ip=None)

Takes one or more shape or extent tensor operands and determines whether they are equal. When extent tensors are compared to shapes they are regarded as their equivalent non-error shapes. Error shapes can be tested for equality like any other shape value, meaning that the error value is equal to itself.

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.ShapeEqOpAdaptor

OPERATION_NAME = 'shape.shape_eq'
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.IntegerType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property shapes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.shape.ShapeEqOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.shape_eq'
property shapes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.shape.ShapeOfOp(arg, *, results=None, loc=None, ip=None)

The operation takes a value or a shaped operand as an argument and it returns a shape or extent tensor.

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.ShapeOfOpAdaptor

OPERATION_NAME = 'shape.shape_of'
property arg: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.shape.ShapeOfOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.shape_of'
property arg: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.SizeToIndexOp(arg, *, results=None, loc=None, ip=None)

Converts a shape.size to a standard index. This operation and its inverse, index_to_size, facilitate index conversion between the standard and the shape dialect. The behavior is undefined for unknown and invalid arguments.

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.SizeToIndexOpAdaptor

OPERATION_NAME = 'shape.size_to_index'
property arg: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.IndexType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.shape.SizeToIndexOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.size_to_index'
property arg: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.SplitAtOp(head, tail, operand, index, *, loc=None, ip=None)

Splits a shape at a given dimension index, returning two shapes. If index is negative, it is treated as indexing from the back of the shape. This negative-handling behavior is important when handling unranked shapes, where the positive index is not necessarily knowable due to a dynamic number of leading dimensions. If the result is in extent tensor form out of bounds indices result in undefined behavior.

Examples: - split_at([4,5,6], index=0) -> [], [4,5,6] - split_at([4,5,6], index=1) -> [4], [5,6] - split_at([4,5,6], index=2) -> [4,5], [6] - split_at([4,5,6], index=3) -> [4,5,6], [] - split_at([4,5,6], index=4) -> error - split_at([4,5,6], index=-1) -> [4,5], [6] - split_at([4,5,6], index=-2) -> [4], [5,6] - split_at([4,5,6], index=-3) -> [], [4,5,6] - split_at([4,5,6], index=-4) -> error

Requires: - index is in the range [-rank(operand),rank(operand)]

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.SplitAtOpAdaptor

OPERATION_NAME = 'shape.split_at'
property head: iree.compiler._mlir_libs._mlir.ir.OpResult
property index: iree.compiler._mlir_libs._mlir.ir.Value
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property tail: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.shape.SplitAtOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.split_at'
property index: iree.compiler._mlir_libs._mlir.ir.Value
property operand: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.ToExtentTensorOp(result, input, *, loc=None, ip=None)

Converts a shape to a 1D integral tensor of extents. The number of elements in the tensor equals the rank of the shape, and the elements equal the extents of the shape.

If the shape represents an error, this op’s behavior is undefined.

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.ToExtentTensorOpAdaptor

OPERATION_NAME = 'shape.to_extent_tensor'
property input: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.shape.ToExtentTensorOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.to_extent_tensor'
property input: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.ValueAsShapeOp(result, arg, *, loc=None, ip=None)

The operations takes a ValueShape and returns a Shape corresponding to the value. If the input value cannot be shape (e.g., not a 1D tensor of integral value representing sizes) then this propagages the error shape. E.g.,

`mlir // The following %0 = arith.constant dense<[1,2]> : tensor<2xi32> %shape = shape.value_as_shape %0 : tensor<2xi32> -> !shape.shape // is equivalent to %shape' = shape.const_shape [1, 2] : !shape.shape `

This operation is the complement of shape_of wrt ValueShape values.

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.ValueAsShapeOpAdaptor

OPERATION_NAME = 'shape.value_as_shape'
property arg: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.shape.ValueAsShapeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.value_as_shape'
property arg: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.ValueOfOp(result, arg, *, loc=None, ip=None)

The operation takes !shape.value_shape, a.k.a. (value, shape) tuple as an argument, and returns its value. The behavior is undefined for unknown and invalid arguments.

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.ValueOfOpAdaptor

OPERATION_NAME = 'shape.value_of'
property arg: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.shape.ValueOfOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.value_of'
property arg: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.WithOp(operand, shape, *, results=None, loc=None, ip=None)

Returns ValueShape with the shape updated to match the shape operand. That is a new ValueShape tuple is created with value equal to operand’s value and shape equal to shape. If the ValueShape and given shape are non-conformant, then the returned ValueShape will represent an error of this mismatch. Similarly if either inputs are in an error state, then an error is propagated.

Usage:

%0 = shape.with_shape %1, %2 : tensor<…>, !shape.shape

This is used, for example, where one combines shape function calculations and/or call one shape function from another. E.g.,

```mlir func.func @shape_foobah(%a: !shape.value_shape,

%b: !shape.value_shape, %c: !shape.value_shape) -> !shape.shape {

%0 = call @shape_foo(%a, %b) :

(!shape.value_shape, !shape.value_shape) -> !shape.shape

%1 = shape.with_shape %b, %0 : !shape.value_shape, !shape.shape %2 = call @shape_bah(%c, %1) :

(!shape.value_shape, !shape.value_shape) -> !shape.shape

return %2 : !shape.shape

This op need not be a refinement of the shape. In non-error cases the input ValueShape’s value and shape are conformant and so too for the output, but the result may be less specified than operand’s shape as shape is merely used to construct the new ValueShape. If join behavior is desired then a join op should be used.

Adaptor

alias of iree.compiler.dialects._shape_ops_gen.WithOpAdaptor

OPERATION_NAME = 'shape.with_shape'
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property shape: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.WithOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.with_shape'
property operand: iree.compiler._mlir_libs._mlir.ir.Value
property shape: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.shape.YieldOp(operands_, *, loc=None, ip=None)
Adaptor

alias of iree.compiler.dialects._shape_ops_gen.YieldOpAdaptor

OPERATION_NAME = 'shape.yield'
property operands_: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.shape.YieldOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'shape.yield'
property operands_: iree.compiler._mlir_libs._mlir.ir.OpOperandList
iree.compiler.dialects.shape.add(lhs, rhs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.any(result, inputs, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.assuming(results_, witness, *, loc=None, ip=None) Union[iree.compiler._mlir_libs._mlir.ir.OpResult, iree.compiler._mlir_libs._mlir.ir.OpResultList, iree.compiler.dialects._shape_ops_gen.AssumingOp]
iree.compiler.dialects.shape.assuming_all(inputs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.assuming_yield(operands_, *, loc=None, ip=None) iree.compiler.dialects._shape_ops_gen.AssumingYieldOp
iree.compiler.dialects.shape.broadcast(result, shapes, *, error=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.concat(result, lhs, rhs, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.const_shape(shape, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.const_size(value, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.const_witness(passing, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.cstr_broadcastable(shapes, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.cstr_eq(shapes, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.cstr_require(pred, msg, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.debug_print(output, input, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.dim(value, index, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.div(lhs, rhs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.from_extent_tensor(input, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.from_extents(extents, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.func(sym_name, function_type, *, arg_attrs=None, res_attrs=None, sym_visibility=None, loc=None, ip=None) iree.compiler.dialects._shape_ops_gen.FuncOp
iree.compiler.dialects.shape.function_library(sym_name, mapping, *, sym_visibility=None, loc=None, ip=None) iree.compiler.dialects._shape_ops_gen.FunctionLibraryOp
iree.compiler.dialects.shape.get_extent(shape, dim, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.index_to_size(arg, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.is_broadcastable(shapes, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.max(lhs, rhs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.meet(arg0, arg1, *, error=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.min(lhs, rhs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.mul(lhs, rhs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.num_elements(shape, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.rank(shape, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.reduce(result, shape, init_vals, *, loc=None, ip=None) Union[iree.compiler._mlir_libs._mlir.ir.OpResult, iree.compiler._mlir_libs._mlir.ir.OpResultList, iree.compiler.dialects._shape_ops_gen.ReduceOp]
iree.compiler.dialects.shape.return_(operands_, *, loc=None, ip=None) iree.compiler.dialects._shape_ops_gen.ReturnOp
iree.compiler.dialects.shape.shape_eq(shapes, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.shape_of(arg, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.size_to_index(arg, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.split_at(head, tail, operand, index, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResultList
iree.compiler.dialects.shape.to_extent_tensor(result, input, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.value_as_shape(result, arg, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.value_of(result, arg, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.with_shape(operand, shape, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.shape.yield_(operands_, *, loc=None, ip=None) iree.compiler.dialects._shape_ops_gen.YieldOp

tensor dialect

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

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

property rhs

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

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

(self) -> int

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

(self) -> int

class iree.compiler.dialects.tensor.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>
maybe_downcast
shift_dims
shift_symbols
simplify_affine_expr = <nanobind.nb_func object>
class iree.compiler.dialects.tensor.AffineExprList
class iree.compiler.dialects.tensor.AffineFloorDivExpr(*args, **kwargs)
get = <nanobind.nb_func object>
class iree.compiler.dialects.tensor.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) -> mlir::python::mlir::PyAffineMapExprList

class iree.compiler.dialects.tensor.AffineMapAttr(*args, **kwargs)
attr_name = 'builtin.affine_map'
get = <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.dialects.tensor.AffineModExpr(*args, **kwargs)
get = <nanobind.nb_func object>
class iree.compiler.dialects.tensor.AffineMulExpr(*args, **kwargs)
get = <nanobind.nb_func object>
class iree.compiler.dialects.tensor.AffineSymbolExpr(*args, **kwargs)
get = <nanobind.nb_func object>
property position

(self) -> int

class iree.compiler.dialects.tensor.ArrayAttr(*args, **kwargs)
attr_name = 'builtin.array'
get = <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.dialects.tensor.ArrayAttributeIterator
class iree.compiler.dialects.tensor.AsmState(*args, **kwargs)
class iree.compiler.dialects.tensor.AttrBuilder
contains = <nanobind.nb_func object>
get = <nanobind.nb_func object>
insert = <nanobind.nb_func object>
class iree.compiler.dialects.tensor.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.dialects.tensor.BF16Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.bf16'
property typeid

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

class iree.compiler.dialects.tensor.BitcastOp(dest, source, *, loc=None, ip=None)

Bitcast a tensor from one type to another type of equivalent element width. If both are ranked, then the rank should be the same and static dimensions should match.

Example:

`mlir // Bitcast from unsigned to signed or signless integer. %2 = tensor.bitcast %1 : tensor<4xui32> to tensor<4xi32> `

Adaptor

alias of iree.compiler.dialects._tensor_ops_gen.BitcastOpAdaptor

OPERATION_NAME = 'tensor.bitcast'
property dest: iree.compiler._mlir_libs._mlir.ir.OpResult
property source: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tensor.BitcastOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tensor.bitcast'
property source: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tensor.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.dialects.tensor.BlockArgument(*args, **kwargs)
property arg_number

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

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.dialects.tensor.BlockArgumentList
property types

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

class iree.compiler.dialects.tensor.BlockIterator
class iree.compiler.dialects.tensor.BlockList
append

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

Returns

The created block.

class iree.compiler.dialects.tensor.BlockPredecessors
class iree.compiler.dialects.tensor.BlockSuccessors
class iree.compiler.dialects.tensor.BoolAttr(*args, **kwargs)
get = <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.dialects.tensor.CastOp(dest, source, *, loc=None, ip=None)

Convert a tensor from one type to an equivalent type without changing any data elements. The source and destination types must both be tensor types with the same element type. If both are ranked, then the rank should be the same and static dimensions should match. The operation is invalid if converting to a mismatching constant dimension.

Example:

```mlir // Convert from unknown rank to rank 2 with unknown dimension sizes. %2 = tensor.cast %1 : tensor<*xf32> to tensor<?x?xf32>

// Convert to a type with more known dimensions. %3 = tensor.cast %2 : tensor<?x?xf32> to tensor<4x?xf32>

// Discard static dimension and rank information. %4 = tensor.cast %3 : tensor<4x?xf32> to tensor<?x?xf32> %5 = tensor.cast %4 : tensor<?x?xf32> to tensor<*xf32> ```

Adaptor

alias of iree.compiler.dialects._tensor_ops_gen.CastOpAdaptor

OPERATION_NAME = 'tensor.cast'
property dest: iree.compiler._mlir_libs._mlir.ir.OpResult
property source: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tensor.CastOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tensor.cast'
property source: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tensor.CollapseShapeOp(result, src, reassociation, *, loc=None, ip=None)

The tensor.collapse_shape op produces a new tensor of lower (or equal) rank whose dimension sizes are a reassociation of the original src dimensions.

A reassociation is defined as a continuous grouping of dimensions and is represented by an array of DenseI64ArrayAttr attribute. The reassociation maps are applied to the operand shape to obtain the result shape.

Example:

```mlir // Dimension collapse (i, j) -> i’ and k -> k’ %b = tensor.collapse_shape %a [[0, 1], [2]]

: tensor<?x?x?xf32> into tensor<?x?xf32>

```

Adaptor

alias of iree.compiler.dialects._tensor_ops_gen.CollapseShapeOpAdaptor

OPERATION_NAME = 'tensor.collapse_shape'
property reassociation: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property src: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
class iree.compiler.dialects.tensor.CollapseShapeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tensor.collapse_shape'
property reassociation: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property src: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
class iree.compiler.dialects.tensor.ComplexType(*args, **kwargs)
property element_type

Returns element type.

get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.complex'
property typeid

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

class iree.compiler.dialects.tensor.ConcatOp(result, dim, inputs, *, loc=None, ip=None)

The “concat” operation constructs a tensor out of a variadic list of input tensors, concatenated along a static dimension number. All inputs and the result type must share the same rank.

dim specifies the dimension along which to concatenate. The size of the concatenated dimension in the result must be equal to the sum of the sizes of the inputs along that dimension. All other dimensions in both the inputs and result must be the same size.

Example:

```mlir %0 = tensor.concat dim(0) %0, %1, %2 :

(tensor<3x6xf32>, tensor<3x6xf32>, tensor<1x6xf32) -> tensor<7x6xf32>

// Dynamic + dynamic -> static %0 = tensor.concat dim(1) %0, %1, %2 :

(tensor<3x?xf32>, tensor<3x2xf32>, tensor<3x?xf32) -> tensor<3x10xf32>

```

Adaptor

alias of iree.compiler.dialects._tensor_ops_gen.ConcatOpAdaptor

OPERATION_NAME = 'tensor.concat'
property dim: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property inputs: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.tensor.ConcatOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tensor.concat'
property dim: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property inputs: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.tensor.Context(load_on_create_dialects=None, thread_pool=None, *args, **kwargs)
class iree.compiler.dialects.tensor.DenseBoolArrayAttr(*args, **kwargs)
get = <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.dialects.tensor.DenseBoolArrayIterator
class iree.compiler.dialects.tensor.DenseElementsAttr(*args, **kwargs)
get = <nanobind.nb_func object>
get_splat = <nanobind.nb_func object>
get_splat_value
property is_splat

(self) -> bool

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.dialects.tensor.DenseF32ArrayAttr(*args, **kwargs)
get = <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.dialects.tensor.DenseF32ArrayIterator
class iree.compiler.dialects.tensor.DenseF64ArrayAttr(*args, **kwargs)
get = <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.dialects.tensor.DenseF64ArrayIterator
class iree.compiler.dialects.tensor.DenseFPElementsAttr(*args, **kwargs)
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.dialects.tensor.DenseI16ArrayAttr(*args, **kwargs)
get = <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.dialects.tensor.DenseI16ArrayIterator
class iree.compiler.dialects.tensor.DenseI32ArrayAttr(*args, **kwargs)
get = <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.dialects.tensor.DenseI32ArrayIterator
class iree.compiler.dialects.tensor.DenseI64ArrayAttr(*args, **kwargs)
get = <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.dialects.tensor.DenseI64ArrayIterator
class iree.compiler.dialects.tensor.DenseI8ArrayAttr(*args, **kwargs)
get = <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.dialects.tensor.DenseI8ArrayIterator
class iree.compiler.dialects.tensor.DenseIntElementsAttr(*args, **kwargs)
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.dialects.tensor.DenseResourceElementsAttr(*args, **kwargs)
attr_name = 'builtin.dense_resource_elements'
get_from_buffer = <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.dialects.tensor.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.dialects.tensor.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.dialects.tensor.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.dialects.tensor.DiagnosticSeverity(value)

Valid values are as follows:

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

Returns the DialectDescriptor for this dialect.

class iree.compiler.dialects.tensor.DialectDescriptor
property namespace

Returns the namespace of the dialect.

class iree.compiler.dialects.tensor.DialectRegistry(*args, **kwargs)
class iree.compiler.dialects.tensor.Dialects
class iree.compiler.dialects.tensor.DictAttr(*args, **kwargs)
attr_name = 'builtin.dictionary'
get = <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.dialects.tensor.DimOp(source, index, *, results=None, loc=None, ip=None)

The tensor.dim operation takes a tensor and a dimension operand of type index. It returns the size of the requested dimension of the given tensor. If the dimension index is out of bounds, the behavior is undefined.

The specified tensor type is that of the first operand.

Example:

```mlir // Always returns 4, can be constant folded: %c0 = arith.constant 0 : index %x = tensor.dim %A, %c0 : tensor<4x?xf32>

// Return the dynamic dimension of %A. %c1 = arith.constant 1 : index %y = tensor.dim %A, %c1 : tensor<4x?xf32>

// Equivalent generic form: %x = “tensor.dim”(%A, %c0) : (tensor<4x?xf32>, index) -> index %y = “tensor.dim”(%A, %c1) : (tensor<4x?xf32>, index) -> index ```

Adaptor

alias of iree.compiler.dialects._tensor_ops_gen.DimOpAdaptor

OPERATION_NAME = 'tensor.dim'
property index: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IndexType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.IndexType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property source: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tensor.DimOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tensor.dim'
property index: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.IndexType]
property source: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tensor.EmptyOp(sizes: Sequence[Union[iree.compiler._mlir_libs._mlir.ir.Value, int]], element_type: iree.compiler._mlir_libs._mlir.ir.Type, *, encoding: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute] = None, loc=None, ip=None)

Extends the tensor.empty op.

class iree.compiler.dialects.tensor.EmptyOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tensor.empty'
property dynamicSizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.tensor.ExpandShapeOp(result, src, reassociation, output_shape, static_output_shape, *, loc=None, ip=None)

The tensor.expand_shape op produces a tensor of higher (or equal) rank than the operand src whose dimension sizes are a reassociation of src.

A reassociation is defined as a continuous grouping of dimensions and is represented with an array of DenseI64ArrayAttr attribute. The reassociation maps applied to the result tensor with the higher rank must result in the operand tensor with the smaller rank.

The representation for the output shape supports a partially-static specification via attributes specified through the static_output_shape argument. A special sentinel value ShapedType::kDynamic encodes that the corresponding entry has a dynamic value. There must be exactly as many SSA inputs in output_shape as there are ShapedType::kDynamic entries in static_output_shape.

Example:

```mlir // Dimension expansion i -> (i’, j’) and (k) -> (k’) %b = tensor.expand_shape %a [[0, 1], [2]] output_shape [%sz0, %sz1, 32]

: tensor<?x32xf32> into tensor<?x?x32xf32>

```

Adaptor

alias of iree.compiler.dialects._tensor_ops_gen.ExpandShapeOpAdaptor

OPERATION_NAME = 'tensor.expand_shape'
property output_shape: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property reassociation: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property src: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property static_output_shape: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
class iree.compiler.dialects.tensor.ExpandShapeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tensor.expand_shape'
property output_shape: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property reassociation: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property src: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property static_output_shape: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
class iree.compiler.dialects.tensor.ExtractOp(tensor, indices, *, results=None, loc=None, ip=None)

The tensor.extract op reads a ranked tensor and returns one element as specified by the given indices. The result of the op is a value with the same type as the elements of the tensor. The arity of indices must match the rank of the accessed value. All indices should all be of index type.

Example:

`mlir %4 = tensor.extract %t[%1, %2] : tensor<4x4xi32> %5 = tensor.extract %rt[%1, %2] : tensor<?x?xi32> `

Adaptor

alias of iree.compiler.dialects._tensor_ops_gen.ExtractOpAdaptor

OPERATION_NAME = 'tensor.extract'
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property tensor: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
class iree.compiler.dialects.tensor.ExtractOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tensor.extract'
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property tensor: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
class iree.compiler.dialects.tensor.ExtractSliceOp(result, source, offsets, sizes, strides, static_offsets, static_sizes, static_strides, *, loc=None, ip=None)

The “extract_slice” operation extract a tensor from another tensor as specified by the operation’s offsets, sizes and strides arguments.

The extract_slice operation supports the following arguments:

  • source: the “base” tensor from which to extract a slice.

  • offsets: tensor-rank number of offsets into the “base” tensor from which

    to extract the slice.

  • sizes: tensor-rank number of sizes which specify the sizes of the result

    tensor type.

  • strides: tensor-rank number of strides specifying subsampling in each

    dimension.

The representation based on offsets, sizes and strides support a partially-static specification via attributes specified through the static_offsets, static_sizes and static_strides arguments. A special sentinel value ShapedType::kDynamic encodes that the corresponding entry has a dynamic value.

After buffer allocation, the “extract_slice” op is expected to lower into a memref.subview op.

An extract_slice operation may additionally reduce the rank of the resulting tensor by removing dimensions that are statically known to be of size 1. This rank-reduction behavior is not required by the op semantics: this flexibility allows to progressively drop unit dimensions while lowering between different flavors of ops on that operate on tensors.

#### Verification vs Inference in the rank-reduced case

Note that there may be multiple ways to infer a resulting rank-reduced type.

e.g. 1x6x1 could potentially rank-reduce to either 1x6 or 6x1 2-D shapes.

To disambiguate, the inference helpers inferCanonicalRankReducedResultType only drop the first unit dimensions, in order:

e.g. 1x6x1 rank-reduced to 2-D will infer the 6x1 2-D shape, but not 1x6.

Verification however has access to result type and does not need to infer. The verifier calls isRankReducedType(getSource(), getResult()) to determine whether the result type is rank-reduced from the source type. This computes a so-called rank-reduction mask, consisting of dropped unit dims, to map the rank-reduced type to the source type by dropping ones:

e.g. 1x6 is a rank-reduced version of 1x6x1 by mask {2}

6x1 is a rank-reduced version of 1x6x1 by mask {0} 1x2x1x4 is a rank-reduced version of 1x1x2x1x1x4x1 by mask {1, 4, 6}

(remaining common 1 dimensions are matched eagerly)

Example:

```mlir // Rank-reducing extract_slice. %1 = tensor.extract_slice %0[0, 0, 0][1, 16, 4][1, 1, 1] :

tensor<8x16x4xf32> to tensor<16x4xf32>

%3 = tensor.extract_slice %2[%o0, 4, %o2][1, %sz1, 1][1, %st1, 1] :

tensor<8x16x4xf32> to tensor<1x?xf32>

```

Adaptor

alias of iree.compiler.dialects._tensor_ops_gen.ExtractSliceOpAdaptor

OPERATION_NAME = 'tensor.extract_slice'
property offsets: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property sizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property static_offsets: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property static_sizes: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property static_strides: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property strides: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.tensor.ExtractSliceOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tensor.extract_slice'
property offsets: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property sizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property static_offsets: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property static_sizes: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property static_strides: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property strides: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.tensor.F16Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f16'
property typeid

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

class iree.compiler.dialects.tensor.F32Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f32'
property typeid

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

class iree.compiler.dialects.tensor.F64Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f64'
property typeid

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

class iree.compiler.dialects.tensor.FlatSymbolRefAttr(*args, **kwargs)
attr_name = 'builtin.symbol_ref'
get = <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.dialects.tensor.Float4E2M1FNType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f4E2M1FN'
property typeid

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

class iree.compiler.dialects.tensor.Float6E2M3FNType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f6E2M3FN'
property typeid

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

class iree.compiler.dialects.tensor.Float6E3M2FNType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f6E3M2FN'
property typeid

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

class iree.compiler.dialects.tensor.Float8E3M4Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E3M4'
property typeid

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

class iree.compiler.dialects.tensor.Float8E4M3B11FNUZType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E4M3B11FNUZ'
property typeid

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

class iree.compiler.dialects.tensor.Float8E4M3FNType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E4M3FN'
property typeid

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

class iree.compiler.dialects.tensor.Float8E4M3FNUZType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E4M3FNUZ'
property typeid

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

class iree.compiler.dialects.tensor.Float8E4M3Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E4M3'
property typeid

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

class iree.compiler.dialects.tensor.Float8E5M2FNUZType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E5M2FNUZ'
property typeid

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

class iree.compiler.dialects.tensor.Float8E5M2Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E5M2'
property typeid

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

class iree.compiler.dialects.tensor.Float8E8M0FNUType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.f8E8M0FNU'
property typeid

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

class iree.compiler.dialects.tensor.FloatAttr(*args, **kwargs)
attr_name = 'builtin.float'
get = <nanobind.nb_func object>
get_f32 = <nanobind.nb_func object>
get_f64 = <nanobind.nb_func object>
get_unchecked = <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.dialects.tensor.FloatTF32Type(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.tf32'
property typeid

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

class iree.compiler.dialects.tensor.FloatType(*args, **kwargs)
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.dialects.tensor.FromElementsOp(result, elements, *, loc=None, ip=None)

Create a N-D tensor from a range of same-type arguments. The number of provided elements should equal to the number of the elements in the result type. The elements correspond to a flattened tensor.

Example:

`mlir tensor.from_elements %a, %b, %c, %d, %e, %f :  tensor<2x3xindex> `

will result in a tensor

[[%a, %b, %c]

[%d, %e, %f]]

Adaptor

alias of iree.compiler.dialects._tensor_ops_gen.FromElementsOpAdaptor

OPERATION_NAME = 'tensor.from_elements'
property elements: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.tensor.FromElementsOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tensor.from_elements'
property elements: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.tensor.FunctionType(*args, **kwargs)
get = <nanobind.nb_func object>
property inputs

Returns the list of input types in the FunctionType.

property results

Returns the list of result types in the FunctionType.

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.function'
property typeid

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

class iree.compiler.dialects.tensor.GatherOp(result, source, indices, gather_dims, *, unique=None, loc=None, ip=None)

The gather operation extracts a subset of the elements from a source tensor at the given indices.

In its most general form, the tensor of indices specifies all the coordinates of every element to extract (i.e. COO format, without the payload). The indices are expected to be confined to coordinate values that fit the range of the source tensor, otherwise the behavior is undefined.

The leading dimensions of the index tensor give the result tensor its leading dimensions. The trailing dimensions of the result tensor are obtained from the source tensor by omitting the dimensions specified in gather_dims (rank-reducing semantics) or setting them to 1 (rank-preserving semantics) (see examples). The trailing dimension of the index tensor contains the coordinates and is expected to have its size equal to the number of dimensions being gathered. This convention allows an idiomatic specification and lowering of “gathering multiple N-D slices from the source tensor”.

Note: in the examples below, we separate out the indexing part of the tensor type by a whitespace for readability purposes.

Example:

```mlir

// For each 1x2 triple of coordinates in %indices, extract the // element (i.e. 0-D subset) at the coordinates triple in %source. // %out = tensor.gather %source[%indices] gather_dims([0, 1, 2]) :

(tensor<4x4x4xf32>, tensor<1x2x 3xindex>) -> tensor<1x2x 1x1x1xf32>

// Note: result type may be further rank-reduced to tensor<1x2x f32>.

```

A slice variant is provided to allow specifying whole slices of the source tensor.

Example:

```mlir

// For each 5x6 singleton of coordinates in %indices, extract the 2-D // slice %source[*, %indices[…]:%indices[…] + 1, *] with the indices // corresponding to the gather_dims attribute specified by %indices. // %out = tensor.gather %source[%indices] gather_dims([1]) :

(tensor<3x4x5xf32>, tensor<6x7x 1xindex>) -> tensor<6x7x 3x1x5xf32>

// Note: result type may be further rank-reduced to tensor<6x7x 3x5xf32>.

```

The dimensions specified in the gather_dims attribute are ones for which the result tensor has size 1. I.e. if the source type is axbxcxd and the coordinates are [1, 3], then the shape suffix is ax1xcx1. Gather also allows rank-reducing semantics where the shape ax1xcx1 can be further simplified to axc.

The elemental type of the indices tensor can be any integer type. In the absence of target-specific or problem specific information the default type one should use is index.

This operation does not support unranked tensors.

An optional unique unit attribute may be specified to indicate that the coordinates in indices are statically guaranteed to be unique at runtime. Incorrectly setting the unique attribute when the coordinates are not truly unique is undefined behavior.

Only full slices are meant to be supported by this op, if one desires partial slices (e.g. strided windows) one should compose this op with other tensor ops (e.g. tensor.extract_slice). This is to avoid a slippery slope of complexity that would make the op unusable in practice.

At the tensor-level, the index tensor is specified in an AoS form (i.e. coordinate tuple is the most minor). It is the responsibility of further lowerings and bufferization to implement various concrete layouts.

Note: As currently specified, the operation must lower to an abstraction that performs copies to the output tensor. This is because the buffer type system is currently not rich enough to allow multiple non-contiguous views in the same type. This is visible more clearly in a notional buffer version of the op:

```mlir

// memref<?x4x1xf32> is a contiguous buffer of ?x4x1 elements. // gather from random source slices must copy to the contiguous output. %out = memref.gather %source[%indices] gather_dims([1]) :

(memref<4x4xf32>, memref<?x 1xindex>) -> memref<?x 4x1xf32>

// Nested buffer support would allow gather to directly index into the // source buffer (i.e. represent a jagged view into the source). %out = memref.gather %source[%indices] gather_dims([1]) :

(memref<4x4xf32>, memref<?x 1xindex>) -> memref<? x memref<4x1xf32>>

```

Adaptor

alias of iree.compiler.dialects._tensor_ops_gen.GatherOpAdaptor

OPERATION_NAME = 'tensor.gather'
property gather_dims: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property indices: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property unique: bool
class iree.compiler.dialects.tensor.GatherOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tensor.gather'
property gather_dims: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property indices: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property unique: bool
class iree.compiler.dialects.tensor.GenerateOp(result, dynamicExtents, *, loc=None, ip=None)

This operation creates a dynamically sized tensor with elements of any type. It expects one index operand per dynamic extent of the result tensor.

The body region defines the tensor’s elements. It takes index operands as its region arguments that span the index space. The element at the given position is yielded with the yield operation (see YieldOp). There is no defined ordering to the invocations of the body. It is conceptually a “parallel map” operation.

Example:

```mlir

%tnsr = tensor.generate %m, %n { ^bb0(%i : index, %j : index, %k : index):

… yield %elem : f32

} : tensor<?x3x?f32>

```

Adaptor

alias of iree.compiler.dialects._tensor_ops_gen.GenerateOpAdaptor

OPERATION_NAME = 'tensor.generate'
property body: iree.compiler._mlir_libs._mlir.ir.Region
property dynamicExtents: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.tensor.GenerateOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tensor.generate'
property dynamicExtents: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.tensor.IndexType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.index'
property typeid

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

class iree.compiler.dialects.tensor.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.dialects.tensor.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.dialects.tensor.InsertOp(scalar, dest, indices, *, results=None, loc=None, ip=None)

The tensor.insert op inserts a scalar into a ranked tensor dest as specified by the operation’s indices.

It returns a copy of dest with the indexed position updated to the value of scalar.

The arity of indices `must match the rank of the tensor `dest. All indices should be of index type.

Example:

`mlir %4 = tensor.insert %t into %dest[%1, %2] : tensor<4x4xi32> %5 = tensor.insert %rt into %dest[%1, %2] : tensor<?x?xi32> `

Adaptor

alias of iree.compiler.dialects._tensor_ops_gen.InsertOpAdaptor

OPERATION_NAME = 'tensor.insert'
property dest: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property scalar: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tensor.InsertOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tensor.insert'
property dest: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property scalar: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tensor.InsertSliceOp(source, dest, offsets, sizes, strides, static_offsets, static_sizes, static_strides, *, results=None, loc=None, ip=None)

The “insert_slice” operation insert a tensor source into another tensor dest as specified by the operation’s offsets, sizes and strides arguments.

It returns a copy of dest with the proper slice updated with the value of source.

The insert_slice operation supports the following arguments:

  • source: the tensor that is inserted.

  • dest: the tensor into which the source tensor is inserted.

  • offsets: tensor-rank number of offsets into the dest tensor into which

    the slice is inserted.

  • sizes: tensor-rank number of sizes which specify the sizes of the source

    tensor type.

  • strides: tensor-rank number of strides that specify subsampling in each

    dimension.

The representation based on offsets, sizes and strides support a partially-static specification via attributes specified through the static_offsets, static_sizes and static_strides arguments. A special sentinel value ShapedType::kDynamic encodes that the corresponding entry has a dynamic value.

After buffer allocation, the “insert_slice” op is expected to lower into a memref.subview op.

An insert_slice operation may additionally specify insertion into a tensor of higher rank than the source tensor, along dimensions that are statically known to be of size 1. This rank-altering behavior is not required by the op semantics: this flexibility allows to progressively drop unit dimensions while lowering between different flavors of ops on that operate on tensors. The rank-altering behavior of tensor.insert_slice matches the rank-reducing behavior of tensor.extract_slice.

#### Verification in the rank-reduced case

The same verification discussion and mechanisms apply as for ExtractSliceOp. Unlike ExtractSliceOp however, there is no need for a specific inference.

Example:

```mlir // Rank-altering insert_slice. %1 = tensor.insert_slice %t into %0[0, 0, 0][1, 16, 4][1, 1, 1] :

tensor<16x4xf32> into tensor<8x16x4xf32>

%3 = tensor.insert_slice %tt into %2[%o0, 4, %o2][1, %sz1, 1][1, %st1, 1] :

tensor<1x?xf32> into tensor<8x16x4xf32>

```

Adaptor

alias of iree.compiler.dialects._tensor_ops_gen.InsertSliceOpAdaptor

OPERATION_NAME = 'tensor.insert_slice'
property dest: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property offsets: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property sizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property static_offsets: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property static_sizes: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property static_strides: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property strides: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.tensor.InsertSliceOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tensor.insert_slice'
property dest: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property offsets: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property sizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property static_offsets: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property static_sizes: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property static_strides: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property strides: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.tensor.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.dialects.tensor.IntegerAttr(*args, **kwargs)
attr_name = 'builtin.integer'
get = <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.dialects.tensor.IntegerSet
property constraints

(self) -> mlir::python::mlir::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.dialects.tensor.IntegerSetAttr(*args, **kwargs)
attr_name = 'builtin.integer_set'
get = <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.dialects.tensor.IntegerSetConstraint
property expr

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

property is_eq

(self) -> bool

class iree.compiler.dialects.tensor.IntegerSetConstraintList
class iree.compiler.dialects.tensor.IntegerType(*args, **kwargs)
SIGNED = 1
SIGNLESS = 0
enum Signedness(value)

Valid values are as follows:

SIGNLESS = Signedness.SIGNLESS
SIGNED = Signedness.SIGNED
UNSIGNED = Signedness.UNSIGNED
UNSIGNED = 2
get = <nanobind.nb_func object>
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

property signedness

(self) -> iree.compiler._mlir_libs._mlir.ir.IntegerType.Signedness

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.integer'
property typeid

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

property width

Returns the width of the integer type

class iree.compiler.dialects.tensor.Iterable
class iree.compiler.dialects.tensor.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.dialects.tensor.MLIRError(message, error_diagnostics)
An exception with diagnostic information. Has the following fields:

message: str error_diagnostics: List[ir.DiagnosticInfo]

class iree.compiler.dialects.tensor.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>
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>
type_name = 'builtin.memref'
property typeid

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

class iree.compiler.dialects.tensor.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.dialects.tensor.NamedAttribute
property attr

The underlying generic attribute of the NamedAttribute binding.

property name

The name of the NamedAttribute binding.

class iree.compiler.dialects.tensor.NoneType(*args, **kwargs)
get = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.none'
property typeid

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

class iree.compiler.dialects.tensor.OpAdaptor(*args, **kwargs)
property attributes

Returns the attributes of the adaptor.

property operands

Returns the operands of the adaptor.

class iree.compiler.dialects.tensor.OpAttributeMap
get

Gets an attribute by name or the default value, if it does not exist.

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.dialects.tensor.OpOperand
property operand_number

Returns the operand number in the owning operation.

property owner

Returns the operation that owns this operand.

class iree.compiler.dialects.tensor.OpOperandIterator
class iree.compiler.dialects.tensor.OpOperandList
class iree.compiler.dialects.tensor.OpResult(*args, **kwargs)
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.dialects.tensor.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.dialects.tensor.OpSuccessors
class iree.compiler.dialects.tensor.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.dialects.tensor.OpaqueAttr(*args, **kwargs)
attr_name = 'builtin.opaque'
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>
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.dialects.tensor.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>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.opaque'
property typeid

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

class iree.compiler.dialects.tensor.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.dialects.tensor.OperationIterator
class iree.compiler.dialects.tensor.OperationList
class iree.compiler.dialects.tensor.PadOp(result, source, low, high, static_low, static_high, *, nofold=None, loc=None, ip=None)

tensor.pad is an operation that pads the source tensor with given low and high padding config.

The PadOp operation supports the following arguments:

  • source: the “base” tensor on which to pad.

  • low: A list contains the padding along the start of each

    dimension, i.e., how many padded values are prepended to the beginning of the tensor in each dimension.

  • high: A list contains the padding along the end of each

    dimension, i.e., how many padded values are appended to the end of the tensor in each dimension.

  • nofold: indicates that the operation should not be folded when source and

    result types are equal.

The result tensor dimensions are low[i] + dim[i] + high[i] for each dimension i. The number of elements of low and high must match the rank of the input tensor. They can be either a constant or a dynamic value.

The region of the tensor.pad operation returns the value to use for the padding. The arguments of the region represent the index of the source being accessed. There should be as many arguments as the rank of the source tensor. The value yield-ed by the region is used as the value of the view at the given position.

If nofold is set, the padding operation will not be folded away even if the source type and the padded type have the same static shape. This can be used, e.g., for packing or promotion to faster memory.

Example 1: add 3 zeros to the beginning and 5 zeros to the end of a 1D tensor.

```mlir

%arg0 = … : tensor<10xi32> %c0_i32 = arith.constant 0 : i32 %padded = tensor.pad %arg0 low[3] high[5] { ^bb0(%arg1: index):

tensor.yield %c0_i32 : i32

} : tensor<10xi32> to tensor<18xi32>

```

Example 2: add 1 value to the beginning of dimension 0, 2 values to the end of dimension 0, 2 values to the start of dimension 1, and 3 values to the end of dimension 1.

```mlir

%pad_value = … : f32 %0 = tensor.pad %0 low[1, 2] high[2, 3] { ^bb0(%arg0 : index, %arg1 : index):

tensor.yield %pad_value : f32

} : tensor<?x?xf32> to tensor<?x?xf32>

```

Example 3:

```mlir

%pad_value = … : f32 %0 = tensor.pad %arg0 low[2, %arg1, 3, 3] high[3, 3, %arg1, 2] { ^bb0(%arg2: index, %arg3: index, %arg4: index, %arg5: index):

tensor.yield %pad_value : f32

} : tensor<1x2x2x?xf32> to tensor<6x?x?x?xf32>

```

Example 4:

```mlir

%pad_value = … : f32 %0 = tensor.pad %arg0 low[0, 0] high[%ub0, %ub1] { ^bb0(%arg1: index, %arg2: index):

tensor.yield %pad_value : f32

} : tensor<2x3xf32> to tensor<?x?xf32>

```

Example 5: Force a padded value to be always exist with nofold, even though the padding config specifies that no new elements will be added to the tensor.

```mlir

%pad_value = … : f32 %0 = tensor.pad %arg0 nofold low[0, 0] high[0, 0] { ^bb0(%arg1: index, %arg2: index):

tensor.yield %pad_value : f32

} : tensor<2x3xf32> to tensor<2x3xf32>

```

Adaptor

alias of iree.compiler.dialects._tensor_ops_gen.PadOpAdaptor

OPERATION_NAME = 'tensor.pad'
property high: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property low: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property nofold: bool
property region: iree.compiler._mlir_libs._mlir.ir.Region
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property static_high: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property static_low: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
class iree.compiler.dialects.tensor.PadOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tensor.pad'
property high: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property low: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property nofold: bool
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property static_high: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property static_low: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
class iree.compiler.dialects.tensor.ParallelInsertSliceOp(source, dest, offsets, sizes, strides, static_offsets, static_sizes, static_strides, *, loc=None, ip=None)

The parallel_insert_slice yields a subset tensor value to its parent InParallelOpInterface. These subset tensor values are aggregated to in some unspecified order into a full tensor value returned by the parent parallel iterating op. The parallel_insert_slice is one such op allowed in the InParallelOpInterface op.

Conflicting writes result in undefined semantics, in that the indices written to by multiple parallel updates might contain data from any of the updates, or even a malformed bit pattern.

If an index is updated exactly once, the value contained at that index in the resulting tensor will be equal to the value at a corresponding index of a slice that was used for the updated. If an index is not updated at all, its value will be equal to the one in the original tensor.

This op does not create a new value, which allows maintaining a clean separation between the subset and full tensor.

Note that we cannot mark this operation as pure (Pures), even though it has no side effects, because it will get DCEd during canonicalization.

The parallel_insert_slice operation supports the following arguments:

  • source: the tensor that is inserted.

  • dest: the tensor into which the source tensor is inserted.

  • offsets: tensor-rank number of offsets into the dest tensor into which

    the slice is inserted.

  • sizes: tensor-rank number of sizes which specify the sizes of the source

    tensor type.

  • strides: tensor-rank number of strides that specify subsampling in each

    dimension.

The representation based on offsets, sizes and strides support a partially-static specification via attributes specified through the static_offsets, static_sizes and static_strides arguments. A special sentinel value ShapedType::kDynamic encodes that the corresponding entry has a dynamic value.

After buffer allocation, the “parallel_insert_slice” op is expected to lower into a memref.subview op.

A parallel_insert_slice operation may additionally specify insertion into a tensor of higher rank than the source tensor, along dimensions that are statically known to be of size 1. This rank-altering behavior is not required by the op semantics: this flexibility allows to progressively drop unit dimensions while lowering between different flavors of ops on that operate on tensors. The rank-altering behavior of tensor.parallel_insert_slice matches the rank-reducing behavior of tensor.insert_slice and tensor.extract_slice.

#### Verification in the rank-reduced case

The same verification discussion and mechanisms apply as for ExtractSliceOp. Unlike ExtractSliceOp however, there is no need for a specific inference.

Adaptor

alias of iree.compiler.dialects._tensor_ops_gen.ParallelInsertSliceOpAdaptor

OPERATION_NAME = 'tensor.parallel_insert_slice'
property dest: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property offsets: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property sizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property static_offsets: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property static_sizes: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property static_strides: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property strides: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.tensor.ParallelInsertSliceOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tensor.parallel_insert_slice'
property dest: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property offsets: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property sizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property static_offsets: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property static_sizes: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property static_strides: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property strides: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.tensor.RankOp(tensor, *, results=None, loc=None, ip=None)

The tensor.rank operation takes a tensor operand and returns its rank.

Example:

`mlir %0 = tensor.rank %arg0 : tensor<*xf32> %1 = tensor.rank %arg1 : tensor<?x?xf32> `

Adaptor

alias of iree.compiler.dialects._tensor_ops_gen.RankOpAdaptor

OPERATION_NAME = 'tensor.rank'
property tensor: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tensor.RankOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tensor.rank'
property tensor: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tensor.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>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.tensor'
property typeid

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

class iree.compiler.dialects.tensor.Region
property blocks

Returns a forward-optimized sequence of blocks.

property owner

Returns the operation owning this region.

class iree.compiler.dialects.tensor.RegionIterator
class iree.compiler.dialects.tensor.RegionSequence
class iree.compiler.dialects.tensor.ReshapeOp(result, source, shape, *, loc=None, ip=None)

The reshape operation converts a tensor from one type to an equivalent type with a provided shape. The source and destination types are compatible if both have the same element type, same number of elements. The following combinations are possible:

a. Source type is ranked or unranked. Shape argument has static size. Result type is ranked.

```mlir // Reshape statically-shaped tensor. %dst = tensor.reshape %src(%shape)

: (tensor<4x1xf32>, tensor<1xi32>) -> tensor<4xf32>

%dst0 = tensor.reshape %src(%shape0)

: (tensor<4x1xf32>, tensor<2xi32>) -> tensor<2x2xf32>

// Flatten unranked tensor. %dst = tensor.reshape %src(%shape)

: (tensor<*xf32>, tensor<1xi32>) -> tensor<?xf32>

```

b. Source type is ranked or unranked. Shape argument has dynamic size. Result type is unranked.

```mlir // Reshape dynamically-shaped 1D tensor. %dst = tensor.reshape %src(%shape)

: (tensor<?xf32>, tensor<?xi32>) -> tensor<*xf32>

// Reshape unranked tensor. %dst = tensor.reshape %src(%shape)

: (tensor<*xf32>, tensor<?xi32>) -> tensor<*xf32>

```

Adaptor

alias of iree.compiler.dialects._tensor_ops_gen.ReshapeOpAdaptor

OPERATION_NAME = 'tensor.reshape'
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property shape: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property source: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tensor.ReshapeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tensor.reshape'
property shape: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property source: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tensor.ScatterOp(result, source, dest, indices, scatter_dims, *, unique=None, loc=None, ip=None)

The scatter operation inserts a source tensor into a dest tensor at the given indices.

In its most general form, the tensor of indices specifies all the coordinates of every element to insert (i.e. COO format, without the payload). The indices are expected to be confined to coordinate values that fit the range of the dest tensor, otherwise the behavior is undefined.

The leading dimensions of the index tensor must match that of the dest tensor. The trailing dimensions of the dest tensor must match those of the source tensor by omitting the dimensions specified in scatter_dims (rank-reducing semantics) or setting them to 1 (rank-preserving semantics) (see examples). This convention allows an idiomatic specification and lowering of “scattering multiple N-D slices into the dest tensor”. The result type must match the type of the dest tensor.

Note: in the examples below, we separate out the indexing part of the tensor type by a whitespace for readability purposes.

Example:

```mlir

// For each 1x2 triple of coordinates in %indices, insert the // element (i.e. 0-D subset) at the coordinates triple in %dest. // %out = tensor.scatter %source into %dest[%indices]

scatter_dims([0, 1, 2]) unique :

(tensor<1x2x 1x1x1xf32>, tensor<4x4x4xf32>, tensor<1x2x 3xindex>)

-> tensor<4x4x4xf32>

// Note: source type may be further rank-reduced to tensor<1x2x f32>.

```

A slice variant is provided to allow specifying insertion of whole tensor slices into the dest tensor.

Example:

```mlir

// For each 3 singleton of coordinates in %indices, insert the 2-D // slice into %dest[*, %indices[…]:%indices[…] + 1, *] with the // indices corresponding to the scatter_dims attribute specified by // %indices. // %out = tensor.scatter %source into %dest[%indices] scatter_dims([1]) unique :

(tensor<3x 4x1x6xf32>, tensor<4x5x6xf32>, tensor<3x 1xindex>)

-> tensor<4x5x6xf32>

```

The dimensions specified in the scatter_dims attribute are ones for which the source tensor has size 1. I.e. if the dest type is axbxcxd and the coordinates are [1, 3], then the source type suffix is ax1xcx1. Scatter also allows rank-reducing semantics where the shape ax1xcx1 can be further simplified to axc.

The elemental type of the indices tensor can be any integer type. In the absence of target-specific or problem specific information the default type one should use is index.

This operation does not support unranked tensors.

A unique unit attribute must be be specified to indicate that the coordinates are statically guaranteed to be unique at runtime. If coordinates are not truly unique at runtime, the behavior is undefined.

Only full slices are meant to be supported by this op, if one desires partial slices (e.g. strided windows) one should compose this op with other tensor ops (e.g. tensor.insert_slice). This is to avoid a slippery slope of complexity that would make the op unusable in practice.

At the tensor-level, the index tensor is specified in an AoS form (i.e. coordinate tuple is the most minor). It is the responsibility of further lowerings and bufferization to implement various concrete layouts.

Note: As currently specified, the operation must lower to an abstraction that performs copies to the output tensor. This is because the buffer type system is currently not rich enough to allow multiple non-contiguous views in the same type. This is visible more clearly in a notional buffer version of the op:

```mlir

// memref<?x 4xf32> is a contiguous buffer of ?x4 elements, scatter into // random dest slices must copy to the contiguous dest. // some_side_effecting_op_writing_into %source, …: memref<3x 4xf32> memref.scatter %source into %dest[%indices] scatter_dims([1]) unique :

(memref<3x 4xf32>, memref<?x 4xf32>, memref<?x 1xindex>)

// Nested buffer support in the producing op would allow writing directly // into the dest buffer. %v = some_nested_buffer_view_op %dest[%indices] scatter_dims([1]) unique :

memref<? x memref<4xf32>>

some_side_effecting_op_writing_into %v, …: memref<? x memref<4xf32>>

```

Adaptor

alias of iree.compiler.dialects._tensor_ops_gen.ScatterOpAdaptor

OPERATION_NAME = 'tensor.scatter'
property dest: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property indices: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property scatter_dims: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property unique: bool
class iree.compiler.dialects.tensor.ScatterOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tensor.scatter'
property dest: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property indices: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property scatter_dims: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property unique: bool
class iree.compiler.dialects.tensor.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.

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.dialects.tensor.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.dialects.tensor.SplatOp(aggregate, input, dynamicSizes, *, loc=None, ip=None)

Broadcast the operand to all elements of the result tensor.

An additional argument of type index must be provided for each dynamic dimension present in the result type.

Example for a statically shaped tensor:

`mlir %s = arith.constant 1.0 : f32 %t = tensor.splat %s : tensor<8x16xf32> `

Example for a tensor containing dynamic dimensions:

`mlir // Broadcasts %s to a 3D dynamically shaped tensor, with %m and %n binding // to dimensions 0 and 2 of the resulting tensor, respectively. %m = arith.constant 10 : index %n = arith.constant 30 : index %t = tensor.splat %s[%m, %n] : tensor<?x20x?xf32> `

Adaptor

alias of iree.compiler.dialects._tensor_ops_gen.SplatOpAdaptor

OPERATION_NAME = 'tensor.splat'
property aggregate: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property dynamicSizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property input: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tensor.SplatOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tensor.splat'
property dynamicSizes: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property input: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tensor.StridedLayoutAttr(*args, **kwargs)
attr_name = 'builtin.strided_layout'
get = <nanobind.nb_func object>
get_fully_dynamic = <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.dialects.tensor.StringAttr(*args, **kwargs)
attr_name = 'builtin.string'
get = <nanobind.nb_func object>
get_typed = <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.dialects.tensor.SymbolRefAttr(*args, **kwargs)
attr_name = 'builtin.symbol_ref'
get = <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.dialects.tensor.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.dialects.tensor.ThreadPool(*args, **kwargs)
get_max_concurrency

Returns the maximum number of threads in the pool.

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

Returns the pos-th type in the tuple type.

property num_types

Returns the number of types contained in a tuple.

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.tuple'
property typeid

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

class iree.compiler.dialects.tensor.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.dialects.tensor.TypeAttr(*args, **kwargs)
attr_name = 'builtin.type'
get = <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.dialects.tensor.TypeID
class iree.compiler.dialects.tensor.UnitAttr(*args, **kwargs)
attr_name = 'builtin.unit'
get = <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.dialects.tensor.UnrankedMemRefType(*args, **kwargs)
get = <nanobind.nb_func object>
get_unchecked = <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>
type_name = 'builtin.unranked_memref'
property typeid

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

class iree.compiler.dialects.tensor.UnrankedTensorType(*args, **kwargs)
get = <nanobind.nb_func object>
get_unchecked = <nanobind.nb_func object>
static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.unranked_tensor'
property typeid

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

class iree.compiler.dialects.tensor.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.dialects.tensor.VectorType(*args, **kwargs)
get = <nanobind.nb_func object>
get_unchecked = <nanobind.nb_func object>
property scalable

(self) -> bool

property scalable_dims

(self) -> list[bool]

static_typeid = <iree.compiler._mlir_libs._mlir.ir.TypeID object>
type_name = 'builtin.vector'
property typeid

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

enum iree.compiler.dialects.tensor.WalkOrder(value)

Valid values are as follows:

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

Valid values are as follows:

ADVANCE = WalkResult.ADVANCE
INTERRUPT = WalkResult.INTERRUPT
SKIP = WalkResult.SKIP
class iree.compiler.dialects.tensor.YieldOp(value, *, loc=None, ip=None)

This operation is used to yield a single value from a within a region. It is used to create dynamically sized tensors (see tensor.generate and tensor.pad ops).

Adaptor

alias of iree.compiler.dialects._tensor_ops_gen.YieldOpAdaptor

OPERATION_NAME = 'tensor.yield'
property value: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tensor.YieldOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tensor.yield'
property value: iree.compiler._mlir_libs._mlir.ir.Value
iree.compiler.dialects.tensor.append_load_on_create_dialect(dialect: str)
iree.compiler.dialects.tensor.bitcast(dest, source, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tensor.cast(dest, source, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tensor.collapse_shape(result, src, reassociation, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tensor.concat(result, dim, inputs, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tensor.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.dialects.tensor.dim(source, index, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tensor.empty(sizes: Sequence[Union[iree.compiler._mlir_libs._mlir.ir.Value, int]], element_type: iree.compiler._mlir_libs._mlir.ir.Type, *, encoding: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute] = None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.Value
iree.compiler.dialects.tensor.expand_shape(result, src, reassociation, output_shape, static_output_shape, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tensor.extract(tensor, indices, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tensor.extract_slice(result, source, offsets, sizes, strides, static_offsets, static_sizes, static_strides, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tensor.from_elements(result, elements, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tensor.gather(result, source, indices, gather_dims, *, unique=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tensor.generate(*args, **kwargs)
iree.compiler.dialects.tensor.get_dialect_registry()
iree.compiler.dialects.tensor.get_load_on_create_dialects()
iree.compiler.dialects.tensor.insert(scalar, dest, indices, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tensor.insert_slice(source, dest, offsets, sizes, strides, static_offsets, static_sizes, static_strides, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tensor.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.dialects.tensor.pad(result, source, low, high, static_low, static_high, *, nofold=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tensor.parallel_insert_slice(source, dest, offsets, sizes, strides, static_offsets, static_sizes, static_strides, *, loc=None, ip=None) iree.compiler.dialects._tensor_ops_gen.ParallelInsertSliceOp
iree.compiler.dialects.tensor.rank(tensor, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tensor.region_op(op_constructor, terminator=None)

Decorator to define an MLIR Op specified as a python function.

Requires that an mlir.ir.InsertionPoint and mlir.ir.Location are active for the current thread (i.e. established in a with block).

Supports “naked” usage i.e., no parens if no args need to be passed to the Op constructor.

When applied as a decorator to a Python function, an entry block will be constructed for the Op with types as specified as type hints on the args of the function. The block arguments will be passed positionally to the Python function.

If a terminator is specified then the return from the decorated function will be passed to the terminator as the last statement in the entry block. Note, the API for the terminator is a (possibly empty) list; terminator accepting single values should be wrapped in a lambda args: term(args[0])

The identifier (name) of the function will become: 1. A single value result if the Op returns a single value; 2. An OpResultList (as a list) if the Op returns multiple values; 3. The Operation if the Op returns no results.

See examples in tensor.py and transform.extras.

iree.compiler.dialects.tensor.register_attribute_builder(kind, replace=False)
iree.compiler.dialects.tensor.reshape(result, source, shape, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tensor.scatter(result, source, dest, indices, scatter_dims, *, unique=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tensor.splat(aggregate, input, dynamic_sizes, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tensor.yield_(value, *, loc=None, ip=None) iree.compiler.dialects._tensor_ops_gen.YieldOp

tosa dialect

class iree.compiler.dialects.tosa.AbsOp(output, input1, *, loc=None, ip=None)

Elementwise absolute value operation.

Example:

`mlir %output = tosa.abs(%input1) : (tensor<21x3xf32>) -> tensor<21x3xf32> `

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.AbsOpAdaptor

OPERATION_NAME = 'tosa.abs'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.AbsOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.abs'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.AddOp(output, input1, input2, *, loc=None, ip=None)

Elementwise addition of input1 and input2. Axis of size 1 will be broadcast, as necessary. Rank of input tensors must match.

Example:

```mlir // Elementwise addition. %out = tosa.add %input1, %input2 : tensor<12x6xf32>, tensor<12x6xf32> -> tensor<12x6xf32>

// Elementwise addition with broadcasting. %out = tosa.add %input1, %input2 : tensor<12x6xsi32>, tensor<1x1xsi32> -> tensor<12x6xsi32> ```

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.AddOpAdaptor

OPERATION_NAME = 'tosa.add'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.AddOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.add'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.AddShapeOp(output, input1, input2, *, loc=None, ip=None)

Elementwise addition of input1 and input2. Size of shapes must match.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.AddShapeOpAdaptor

OPERATION_NAME = 'tosa.add_shape'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.AddShapeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.add_shape'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.ApplyScaleOp(output, value, multiplier, shift, rounding_mode, *, loc=None, ip=None)

Applies rescaling for fixed point values. This behavior is replicated in multiple quantized operations (mul, convolution, rescale, matmul, pooling).

The commonplace implementation is to use i64 operations to avoid integer overflow with target specific implementations can use native operations to avoid wider than necessary types.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.ApplyScaleOpAdaptor

OPERATION_NAME = 'tosa.apply_scale'
property multiplier: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
property rounding_mode: iree.compiler._mlir_libs._mlir.ir.Attribute
property shift: iree.compiler._mlir_libs._mlir.ir.Value
property value: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.ApplyScaleOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.apply_scale'
property multiplier: iree.compiler._mlir_libs._mlir.ir.Value
property rounding_mode: iree.compiler._mlir_libs._mlir.ir.Attribute
property shift: iree.compiler._mlir_libs._mlir.ir.Value
property value: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.ArgMaxOp(output, input, axis, *, nan_mode=None, loc=None, ip=None)

This returns the index with the largest value across the given axis of the input tensor. If multiple locations have equal values, returns the first match along the search axis.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.ArgMaxOpAdaptor

OPERATION_NAME = 'tosa.argmax'
property axis: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property input: iree.compiler._mlir_libs._mlir.ir.Value
property nan_mode: iree.compiler._mlir_libs._mlir.ir.Attribute
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.ArgMaxOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.argmax'
property axis: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property input: iree.compiler._mlir_libs._mlir.ir.Value
property nan_mode: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.tosa.ArithmeticRightShiftOp(output, input1, input2, round, *, loc=None, ip=None)

Elementwise arithmetic right shift of input1 by the amount specified in input2. Axis of size 1 will be broadcast, as necessary. Rank of input tensors must match.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.ArithmeticRightShiftOpAdaptor

OPERATION_NAME = 'tosa.arithmetic_right_shift'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
property round: iree.compiler._mlir_libs._mlir.ir.BoolAttr
class iree.compiler.dialects.tosa.ArithmeticRightShiftOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.arithmetic_right_shift'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property round: iree.compiler._mlir_libs._mlir.ir.BoolAttr
class iree.compiler.dialects.tosa.AssertEqualShapeOp(input1, input2, allow_broadcast, *, loc=None, ip=None)

Verify input1 and input2 are equal. If allow_broadcast is set, shapes which are broadcast compatible are allowed.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.AssertEqualShapeOpAdaptor

OPERATION_NAME = 'tosa.assert_equal_shape'
property allow_broadcast: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.AssertEqualShapeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.assert_equal_shape'
property allow_broadcast: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.AvgPool2dOp(output, input, input_zp, output_zp, kernel, stride, pad, acc_type, *, loc=None, ip=None)

This performs an average pooling over the given input tensor. A sliding window of size given by <kernel size> is passed over the input tensor, with the mean value being placed in the output tensor. When calculating the average, only the number of valid input tensor values, but not padding, are used to calculate the divisor.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.AvgPool2dOpAdaptor

OPERATION_NAME = 'tosa.avg_pool2d'
property acc_type: iree.compiler._mlir_libs._mlir.ir.TypeAttr
property input: iree.compiler._mlir_libs._mlir.ir.Value
property input_zp: iree.compiler._mlir_libs._mlir.ir.Value
property kernel: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
property output_zp: iree.compiler._mlir_libs._mlir.ir.Value
property pad: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property stride: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
class iree.compiler.dialects.tosa.AvgPool2dOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.avg_pool2d'
property acc_type: iree.compiler._mlir_libs._mlir.ir.TypeAttr
property input: iree.compiler._mlir_libs._mlir.ir.Value
property input_zp: iree.compiler._mlir_libs._mlir.ir.Value
property kernel: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property output_zp: iree.compiler._mlir_libs._mlir.ir.Value
property pad: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property stride: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
class iree.compiler.dialects.tosa.BitwiseAndOp(output, input1, input2, *, loc=None, ip=None)

Elementwise bitwise AND of input1 and input2. Axis of size 1 will be broadcast as necessary. Rank of input tensors must match.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.BitwiseAndOpAdaptor

OPERATION_NAME = 'tosa.bitwise_and'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.BitwiseAndOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.bitwise_and'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.BitwiseNotOp(output, input1, *, loc=None, ip=None)

Elementwise bitwise NOT of input tensor.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.BitwiseNotOpAdaptor

OPERATION_NAME = 'tosa.bitwise_not'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.BitwiseNotOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.bitwise_not'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.BitwiseOrOp(output, input1, input2, *, loc=None, ip=None)

Elementwise bitwise OR of input1 and input2. Axis of size 1 will be broadcast as necessary. Rank of input tensors must match.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.BitwiseOrOpAdaptor

OPERATION_NAME = 'tosa.bitwise_or'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.BitwiseOrOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.bitwise_or'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.BitwiseXorOp(output, input1, input2, *, loc=None, ip=None)

Elementwise bitwise XOR of input1 and input2. Axis of size 1 will be broadcast as necessary. Rank of input tensors must match.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.BitwiseXorOpAdaptor

OPERATION_NAME = 'tosa.bitwise_xor'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.BitwiseXorOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.bitwise_xor'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.CastFromBlockScaledOp(output_data, input_data, input_scale, block_size, *, loc=None, ip=None)

Apply the scales from a scale tensor to the values in a value tensor, casting the result to the output type. The block dimension must be the last dimension of the tensor.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.CastFromBlockScaledOpAdaptor

OPERATION_NAME = 'tosa.cast_from_block_scaled'
property block_size: iree.compiler._mlir_libs._mlir.ir.Attribute
property input_data: iree.compiler._mlir_libs._mlir.ir.Value
property input_scale: iree.compiler._mlir_libs._mlir.ir.Value
property output_data: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.CastFromBlockScaledOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.cast_from_block_scaled'
property block_size: iree.compiler._mlir_libs._mlir.ir.Attribute
property input_data: iree.compiler._mlir_libs._mlir.ir.Value
property input_scale: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.CastOp(output, input, *, loc=None, ip=None)

Casts a tensor from one data type to another. * This table is showing the supported conversions from the TOSA Specification. * The MLIR dialect here can be used to represent other conversions.

Mode | Input | Output |

|--------------------------|———|---------| | fp16 to fp32 | float16 | float32 | | fp16 to int 16 | float16 | int16 | | fp16 to int 32 | float16 | int32 | | fp16 to int 8 | float16 | int8 | | fp32 to fp16 | float32 | float16 | | fp32 to int 16 | float32 | int16 | | fp32 to int 32 | float32 | int32 | | fp32 to int 8 | float32 | int8 | | int 16 to fp16 | int16 | float16 | | int 16 to fp32 | int16 | float32 | | int 32 to fp16 | int32 | float16 | | int 32 to fp32 | int32 | float32 | | int 8 to fp16 | int8 | float16 | | int 8 to fp32 | int8 | float32 | | bool to int 16 | Boolean | int16 | | bool to int 32 | Boolean | int32 | | bool to int 8 | Boolean | int8 | | int 16 to bool | int16 | Boolean | | int 16 to int 32 | int16 | int32 | | int 16 to int 8 | int16 | int8 | | int 32 to bool | int32 | Boolean | | int 32 to int 16 | int32 | int16 | | int 32 to int 8 | int32 | int8 | | int 8 to bool | int8 | Boolean | | int 8 to int 16 | int8 | int16 | | int 8 to int 32 | int8 | int32 | | bf16 to fp32 | bf16 | float32 | | bf16 to int 16 | bf16 | int16 | | bf16 to int 32 | bf16 | int32 | | bf16 to int 8 | bf16 | int8 | | fp32 to bf16 | float32 | bf16 | | int 16 to bf16 | int16 | bf16 | | int 32 to bf16 | int32 | bf16 | | int 8 to bf16 | int8 | bf16 | | bf16 to fp8e4m3 | bf16 | fp8e4m3 | | fp8e4m3 to bf16 | fp8e4m3 | bf16 | | bf16 to fp8e5m2 | bf16 | fp8e5m2 | | fp8e5m2 to bf16 | fp8e5m2 | bf16 | | fp16 to fp8e4m3 | float16 | fp8e4m3 | | fp32 to fp8e4m3 | float32 | fp8e4m3 | | fp8e4m3 to fp16 | fp8e4m3 | float16 | | fp8e4m3 to fp32 | fp8e4m3 | float32 | | fp16 to fp8e5m2 | float16 | fp8e5m2 | | fp32 to fp8e5m2 | float32 | fp8e5m2 | | fp8e5m2 to fp16 | fp8e5m2 | float16 | | fp8e5m2 to fp32 | fp8e5m2 | float32 |

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.CastOpAdaptor

OPERATION_NAME = 'tosa.cast'
property input: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.CastOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.cast'
property input: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.CastToBlockScaledOp(output_data, output_scale, input_data, block_size, *, loc=None, ip=None)

Calculate a scale value per block of input values and use that to calculate scaled data values from an input tensor. The output tensors are cast to the specified scale and value types. The block dimension will be the last dimension of the tensor.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.CastToBlockScaledOpAdaptor

OPERATION_NAME = 'tosa.cast_to_block_scaled'
property block_size: iree.compiler._mlir_libs._mlir.ir.Attribute
property input_data: iree.compiler._mlir_libs._mlir.ir.Value
property output_data: iree.compiler._mlir_libs._mlir.ir.OpResult
property output_scale: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.CastToBlockScaledOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.cast_to_block_scaled'
property block_size: iree.compiler._mlir_libs._mlir.ir.Attribute
property input_data: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.CeilOp(output, input1, *, loc=None, ip=None)

Elementwise ceiling operation.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.CeilOpAdaptor

OPERATION_NAME = 'tosa.ceil'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.CeilOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.ceil'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.ClampOp(output, input, min_val, max_val, *, nan_mode=None, loc=None, ip=None)

Clamp to an arbitrary minimum and maximum value. Maximum and minimum values are specified as values in the range of the input type. No zero point subtraction is done to the values, thus to clamp to the zero point value, the zero point itself should be supplied as the minimum value.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.ClampOpAdaptor

OPERATION_NAME = 'tosa.clamp'
property input: iree.compiler._mlir_libs._mlir.ir.Value
property max_val: iree.compiler._mlir_libs._mlir.ir.Attribute
property min_val: iree.compiler._mlir_libs._mlir.ir.Attribute
property nan_mode: iree.compiler._mlir_libs._mlir.ir.Attribute
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.ClampOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.clamp'
property input: iree.compiler._mlir_libs._mlir.ir.Value
property max_val: iree.compiler._mlir_libs._mlir.ir.Attribute
property min_val: iree.compiler._mlir_libs._mlir.ir.Attribute
property nan_mode: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.tosa.ClzOp(output, input1, *, loc=None, ip=None)

Elementwise count leading zeros operation.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.ClzOpAdaptor

OPERATION_NAME = 'tosa.clz'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.ClzOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.clz'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.ConcatOp(input1, axis, *, results=None, loc=None, ip=None)

Concatenate a list of tensors along a given axis. No data conversion happens during a concat operation.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.ConcatOpAdaptor

OPERATION_NAME = 'tosa.concat'
property axis: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property input1: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.ConcatOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.concat'
property axis: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property input1: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.tosa.ConcatShapeOp(output, input, *, loc=None, ip=None)

Concatenates a list of shapes into a new shape with length equal to the sum of the lengths of the inputs.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.ConcatShapeOpAdaptor

OPERATION_NAME = 'tosa.concat_shape'
property input: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.ConcatShapeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.concat_shape'
property input: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.tosa.ConstOp(values, *, results=None, loc=None, ip=None)

A node containing constant data for use as the input to an operation. May hold data in any of the supported data formats.

Example:

`mlir // Generic form %out = "tosa.const"() {values = dense<0> : tensor<2x3xi32>} : () -> tensor<2x3xi32> `

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.ConstOpAdaptor

OPERATION_NAME = 'tosa.const'
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
property values: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.tosa.ConstOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.const'
property values: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.tosa.ConstShapeOp(output, values, *, loc=None, ip=None)

A node containing a constant shape.

Example:

`mlir // Generic form %out = "tosa.const_shape"() {values = dense<0> : tensor<4xindex>} : () -> !tosa.shape<4> `

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.ConstShapeOpAdaptor

OPERATION_NAME = 'tosa.const_shape'
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
property values: iree.compiler._mlir_libs._mlir.ir.DenseIntElementsAttr
class iree.compiler.dialects.tosa.ConstShapeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.const_shape'
property values: iree.compiler._mlir_libs._mlir.ir.DenseIntElementsAttr
class iree.compiler.dialects.tosa.Conv2DBlockScaledOp(output, input_data, input_scale, weight_data, weight_scale, bias, pad, stride, dilation, block_size, *, loc=None, ip=None)

Performs a 2D convolution over the given input data and scales, using the weight data and scales. Implementations may choose to skip calculation of multiplies in the padding area.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.Conv2DBlockScaledOpAdaptor

OPERATION_NAME = 'tosa.conv2d_block_scaled'
property bias: iree.compiler._mlir_libs._mlir.ir.Value
property block_size: iree.compiler._mlir_libs._mlir.ir.Attribute
property dilation: iree.compiler._mlir_libs._mlir.ir.Value
property input_data: iree.compiler._mlir_libs._mlir.ir.Value
property input_scale: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
property pad: iree.compiler._mlir_libs._mlir.ir.Value
property stride: iree.compiler._mlir_libs._mlir.ir.Value
property weight_data: iree.compiler._mlir_libs._mlir.ir.Value
property weight_scale: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.Conv2DBlockScaledOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.conv2d_block_scaled'
property bias: iree.compiler._mlir_libs._mlir.ir.Value
property block_size: iree.compiler._mlir_libs._mlir.ir.Attribute
property dilation: iree.compiler._mlir_libs._mlir.ir.Value
property input_data: iree.compiler._mlir_libs._mlir.ir.Value
property input_scale: iree.compiler._mlir_libs._mlir.ir.Value
property pad: iree.compiler._mlir_libs._mlir.ir.Value
property stride: iree.compiler._mlir_libs._mlir.ir.Value
property weight_data: iree.compiler._mlir_libs._mlir.ir.Value
property weight_scale: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.Conv2DOp(output, input, weight, bias, input_zp, weight_zp, pad, stride, dilation, acc_type, *, local_bound=None, loc=None, ip=None)

Performs a 2D convolution over the given tensor input, using the weight tensor. Implementations may choose to skip calculation of multiplies in the padding area.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.Conv2DOpAdaptor

OPERATION_NAME = 'tosa.conv2d'
property acc_type: iree.compiler._mlir_libs._mlir.ir.TypeAttr
property bias: iree.compiler._mlir_libs._mlir.ir.Value
property dilation: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property input: iree.compiler._mlir_libs._mlir.ir.Value
property input_zp: iree.compiler._mlir_libs._mlir.ir.Value
property local_bound: Optional[iree.compiler._mlir_libs._mlir.ir.BoolAttr]
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
property pad: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property stride: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property weight: iree.compiler._mlir_libs._mlir.ir.Value
property weight_zp: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.Conv2DOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.conv2d'
property acc_type: iree.compiler._mlir_libs._mlir.ir.TypeAttr
property bias: iree.compiler._mlir_libs._mlir.ir.Value
property dilation: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property input: iree.compiler._mlir_libs._mlir.ir.Value
property input_zp: iree.compiler._mlir_libs._mlir.ir.Value
property local_bound: Optional[iree.compiler._mlir_libs._mlir.ir.BoolAttr]
property pad: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property stride: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property weight: iree.compiler._mlir_libs._mlir.ir.Value
property weight_zp: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.Conv3DOp(output, input, weight, bias, input_zp, weight_zp, pad, stride, dilation, acc_type, *, local_bound=None, loc=None, ip=None)

Performs a 3D convolution over the given input tensor. Implementations may choose to skip calculation of multiplies in the padding area.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.Conv3DOpAdaptor

OPERATION_NAME = 'tosa.conv3d'
property acc_type: iree.compiler._mlir_libs._mlir.ir.TypeAttr
property bias: iree.compiler._mlir_libs._mlir.ir.Value
property dilation: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property input: iree.compiler._mlir_libs._mlir.ir.Value
property input_zp: iree.compiler._mlir_libs._mlir.ir.Value
property local_bound: Optional[iree.compiler._mlir_libs._mlir.ir.BoolAttr]
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
property pad: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property stride: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property weight: iree.compiler._mlir_libs._mlir.ir.Value
property weight_zp: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.Conv3DOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.conv3d'
property acc_type: iree.compiler._mlir_libs._mlir.ir.TypeAttr
property bias: iree.compiler._mlir_libs._mlir.ir.Value
property dilation: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property input: iree.compiler._mlir_libs._mlir.ir.Value
property input_zp: iree.compiler._mlir_libs._mlir.ir.Value
property local_bound: Optional[iree.compiler._mlir_libs._mlir.ir.BoolAttr]
property pad: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property stride: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property weight: iree.compiler._mlir_libs._mlir.ir.Value
property weight_zp: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.CosOp(output, input1, *, loc=None, ip=None)

Elementwise cosine operation for values given in radians.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.CosOpAdaptor

OPERATION_NAME = 'tosa.cos'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.CosOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.cos'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.CustomOp(output_list, operator_name, domain_name, implementation_attrs, input_list, *, loc=None, ip=None)

Hardware implementing TOSA may choose to add additional custom operators that are not expressed in the existing TOSA operations. These operators are not expected to be portable across TOSA implementations. The input and output signatures must be expressed in the corresponding TOSA node.

operator_name is a string that tells the backend which custom operator is being called.

domain_name is a string identifier which can help avoid name collisions on the identifier field.

implementation_attrs is a string which is a backend and identifier specific set of attributes to the custom operator.

input_list is the set of tensor inputs to the custom operator.

output_list is the list of tensors returned by the operator. The number of operators is backend specific.

Example:

```mlir %out = tosa.custom %in {domain_name = “tosa_mlir_test”, operator_name =

“custom_test”, implementation_attrs = “”}: (tensor<10xi32>) -> (tensor<10xi32>)

```

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.CustomOpAdaptor

OPERATION_NAME = 'tosa.custom'
property domain_name: iree.compiler._mlir_libs._mlir.ir.StringAttr
property implementation_attrs: iree.compiler._mlir_libs._mlir.ir.StringAttr
property input_list: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property operator_name: iree.compiler._mlir_libs._mlir.ir.StringAttr
property output_list: iree.compiler._mlir_libs._mlir.ir.OpResultList
class iree.compiler.dialects.tosa.CustomOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.custom'
property domain_name: iree.compiler._mlir_libs._mlir.ir.StringAttr
property implementation_attrs: iree.compiler._mlir_libs._mlir.ir.StringAttr
property input_list: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property operator_name: iree.compiler._mlir_libs._mlir.ir.StringAttr
class iree.compiler.dialects.tosa.DepthwiseConv2DOp(output, input, weight, bias, input_zp, weight_zp, pad, stride, dilation, acc_type, *, local_bound=None, loc=None, ip=None)

Performs 2D convolutions separately over each channel of the given tensor input, using the weight tensor. Implementations may choose to skip calculation of multiplies in the padding area.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.DepthwiseConv2DOpAdaptor

OPERATION_NAME = 'tosa.depthwise_conv2d'
property acc_type: iree.compiler._mlir_libs._mlir.ir.TypeAttr
property bias: iree.compiler._mlir_libs._mlir.ir.Value
property dilation: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property input: iree.compiler._mlir_libs._mlir.ir.Value
property input_zp: iree.compiler._mlir_libs._mlir.ir.Value
property local_bound: Optional[iree.compiler._mlir_libs._mlir.ir.BoolAttr]
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
property pad: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property stride: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property weight: iree.compiler._mlir_libs._mlir.ir.Value
property weight_zp: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.DepthwiseConv2DOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.depthwise_conv2d'
property acc_type: iree.compiler._mlir_libs._mlir.ir.TypeAttr
property bias: iree.compiler._mlir_libs._mlir.ir.Value
property dilation: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property input: iree.compiler._mlir_libs._mlir.ir.Value
property input_zp: iree.compiler._mlir_libs._mlir.ir.Value
property local_bound: Optional[iree.compiler._mlir_libs._mlir.ir.BoolAttr]
property pad: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property stride: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property weight: iree.compiler._mlir_libs._mlir.ir.Value
property weight_zp: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.DimOp(output, input1, axis, *, loc=None, ip=None)

Returns a length 1 shape_t of the size of the input tensor for the given axis.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.DimOpAdaptor

OPERATION_NAME = 'tosa.dim'
property axis: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.DimOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.dim'
property axis: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property input1: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.DivCeilShapeOp(output, input1, input2, *, loc=None, ip=None)

Elementwise divide of input1 by input2. The result of the divide is rounded up.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.DivCeilShapeOpAdaptor

OPERATION_NAME = 'tosa.div_ceil_shape'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.DivCeilShapeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.div_ceil_shape'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.DivFloorShapeOp(output, input1, input2, *, loc=None, ip=None)

Elementwise integer divide of input1 by input2. The result of the divide is rounded down.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.DivFloorShapeOpAdaptor

OPERATION_NAME = 'tosa.div_floor_shape'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.DivFloorShapeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.div_floor_shape'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.EqualOp(input1, input2, *, results=None, loc=None, ip=None)

Elementwise comparison operation.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.EqualOpAdaptor

OPERATION_NAME = 'tosa.equal'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.EqualOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.equal'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.ErfOp(output, input, *, loc=None, ip=None)

Gauss error function: $ erf(x) = frac{2}{sqrt{pi}} int_{0}^{x} e^{-t^2} dt $ For quantized integer data types, the TABLE operator should be used instead with the following definition. The ERF table has 513 entries each of 16-bit precision and covering the input range -4.0 to +4.0 in steps of 1/64.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.ErfOpAdaptor

OPERATION_NAME = 'tosa.erf'
property input: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.ErfOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.erf'
property input: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.Exp2ShapeOp(output, input, *, loc=None, ip=None)

Computation of raising two to the power of each element in input.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.Exp2ShapeOpAdaptor

OPERATION_NAME = 'tosa.exp2_shape'
property input: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.Exp2ShapeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.exp2_shape'
property input: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.ExpOp(output, input1, *, loc=None, ip=None)

Elementwise e to the x operation

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.ExpOpAdaptor

OPERATION_NAME = 'tosa.exp'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.ExpOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.exp'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.FFT2dOp(output_real, output_imag, input_real, input_imag, inverse, *, local_bound=None, loc=None, ip=None)

Performs a batched complex 2D Fast Fourier Transform over the input. The complex input values are constructed from the corresponding values in the input_real and input_imag tensors. The resulting values in the output are split into the output_real and output_imag tensors. No normalization is applied on either the forward or inverse versions of the operation.

Example:

```mlir

%output_real, %output_imag = tosa.fft2d %input_real, %input_imag : (tensor<8x9xf32>, tensor<8x9xf32>) -> (tensor<8x9xf32>, tensor<8x9xf32>)

```

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.FFT2dOpAdaptor

OPERATION_NAME = 'tosa.fft2d'
property input_imag: iree.compiler._mlir_libs._mlir.ir.Value
property input_real: iree.compiler._mlir_libs._mlir.ir.Value
property inverse: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property local_bound: Optional[iree.compiler._mlir_libs._mlir.ir.BoolAttr]
property output_imag: iree.compiler._mlir_libs._mlir.ir.OpResult
property output_real: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.FFT2dOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.fft2d'
property input_imag: iree.compiler._mlir_libs._mlir.ir.Value
property input_real: iree.compiler._mlir_libs._mlir.ir.Value
property inverse: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property local_bound: Optional[iree.compiler._mlir_libs._mlir.ir.BoolAttr]
class iree.compiler.dialects.tosa.FloorOp(output, input1, *, loc=None, ip=None)

Elementwise floor operation.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.FloorOpAdaptor

OPERATION_NAME = 'tosa.floor'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.FloorOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.floor'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.GatherOp(output, values, indices, *, loc=None, ip=None)

Generate a tensor for which each element in the output is a subtensor of the values tensor based on the indices. N is the number of batches, W the number of indices in each batch, K the range of each index and C the number data channels for each index.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.GatherOpAdaptor

OPERATION_NAME = 'tosa.gather'
property indices: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
property values: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.GatherOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.gather'
property indices: iree.compiler._mlir_libs._mlir.ir.Value
property values: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.GreaterEqualOp(output, input1, input2, *, loc=None, ip=None)

Elementwise comparison operation.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.GreaterEqualOpAdaptor

OPERATION_NAME = 'tosa.greater_equal'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.GreaterEqualOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.greater_equal'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.GreaterOp(output, input1, input2, *, loc=None, ip=None)

Elementwise greater than comparison operation.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.GreaterOpAdaptor

OPERATION_NAME = 'tosa.greater'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.GreaterOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.greater'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.IdentityOp(output, input1, *, loc=None, ip=None)

Returns a tensor with the same shape, type, and contents as the input.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.IdentityOpAdaptor

OPERATION_NAME = 'tosa.identity'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.IdentityOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.identity'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.IfOp(output_list, condition, input_list, *, loc=None, ip=None)

Evaluates a Boolean condition and then takes one of two distinct execution paths. This implements the semantic If-then-else structure.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.IfOpAdaptor

OPERATION_NAME = 'tosa.cond_if'
property condition: iree.compiler._mlir_libs._mlir.ir.Value
property else_graph: iree.compiler._mlir_libs._mlir.ir.Region
property input_list: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property output_list: iree.compiler._mlir_libs._mlir.ir.OpResultList
property then_graph: iree.compiler._mlir_libs._mlir.ir.Region
class iree.compiler.dialects.tosa.IfOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.cond_if'
property condition: iree.compiler._mlir_libs._mlir.ir.Value
property input_list: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.tosa.IntDivOp(output, input1, input2, *, loc=None, ip=None)

Elementwise integer divide of input1 by input2. Axis of size 1 will be broadcast as necessary. Rank of input tensors must match. The result of the divide is truncated towards zero. Expected use is for operations on non-scaled integers. Floating point divide should use RECIPROCAL and MUL. Quantized integer divide should use TABLE (for 1/x) and MUL.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.IntDivOpAdaptor

OPERATION_NAME = 'tosa.intdiv'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.IntDivOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.intdiv'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.Log2CeilShapeOp(output, input, *, loc=None, ip=None)

Computation of the base two logarithm of each element in input. Result is rounded up.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.Log2CeilShapeOpAdaptor

OPERATION_NAME = 'tosa.log2_ceil_shape'
property input: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.Log2CeilShapeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.log2_ceil_shape'
property input: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.Log2FloorShapeOp(output, input, *, loc=None, ip=None)

Computation of the base two logarithm of each element in input. Result is rounded down.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.Log2FloorShapeOpAdaptor

OPERATION_NAME = 'tosa.log2_floor_shape'
property input: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.Log2FloorShapeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.log2_floor_shape'
property input: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.LogOp(output, input1, *, loc=None, ip=None)

Elementwise natural logarithm operation

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.LogOpAdaptor

OPERATION_NAME = 'tosa.log'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.LogOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.log'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.LogicalAndOp(output, input1, input2, *, loc=None, ip=None)

Elementwise logical AND of input1 and input2. Axis of size 1 will be broadcast, as necessary. Rank of input tensors must match.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.LogicalAndOpAdaptor

OPERATION_NAME = 'tosa.logical_and'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.LogicalAndOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.logical_and'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.LogicalLeftShiftOp(output, input1, input2, *, loc=None, ip=None)

Elementwise logical left-shift of input1 by the amount specified in input2. Axis of size 1 will be broadcast, as necessary. Rank of input tensors must match.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.LogicalLeftShiftOpAdaptor

OPERATION_NAME = 'tosa.logical_left_shift'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.LogicalLeftShiftOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.logical_left_shift'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.LogicalNotOp(output, input1, *, loc=None, ip=None)

Elementwise logical NOT of input.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.LogicalNotOpAdaptor

OPERATION_NAME = 'tosa.logical_not'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.LogicalNotOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.logical_not'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.LogicalOrOp(output, input1, input2, *, loc=None, ip=None)

Elementwise logical OR of input1 and input2. Axis of size 1 will be broadcast as necessary. Rank of input tensors must match.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.LogicalOrOpAdaptor

OPERATION_NAME = 'tosa.logical_or'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.LogicalOrOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.logical_or'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.LogicalRightShiftOp(output, input1, input2, *, loc=None, ip=None)

Elementwise logical right shift of input1 by the amount specified in input2. Axis of size 1 will be broadcast, as necessary. Rank of input tensors must match.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.LogicalRightShiftOpAdaptor

OPERATION_NAME = 'tosa.logical_right_shift'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.LogicalRightShiftOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.logical_right_shift'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.LogicalXorOp(output, input1, input2, *, loc=None, ip=None)

Elementwise logical XOR of input1 and input2. Axis of size 1 will be broadcast as necessary. Rank of input tensors must match.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.LogicalXorOpAdaptor

OPERATION_NAME = 'tosa.logical_xor'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.LogicalXorOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.logical_xor'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.MatMulOp(output, a, b, a_zp, b_zp, *, loc=None, ip=None)

Performs two dimensional matrix multiplications.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.MatMulOpAdaptor

OPERATION_NAME = 'tosa.matmul'
property a: iree.compiler._mlir_libs._mlir.ir.Value
property a_zp: iree.compiler._mlir_libs._mlir.ir.Value
property b: iree.compiler._mlir_libs._mlir.ir.Value
property b_zp: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.MatMulOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.matmul'
property a: iree.compiler._mlir_libs._mlir.ir.Value
property a_zp: iree.compiler._mlir_libs._mlir.ir.Value
property b: iree.compiler._mlir_libs._mlir.ir.Value
property b_zp: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.MatmulTBlockScaledOp(output_data, a_data, a_scale, b_data, b_scale, block_size, *, loc=None, ip=None)

Performs two dimensional matrix multiplications using block scaled tensors. The block dimension is always the the last dimension of the tensor, so the result is effectively a matrix multiply of A by the transposed B matrix. If the N dimension of input B is of size 1, the B matrix will be broadcast.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.MatmulTBlockScaledOpAdaptor

OPERATION_NAME = 'tosa.matmul_t_block_scaled'
property a_data: iree.compiler._mlir_libs._mlir.ir.Value
property a_scale: iree.compiler._mlir_libs._mlir.ir.Value
property b_data: iree.compiler._mlir_libs._mlir.ir.Value
property b_scale: iree.compiler._mlir_libs._mlir.ir.Value
property block_size: iree.compiler._mlir_libs._mlir.ir.Attribute
property output_data: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.MatmulTBlockScaledOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.matmul_t_block_scaled'
property a_data: iree.compiler._mlir_libs._mlir.ir.Value
property a_scale: iree.compiler._mlir_libs._mlir.ir.Value
property b_data: iree.compiler._mlir_libs._mlir.ir.Value
property b_scale: iree.compiler._mlir_libs._mlir.ir.Value
property block_size: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.tosa.MaxPool2dOp(output, input, kernel, stride, pad, *, nan_mode=None, loc=None, ip=None)

This performs a max pooling over the given input tensor. A sliding window of size given by <kernel size> is passed over the input tensor, with the maximum value being placed in the output tensor.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.MaxPool2dOpAdaptor

OPERATION_NAME = 'tosa.max_pool2d'
property input: iree.compiler._mlir_libs._mlir.ir.Value
property kernel: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property nan_mode: iree.compiler._mlir_libs._mlir.ir.Attribute
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
property pad: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property stride: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
class iree.compiler.dialects.tosa.MaxPool2dOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.max_pool2d'
property input: iree.compiler._mlir_libs._mlir.ir.Value
property kernel: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property nan_mode: iree.compiler._mlir_libs._mlir.ir.Attribute
property pad: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property stride: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
class iree.compiler.dialects.tosa.MaxShapeOp(output, input1, input2, *, loc=None, ip=None)

Elementwise maximum of input1 and input2.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.MaxShapeOpAdaptor

OPERATION_NAME = 'tosa.max_shape'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.MaxShapeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.max_shape'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.MaximumOp(output, input1, input2, *, nan_mode=None, loc=None, ip=None)

Elementwise max of input1 and input2. Axis of size 1 will be broadcast, as necessary. Rank of input tensors must match.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.MaximumOpAdaptor

OPERATION_NAME = 'tosa.maximum'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property nan_mode: iree.compiler._mlir_libs._mlir.ir.Attribute
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.MaximumOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.maximum'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property nan_mode: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.tosa.MinShapeOp(output, input1, input2, *, loc=None, ip=None)

Elementwise minimum of input1 and input2.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.MinShapeOpAdaptor

OPERATION_NAME = 'tosa.min_shape'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.MinShapeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.min_shape'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.MinimumOp(output, input1, input2, *, nan_mode=None, loc=None, ip=None)

Elementwise minimum of input1 and input2. Axis of size 1 will be broadcast, as necessary. Rank of input tensors must match.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.MinimumOpAdaptor

OPERATION_NAME = 'tosa.minimum'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property nan_mode: iree.compiler._mlir_libs._mlir.ir.Attribute
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.MinimumOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.minimum'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property nan_mode: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.tosa.ModShapeOp(output, input1, input2, *, loc=None, ip=None)

Elementwise modulo of input1 divided by input2.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.ModShapeOpAdaptor

OPERATION_NAME = 'tosa.mod_shape'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.ModShapeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.mod_shape'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.MulOp(output, input1, input2, shift, *, loc=None, ip=None)

Elementwise multiplication (Hadamard product) of input1 and input2. Axis of size 1 will be broadcast, as necessary. Rank of input tensors must match.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.MulOpAdaptor

OPERATION_NAME = 'tosa.mul'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
property shift: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.MulOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.mul'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property shift: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.MulShapeOp(output, input1, input2, *, loc=None, ip=None)

Elementwise multiplication of input1 and input2.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.MulShapeOpAdaptor

OPERATION_NAME = 'tosa.mul_shape'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.MulShapeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.mul_shape'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.NegateOp(output, input1, input1_zp, output_zp, *, loc=None, ip=None)

Elementwise negation operation.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.NegateOpAdaptor

OPERATION_NAME = 'tosa.negate'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input1_zp: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
property output_zp: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.NegateOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.negate'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input1_zp: iree.compiler._mlir_libs._mlir.ir.Value
property output_zp: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.PadOp(output, input1, padding, pad_const, *, loc=None, ip=None)

Pads a tensor along the borders of each dimension with a supplied value. Returns a new tensor with the padding included. The pad_const value includes the zero point if the tensor uses a zero point.

Example:

`mlir %pad_const = "tosa.const"() {values = dense<3.14> : tensor<1xf32>} : () -> tensor<1xf32> %padding = tosa.const_shape {values = dense<[1, 2, 3, 4]> : tensor<4xindex>} : () -> !tosa.shape<4> tosa.pad %arg0, %padding, %pad_const: (tensor<1x2xf32>, !tosa.shape<4>, tensor<1xf32>)  -> (tensor<4x9xf32>) `

Example 2:

`mlir %pad_const = "tosa.const"() {values = dense<3.14> : tensor<1xf32>} : () -> tensor<1xf32> %padding = tosa.const_shape {values = dense<[-1, 2, 3, 4]> : tensor<4xindex>} : () -> !tosa.shape<4> tosa.pad %arg0, %padding, %pad_const : (tensor<1x2xf32>, !tosa.shape<4>, tensor<1xf32>)  -> (tensor<?x9xf32>) `

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.PadOpAdaptor

OPERATION_NAME = 'tosa.pad'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
property pad_const: iree.compiler._mlir_libs._mlir.ir.Value
property padding: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.PadOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.pad'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property pad_const: iree.compiler._mlir_libs._mlir.ir.Value
property padding: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.PowOp(output, input1, input2, *, loc=None, ip=None)

Elementwise input1 value raised to the power of input2. Axis of size 1 will be broadcast, as necessary. Rank of input tensors must match.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.PowOpAdaptor

OPERATION_NAME = 'tosa.pow'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.PowOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.pow'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.RFFT2dOp(output_real, output_imag, input_real, *, local_bound=None, loc=None, ip=None)

Performs a batched 2D real-valued Fast Fourier Transform over the input where the input tensor consists of real values producing complex valued output. The complex output values will be split into the output_real and output_imag tensor arguments. RFFT2D takes advantage of Hermitian symmetry to only calculate the first half of the final output axis. Implementations may choose to skip calculation of the imaginary values at (0,0), (0,W/2), (H/2,0), and (H/2, W/2). If the calculation is skipped, the result at that location must be zero.

Example:

```mlir

%ouput_real, %output_imag = tosa.rfft2d %input_real : (tensor<8x16xf32>) -> (tensor<8x9xf32>, tensor<8x9xf32>)

```

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.RFFT2dOpAdaptor

OPERATION_NAME = 'tosa.rfft2d'
property input_real: iree.compiler._mlir_libs._mlir.ir.Value
property local_bound: Optional[iree.compiler._mlir_libs._mlir.ir.BoolAttr]
property output_imag: iree.compiler._mlir_libs._mlir.ir.OpResult
property output_real: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.RFFT2dOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.rfft2d'
property input_real: iree.compiler._mlir_libs._mlir.ir.Value
property local_bound: Optional[iree.compiler._mlir_libs._mlir.ir.BoolAttr]
class iree.compiler.dialects.tosa.ReciprocalOp(output, input1, *, loc=None, ip=None)

Elementwise reciprocal operation. For integer operation, a TABLE should be used with the appropriate ranges.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.ReciprocalOpAdaptor

OPERATION_NAME = 'tosa.reciprocal'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.ReciprocalOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.reciprocal'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.ReduceAllOp(input, axis, *, results=None, loc=None, ip=None)

Reduce a tensor along the given axis with a logical AND operation.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.ReduceAllOpAdaptor

OPERATION_NAME = 'tosa.reduce_all'
property axis: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property input: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.ReduceAllOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.reduce_all'
property axis: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property input: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.ReduceAnyOp(input, axis, *, results=None, loc=None, ip=None)

Reduce a tensor along the given axis with a logical OR operation.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.ReduceAnyOpAdaptor

OPERATION_NAME = 'tosa.reduce_any'
property axis: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property input: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.ReduceAnyOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.reduce_any'
property axis: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property input: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.ReduceMaxOp(input, axis, *, nan_mode=None, results=None, loc=None, ip=None)

Reduce a tensor along the given axis with a maximum operation.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.ReduceMaxOpAdaptor

OPERATION_NAME = 'tosa.reduce_max'
property axis: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property input: iree.compiler._mlir_libs._mlir.ir.Value
property nan_mode: iree.compiler._mlir_libs._mlir.ir.Attribute
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.ReduceMaxOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.reduce_max'
property axis: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property input: iree.compiler._mlir_libs._mlir.ir.Value
property nan_mode: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.tosa.ReduceMinOp(input, axis, *, nan_mode=None, results=None, loc=None, ip=None)

Reduce a tensor along the given axis with a minimum operation.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.ReduceMinOpAdaptor

OPERATION_NAME = 'tosa.reduce_min'
property axis: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property input: iree.compiler._mlir_libs._mlir.ir.Value
property nan_mode: iree.compiler._mlir_libs._mlir.ir.Attribute
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.ReduceMinOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.reduce_min'
property axis: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property input: iree.compiler._mlir_libs._mlir.ir.Value
property nan_mode: iree.compiler._mlir_libs._mlir.ir.Attribute
class iree.compiler.dialects.tosa.ReduceProductOp(input, axis, *, results=None, loc=None, ip=None)

Reduce a tensor along the given axis by computing the product of the axis.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.ReduceProductOpAdaptor

OPERATION_NAME = 'tosa.reduce_product'
property axis: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property input: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.ReduceProductOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.reduce_product'
property axis: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property input: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.ReduceSumOp(input, axis, *, results=None, loc=None, ip=None)

Reduce a tensor along the given axis by computing the sum of the axis.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.ReduceSumOpAdaptor

OPERATION_NAME = 'tosa.reduce_sum'
property axis: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property input: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.ReduceSumOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.reduce_sum'
property axis: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property input: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.RescaleOp(output, input, multiplier, shift, input_zp, output_zp, scale32, rounding_mode, per_channel, input_unsigned, output_unsigned, *, loc=None, ip=None)

RESCALE is defined using an integer multiply, add, and shift.

Rescale supports two precisions of multiplier: 16-bit and 32-bit. The 32-bit multiplier version supports two rounding modes to enable simpler lowering of existing frameworks that use two stage rounding. All arithmetic is designed so that it does not overflow a 64-bit accumulator and that the result fits in 32 bits. In particular, a 48-bit value cannot be scaled with the 32-bit multiplier because the accumulator would need to have 80 bits.

The shift and value range are limited to allow a variety of implementations. The limit of 62 on shift allows the shift to be decomposed as two right shifts of 31.

Supported rescalings: * This table is showing the supported conversions from the TOSA Specification. * The MLIR dialect here can be used to represent other conversions.

Mode | Input | Output | Unsigned input | Unsigned output |

|------------------------|——-|--------|—————-|-----------------| | signed 16 to 16 | int16 | int16 | false | false | | signed 16 to 32 | int16 | int32 | false | false | | signed 16 to 8 | int16 | int8 | false | false | | signed 32 to 16 | int32 | int16 | false | false | | signed 32 to 32 | int32 | int32 | false | false | | signed 32 to 8 | int32 | int8 | false | false | | signed 8 to 16 | int8 | int16 | false | false | | signed 8 to 32 | int8 | int32 | false | false | | signed 8 to 8 | int8 | int8 | false | false | | signed 48 to 16 | int48 | int16 | false | false | | signed 48 to 32 | int48 | int32 | false | false | | signed 48 to 8 | int48 | int8 | false | false | | unsigned 8 to signed 8 | uint8 | int8 | true | false | | signed 8 to unsigned 8 | int8 | uint8 | false | true |

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.RescaleOpAdaptor

OPERATION_NAME = 'tosa.rescale'
property input: iree.compiler._mlir_libs._mlir.ir.Value
property input_unsigned: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property input_zp: iree.compiler._mlir_libs._mlir.ir.Value
property multiplier: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
property output_unsigned: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property output_zp: iree.compiler._mlir_libs._mlir.ir.Value
property per_channel: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property rounding_mode: iree.compiler._mlir_libs._mlir.ir.Attribute
property scale32: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property shift: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
class iree.compiler.dialects.tosa.RescaleOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.rescale'
property input: iree.compiler._mlir_libs._mlir.ir.Value
property input_unsigned: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property input_zp: iree.compiler._mlir_libs._mlir.ir.Value
property multiplier: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
property output_unsigned: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property output_zp: iree.compiler._mlir_libs._mlir.ir.Value
property per_channel: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property rounding_mode: iree.compiler._mlir_libs._mlir.ir.Attribute
property scale32: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property shift: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]
class iree.compiler.dialects.tosa.ReshapeOp(input1, shape, *, results=None, loc=None, ip=None)

Returns a tensor with the same type/values as the input, with a new shape specified by the shape argument. Reshape may operate on tensors of any rank. No data conversion happens during a reshape operation.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.ReshapeOpAdaptor

OPERATION_NAME = 'tosa.reshape'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
property shape: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.ReshapeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.reshape'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property shape: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.ResizeOp(output, input, scale, offset, border, mode, *, loc=None, ip=None)

Resizes a tensor. Resize is only allowed in the H and W dimensions.

The height dimension is scaled by factor (scale_y_n/scale_y_d). The width dimension is scaled by factor (scale_x_n/scale_x_d).

The NEAREST_NEIGHBOR mode returns the value of the input tensor closest to the calculated sample position for both floating-point and integer data formats.

Floating-point BILINEAR mode returns a bilinearly interpolated output value based on the four closest input sample positions.

For integer BILINEAR interpolation mode, the output value must be scaled by 1/(scale_y_n * scale_x_n) in a following operation to complete the interpolation (for example with a RESCALE operator).

The output dimensions can be derived from the input dimensions by inverting the scale as described in the pseudocode. The [border_y, border_x] values adjust the output size to allow fractional sampling beyond integer input position (IH - 1,IW - 1).

The limit MAX_SCALE is applied to each scale ratio after reduction of the ratio. Individual scale numerator and denominator values are allowed to be larger than MAX_SCALE.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.ResizeOpAdaptor

OPERATION_NAME = 'tosa.resize'
property border: iree.compiler._mlir_libs._mlir.ir.Value
property input: iree.compiler._mlir_libs._mlir.ir.Value
property mode: iree.compiler._mlir_libs._mlir.ir.Attribute
property offset: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
property scale: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.ResizeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.resize'
property border: iree.compiler._mlir_libs._mlir.ir.Value
property input: iree.compiler._mlir_libs._mlir.ir.Value
property mode: iree.compiler._mlir_libs._mlir.ir.Attribute
property offset: iree.compiler._mlir_libs._mlir.ir.Value
property scale: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.ReverseOp(output, input1, axis, *, loc=None, ip=None)

Returns a tensor with the same type/values as the input, with the data reversed along the given axis. No data conversion happens during a reverse operation.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.ReverseOpAdaptor

OPERATION_NAME = 'tosa.reverse'
property axis: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.ReverseOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.reverse'
property axis: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property input1: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.RsqrtOp(output, input1, *, loc=None, ip=None)

Elementwise reciprocal square root operation. For integer operation, a TABLE should be used with the appropriate ranges.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.RsqrtOpAdaptor

OPERATION_NAME = 'tosa.rsqrt'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.RsqrtOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.rsqrt'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.ScatterOp(values_out, values_in, indices, input, *, loc=None, ip=None)

The values_out tensor is set to the values_in tensor with data modified as follows: data from the input tensor is inserted at the positions specified by the indices tensor. N is the number of batches, W the number of indices in each batch, K the range of each index and C the number data channels for each index. It is not permitted to repeat the same output index within a single SCATTER operation and so each output index occurs at most once. It follows that K >= W. In use cases that require multiple updates to the same output position, these must be decomposed into multiple SCATTER operations.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.ScatterOpAdaptor

OPERATION_NAME = 'tosa.scatter'
property indices: iree.compiler._mlir_libs._mlir.ir.Value
property input: iree.compiler._mlir_libs._mlir.ir.Value
property values_in: iree.compiler._mlir_libs._mlir.ir.Value
property values_out: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.ScatterOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.scatter'
property indices: iree.compiler._mlir_libs._mlir.ir.Value
property input: iree.compiler._mlir_libs._mlir.ir.Value
property values_in: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.SelectOp(output, input1, input2, input3, *, loc=None, ip=None)

Elementwise select of the output based on a condition.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.SelectOpAdaptor

OPERATION_NAME = 'tosa.select'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property input3: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.SelectOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.select'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property input3: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.SigmoidOp(output, input, *, loc=None, ip=None)

Applies the sigmoid logistic function to each element of the input tensor: $ sigmoid(x) = frac{1}{1 + e^{-x}} $.

For quantized integer data types, the TABLE operator should be used instead. Each implementation may choose an appropriate TABLE given the scale and zero point of the input data. Eight or sixteen bit precision tables may be used based on the input tensor to the sigmoid function.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.SigmoidOpAdaptor

OPERATION_NAME = 'tosa.sigmoid'
property input: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.SigmoidOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.sigmoid'
property input: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.SinOp(output, input1, *, loc=None, ip=None)

Elementwise sine operation for values given in radians.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.SinOpAdaptor

OPERATION_NAME = 'tosa.sin'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.SinOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.sin'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.SliceOp(output, input1, start, size, *, loc=None, ip=None)

Extracts a slice of input1, beginning at the start coordinates, and extending for size elements in each direction. No data conversion happens during a slice operation.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.SliceOpAdaptor

OPERATION_NAME = 'tosa.slice'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
property size: iree.compiler._mlir_libs._mlir.ir.Value
property start: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.SliceOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.slice'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property size: iree.compiler._mlir_libs._mlir.ir.Value
property start: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.SliceShapeOp(output, input, start, size, *, loc=None, ip=None)

Extract a shape of size from input.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.SliceShapeOpAdaptor

OPERATION_NAME = 'tosa.slice_shape'
property input: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
property size: iree.compiler._mlir_libs._mlir.ir.Value
property start: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.SliceShapeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.slice_shape'
property input: iree.compiler._mlir_libs._mlir.ir.Value
property size: iree.compiler._mlir_libs._mlir.ir.Value
property start: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.SubOp(output, input1, input2, *, loc=None, ip=None)

Elementwise subtraction of input1 and input2. Axis of size 1 will be broadcast as necessary. Rank of input tensors must match.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.SubOpAdaptor

OPERATION_NAME = 'tosa.sub'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.SubOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.sub'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.SubShapeOp(output, input1, input2, *, loc=None, ip=None)

Elementwise subtraction of input1 and input2. Size of shapes must match.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.SubShapeOpAdaptor

OPERATION_NAME = 'tosa.sub_shape'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.SubShapeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.sub_shape'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property input2: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.TableOp(output, input1, table, *, loc=None, ip=None)

Table lookup operation. For int8_t TABLE operation, perform a 256 entry table lookup returning an int8_t value. For int16_t tables, the int16_t input is treated as a fixed-point 9.7 value. The most significant 9 bits are used to index into the table. The fractional 7 bits are used to interpolate based on table[index] and table[index+1]. For int16_t inputs, the TABLE operator returns a 16.7 interpolated value in an int32_t. This value can then be input to the RESCALE operator to scale to the required output data type. Note that int16_t table has 513 values to handle table[index+1] when index=511.

An int16_t to int16_t table lookup can be constructed in TOSA as follows: * Use the TABLE operator to produce a fixed point 16.7 interpolated result * Use RESCALE (in_t=int32_t, out_t=int16_t, scale=1<<14, shift=21) to

scale the output to int16_t range (or alternate scale as required)

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.TableOpAdaptor

OPERATION_NAME = 'tosa.table'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
property table: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.TableOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.table'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property table: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.TanhOp(output, input, *, loc=None, ip=None)

Parameterized hyperbolic tangent: $ tanh(x) = frac{1 - e^{-2x}}{1 + e^{-2x}} $.

For quantized integer data types, the TABLE operator should be used instead. Each implementation may choose an appropriate TABLE given the scale and zero point of the input data. Eight or sixteen bit precision tables may be used based on the input tensor to the tanh function.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.TanhOpAdaptor

OPERATION_NAME = 'tosa.tanh'
property input: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.TanhOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.tanh'
property input: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.TileOp(output, input1, multiples, *, loc=None, ip=None)

Replicates input1 multiples times along each dimension.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.TileOpAdaptor

OPERATION_NAME = 'tosa.tile'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property multiples: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.TileOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.tile'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property multiples: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.TransposeConv2DOp(output, input, weight, bias, input_zp, weight_zp, out_pad, stride, acc_type, *, local_bound=None, loc=None, ip=None)

Performs a 2D transposed convolution over the given tensor input, using the weights tensor. Implementations may choose to skip calculation of multiplies by zero at fractional input positions.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.TransposeConv2DOpAdaptor

OPERATION_NAME = 'tosa.transpose_conv2d'
property acc_type: iree.compiler._mlir_libs._mlir.ir.TypeAttr
property bias: iree.compiler._mlir_libs._mlir.ir.Value
property input: iree.compiler._mlir_libs._mlir.ir.Value
property input_zp: iree.compiler._mlir_libs._mlir.ir.Value
property local_bound: Optional[iree.compiler._mlir_libs._mlir.ir.BoolAttr]
property out_pad: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
property stride: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property weight: iree.compiler._mlir_libs._mlir.ir.Value
property weight_zp: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.TransposeConv2DOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.transpose_conv2d'
property acc_type: iree.compiler._mlir_libs._mlir.ir.TypeAttr
property bias: iree.compiler._mlir_libs._mlir.ir.Value
property input: iree.compiler._mlir_libs._mlir.ir.Value
property input_zp: iree.compiler._mlir_libs._mlir.ir.Value
property local_bound: Optional[iree.compiler._mlir_libs._mlir.ir.BoolAttr]
property out_pad: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property stride: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property weight: iree.compiler._mlir_libs._mlir.ir.Value
property weight_zp: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.tosa.TransposeOp(output, input1, perms, *, loc=None, ip=None)

Permutes the dimensions of the input tensor input1 based on the perms argument. Each value in the perms list must be a valid dimension of the input tensor and may not be repeated.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.TransposeOpAdaptor

OPERATION_NAME = 'tosa.transpose'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property output: iree.compiler._mlir_libs._mlir.ir.OpResult
property perms: iree.compiler._mlir_libs._mlir.ir.DenseI32ArrayAttr
class iree.compiler.dialects.tosa.TransposeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.transpose'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property perms: iree.compiler._mlir_libs._mlir.ir.DenseI32ArrayAttr
class iree.compiler.dialects.tosa.VariableOp(sym_name, var_shape, type_, *, initial_value=None, loc=None, ip=None)

Defines a new TOSA variable. This is a persistent mutable value across multiple TOSA graph invocations. Modifications are expressed using read/write semantics.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.VariableOpAdaptor

OPERATION_NAME = 'tosa.variable'
property initial_value: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute]
property sym_name: iree.compiler._mlir_libs._mlir.ir.StringAttr
property type_: iree.compiler._mlir_libs._mlir.ir.TypeAttr
property var_shape: iree.compiler._mlir_libs._mlir.ir.DenseIntElementsAttr
class iree.compiler.dialects.tosa.VariableOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.variable'
property initial_value: Optional[iree.compiler._mlir_libs._mlir.ir.Attribute]
property sym_name: iree.compiler._mlir_libs._mlir.ir.StringAttr
property type_: iree.compiler._mlir_libs._mlir.ir.TypeAttr
property var_shape: iree.compiler._mlir_libs._mlir.ir.DenseIntElementsAttr
class iree.compiler.dialects.tosa.VariableReadOp(output1, name, *, loc=None, ip=None)

Reads the value from a pseudo-buffer resource holding a persistent mutable tensor.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.VariableReadOpAdaptor

OPERATION_NAME = 'tosa.variable_read'
property name: iree.compiler._mlir_libs._mlir.ir.StringAttr

Returns the fully qualified name of the operation.

property output1: iree.compiler._mlir_libs._mlir.ir.OpResult
class iree.compiler.dialects.tosa.VariableReadOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.variable_read'
property name: iree.compiler._mlir_libs._mlir.ir.StringAttr
class iree.compiler.dialects.tosa.VariableWriteOp(name, input1, *, loc=None, ip=None)

Assigns a value to the pseudo-buffer resource holding a persistent mutable tensor.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.VariableWriteOpAdaptor

OPERATION_NAME = 'tosa.variable_write'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property name: iree.compiler._mlir_libs._mlir.ir.StringAttr

Returns the fully qualified name of the operation.

class iree.compiler.dialects.tosa.VariableWriteOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.variable_write'
property input1: iree.compiler._mlir_libs._mlir.ir.Value
property name: iree.compiler._mlir_libs._mlir.ir.StringAttr
class iree.compiler.dialects.tosa.WhileOp(output_list, input_list, *, loc=None, ip=None)

Generates and evaluates a Boolean condition and either executes a loop body or exits the loop. This action is performed repeatedly after updating and re-evaluating the Boolean condition every iteration. This implements the semantic foreach or while iterative loop structure.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.WhileOpAdaptor

OPERATION_NAME = 'tosa.while_loop'
property body_graph: iree.compiler._mlir_libs._mlir.ir.Region
property cond_graph: iree.compiler._mlir_libs._mlir.ir.Region
property input_list: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property output_list: iree.compiler._mlir_libs._mlir.ir.OpResultList
class iree.compiler.dialects.tosa.WhileOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.while_loop'
property input_list: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.tosa.YieldOp(inputs, *, loc=None, ip=None)

return operation within the conditional and body of structured control flow. Operation takes variadic operands but produces no results of its own.

Adaptor

alias of iree.compiler.dialects._tosa_ops_gen.YieldOpAdaptor

OPERATION_NAME = 'tosa.yield'
property inputs: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.tosa.YieldOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'tosa.yield'
property inputs: iree.compiler._mlir_libs._mlir.ir.OpOperandList
iree.compiler.dialects.tosa.abs(output, input1, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.add(output, input1, input2, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.add_shape(output, input1, input2, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.apply_scale(output, value, multiplier, shift, rounding_mode, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.argmax(output, input, axis, *, nan_mode=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.arithmetic_right_shift(output, input1, input2, round, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.assert_equal_shape(input1, input2, allow_broadcast, *, loc=None, ip=None) iree.compiler.dialects._tosa_ops_gen.AssertEqualShapeOp
iree.compiler.dialects.tosa.avg_pool2d(output, input, input_zp, output_zp, kernel, stride, pad, acc_type, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.bitwise_and(output, input1, input2, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.bitwise_not(output, input1, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.bitwise_or(output, input1, input2, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.bitwise_xor(output, input1, input2, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.cast(output, input, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.cast_from_block_scaled(output_data, input_data, input_scale, block_size, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.cast_to_block_scaled(output_data, output_scale, input_data, block_size, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResultList
iree.compiler.dialects.tosa.ceil(output, input1, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.clamp(output, input, min_val, max_val, *, nan_mode=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.clz(output, input1, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.concat(input1, axis, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.concat_shape(output, input, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.cond_if(output_list, condition, input_list, *, loc=None, ip=None) Union[iree.compiler._mlir_libs._mlir.ir.OpResult, iree.compiler._mlir_libs._mlir.ir.OpResultList, iree.compiler.dialects._tosa_ops_gen.IfOp]
iree.compiler.dialects.tosa.const(values, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.const_shape(output, values, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.conv2d(output, input, weight, bias, input_zp, weight_zp, pad, stride, dilation, acc_type, *, local_bound=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.conv2d_block_scaled(output, input_data, input_scale, weight_data, weight_scale, bias, pad, stride, dilation, block_size, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.conv3d(output, input, weight, bias, input_zp, weight_zp, pad, stride, dilation, acc_type, *, local_bound=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.cos(output, input1, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.custom(output_list, operator_name, domain_name, implementation_attrs, input_list, *, loc=None, ip=None) Union[iree.compiler._mlir_libs._mlir.ir.OpResult, iree.compiler._mlir_libs._mlir.ir.OpResultList, iree.compiler.dialects._tosa_ops_gen.CustomOp]
iree.compiler.dialects.tosa.depthwise_conv2d(output, input, weight, bias, input_zp, weight_zp, pad, stride, dilation, acc_type, *, local_bound=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.dim(output, input1, axis, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.div_ceil_shape(output, input1, input2, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.div_floor_shape(output, input1, input2, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.equal(input1, input2, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.erf(output, input, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.exp(output, input1, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.exp2_shape(output, input, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.fft2d(output_real, output_imag, input_real, input_imag, inverse, *, local_bound=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResultList
iree.compiler.dialects.tosa.floor(output, input1, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.gather(output, values, indices, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.greater(output, input1, input2, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.greater_equal(output, input1, input2, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.identity(output, input1, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.intdiv(output, input1, input2, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.log(output, input1, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.log2_ceil_shape(output, input, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.log2_floor_shape(output, input, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.logical_and(output, input1, input2, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.logical_left_shift(output, input1, input2, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.logical_not(output, input1, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.logical_or(output, input1, input2, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.logical_right_shift(output, input1, input2, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.logical_xor(output, input1, input2, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.matmul(output, a, b, a_zp, b_zp, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.matmul_t_block_scaled(output_data, a_data, a_scale, b_data, b_scale, block_size, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.max_pool2d(output, input, kernel, stride, pad, *, nan_mode=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.max_shape(output, input1, input2, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.maximum(output, input1, input2, *, nan_mode=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.min_shape(output, input1, input2, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.minimum(output, input1, input2, *, nan_mode=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.mod_shape(output, input1, input2, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.mul(output, input1, input2, shift, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.mul_shape(output, input1, input2, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.negate(output, input1, input1_zp, output_zp, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.pad(output, input1, padding, pad_const, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.pow(output, input1, input2, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.reciprocal(output, input1, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.reduce_all(input, axis, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.reduce_any(input, axis, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.reduce_max(input, axis, *, nan_mode=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.reduce_min(input, axis, *, nan_mode=None, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.reduce_product(input, axis, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.reduce_sum(input, axis, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.rescale(output, input, multiplier, shift, input_zp, output_zp, scale32, rounding_mode, per_channel, input_unsigned, output_unsigned, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.reshape(input1, shape, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.resize(output, input, scale, offset, border, mode, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.reverse(output, input1, axis, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.rfft2d(output_real, output_imag, input_real, *, local_bound=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResultList
iree.compiler.dialects.tosa.rsqrt(output, input1, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.scatter(values_out, values_in, indices, input, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.select(output, input1, input2, input3, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.sigmoid(output, input, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.sin(output, input1, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.slice(output, input1, start, size, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.slice_shape(output, input, start, size, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.sub(output, input1, input2, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.sub_shape(output, input1, input2, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.table(output, input1, table, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.tanh(output, input, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.tile(output, input1, multiples, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.transpose(output, input1, perms, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.transpose_conv2d(output, input, weight, bias, input_zp, weight_zp, out_pad, stride, acc_type, *, local_bound=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.variable(sym_name, var_shape, type_, *, initial_value=None, loc=None, ip=None) iree.compiler.dialects._tosa_ops_gen.VariableOp
iree.compiler.dialects.tosa.variable_read(output1, name, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.tosa.variable_write(name, input1, *, loc=None, ip=None) iree.compiler.dialects._tosa_ops_gen.VariableWriteOp
iree.compiler.dialects.tosa.while_loop(output_list, input_list, *, loc=None, ip=None) Union[iree.compiler._mlir_libs._mlir.ir.OpResult, iree.compiler._mlir_libs._mlir.ir.OpResultList, iree.compiler.dialects._tosa_ops_gen.WhileOp]
iree.compiler.dialects.tosa.yield_(inputs, *, loc=None, ip=None) iree.compiler.dialects._tosa_ops_gen.YieldOp

vector dialect

class iree.compiler.dialects.vector.BitCastOp(result, source, *, loc=None, ip=None)

The bitcast operation casts between vectors of the same rank, the minor 1-D vector size is casted to a vector with a different element type but same bitwidth. In case of 0-D vectors, the bitwidth of element types must be equal.

Example:

```mlir // Example casting to a smaller element type. %1 = vector.bitcast %0 : vector<5x1x4x3xf32> to vector<5x1x4x6xi16>

// Example casting to a bigger element type. %3 = vector.bitcast %2 : vector<10x12x8xi8> to vector<10x12x2xi32>

// Example casting to an element type of the same size. %5 = vector.bitcast %4 : vector<5x1x4x3xf32> to vector<5x1x4x3xi32>

// Example casting of 0-D vectors. %7 = vector.bitcast %6 : vector<f32> to vector<i32> ```

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.BitCastOpAdaptor

OPERATION_NAME = 'vector.bitcast'
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.VectorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.BitCastOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.bitcast'
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.BroadcastOp(vector, source, *, loc=None, ip=None)

Broadcasts the scalar or k-D vector value in the source operand to a n-D result vector such that the broadcast makes sense, i.e., the source operand is duplicated to match the given rank and sizes in the result vector. The legality rules are: * the source operand must have the same element type as the result type * a k-D vector <s_1 x .. x s_k x type> can be broadcast to

a n-D vector <t_1 x .. x t_n x type> if
  • k <= n, and

  • the sizes in the trailing dimensions n-k < i <= n with j=i+k-n

    match exactly as s_j = t_i or s_j = 1:

```
t_1 x .. t_n-k x t_n-k+1 x .. x t_i x .. x t_n

s_1 x .. x s_j x .. x s_k

<duplication> <potential stretch>

``` * in addition, any scalable unit dimension, [1], must match exactly.

The source operand is duplicated over all the missing leading dimensions and stretched over the trailing dimensions where the source has a non-equal dimension of 1 (stretching a trailing dimension is also referred to as “dim-1” broadcasting). These rules imply that any scalar broadcast (k=0) to any shaped vector with the same element type is always legal.

Example:

`mlir %0 = arith.constant 0.0 : f32 %1 = vector.broadcast %0 : f32 to vector<16xf32> %2 = vector.broadcast %1 : vector<16xf32> to vector<4x16xf32> `

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.BroadcastOpAdaptor

OPERATION_NAME = 'vector.broadcast'
property source: iree.compiler._mlir_libs._mlir.ir.Value
property vector: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.BroadcastOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.broadcast'
property source: iree.compiler._mlir_libs._mlir.ir.Value
enum iree.compiler.dialects.vector.CombiningKind(value)

Kind of combining function for contractions and reductions

Member Type

int

Valid values are as follows:

ADD = <CombiningKind.ADD: 0>
MUL = <CombiningKind.MUL: 1>
MINUI = <CombiningKind.MINUI: 2>
MINSI = <CombiningKind.MINSI: 3>
MINNUMF = <CombiningKind.MINNUMF: 4>
MAXUI = <CombiningKind.MAXUI: 5>
MAXSI = <CombiningKind.MAXSI: 6>
MAXNUMF = <CombiningKind.MAXNUMF: 7>
AND = <CombiningKind.AND: 8>
OR = <CombiningKind.OR: 9>
XOR = <CombiningKind.XOR: 10>
MAXIMUMF = <CombiningKind.MAXIMUMF: 12>
MINIMUMF = <CombiningKind.MINIMUMF: 11>
class iree.compiler.dialects.vector.CompressStoreOp(base, indices, mask, valueToStore, *, alignment=None, loc=None, ip=None)

The compress store operation writes elements from a vector into memory as defined by a base with indices and a mask vector. Compression only applies to the innermost dimension. When the mask is set, the corresponding element from the vector is written next to memory. Otherwise, no action is taken for the element. Informally the semantics are:

` index = i if (mask[0]) base[index++] = value[0] if (mask[1]) base[index++] = value[1] etc. `

Note that the index increment is done conditionally.

If a mask bit is set and the corresponding index is out-of-bounds for the given base, the behavior is undefined. If a mask bit is not set, no value is stored regardless of the index, and the index is allowed to be out-of-bounds.

The compress store can be used directly where applicable, or can be used during progressively lowering to bring other memory operations closer to hardware ISA support for a compress. The semantics of the operation closely correspond to those of the llvm.masked.compressstore [intrinsic](https://llvm.org/docs/LangRef.html#llvm-masked-compressstore-intrinsics).

An optional alignment attribute allows to specify the byte alignment of the store operation. It must be a positive power of 2. The operation must access memory at an address aligned to this boundary. Violating this requirement triggers immediate undefined behavior.

Note, at the moment this Op is only available for fixed-width vectors.

Examples:

```mlir vector.compressstore %base[%i], %mask, %value

: memref<?xf32>, vector<8xi1>, vector<8xf32>

vector.compressstore %base[%i, %j], %mask, %value

: memref<?x?xf32>, vector<16xi1>, vector<16xf32>

```

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.CompressStoreOpAdaptor

OPERATION_NAME = 'vector.compressstore'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property base: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property mask: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property valueToStore: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.CompressStoreOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.compressstore'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property base: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property mask: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property valueToStore: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.ConstantMaskOp(result, mask_dim_sizes, *, loc=None, ip=None)

Creates and returns a vector mask where elements of the result vector are set to ‘0’ or ‘1’, based on whether the element indices are contained within a hyper-rectangular region specified by the ‘mask_dim_sizes’ array attribute argument. Each element of the ‘mask_dim_sizes’ array, specifies an exclusive upper bound [0, mask-dim-size-element-value) for a unique dimension in the vector result. The conjunction of the ranges define a hyper-rectangular region within which elements values are set to 1 (otherwise element values are set to 0). Each value of ‘mask_dim_sizes’ must be non-negative and not greater than the size of the corresponding vector dimension (as opposed to vector.create_mask which allows this). Sizes that correspond to scalable dimensions are implicitly multiplied by vscale, though currently only zero (none set) or the size of the dim/vscale (all set) are supported.

Example:

```mlir // create a constant vector mask of size 4x3xi1 with elements in range // 0 <= row <= 2 and 0 <= col <= 1 are set to 1 (others to 0). %1 = vector.constant_mask [3, 2] : vector<4x3xi1>

print %1

columns

0 1 2

|————

0 | 1 1 0

rows 1 | 1 1 0

2 | 1 1 0 3 | 0 0 0

```

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.ConstantMaskOpAdaptor

OPERATION_NAME = 'vector.constant_mask'
property mask_dim_sizes: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
class iree.compiler.dialects.vector.ConstantMaskOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.constant_mask'
property mask_dim_sizes: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
class iree.compiler.dialects.vector.ContractionOp(result, lhs, rhs, acc, indexing_maps, iterator_types, *, kind=None, loc=None, ip=None)

Computes the sum of products of vector elements along contracting dimension pairs from 2 vectors of rank M and N respectively, adds this intermediate result to the accumulator argument of rank K, and returns a vector result of rank K (where K = num_lhs_free_dims + num_rhs_free_dims + num_batch_dims (see dimension type descriptions below)). For K = 0 (no free or batch dimensions), the accumulator and output are a scalar.

If operands and the result have types of different bitwidths, operands are promoted to have the same bitwidth as the result before performing the contraction. For integer types, only signless integer types are supported, and the promotion happens via sign extension.

An iterator type attribute list must be specified, where each element of the list represents an iterator with one of the following types:

  • “reduction”: reduction dimensions are present in the lhs and rhs arguments but not in the output (and accumulator argument). These are the dimensions along which the vector contraction op computes the sum of products, and contracting dimension pair dimension sizes must match between lhs/rhs.

  • “parallel”: Batch dimensions are iterator type “parallel”, and are non-contracting dimensions present in the lhs, rhs and output. The lhs/rhs co-iterate along the batch dimensions, which should be expressed in their indexing maps.

    Free dimensions are iterator type “parallel”, and are non-contraction, non-batch dimensions accessed by either the lhs or rhs (but not both). The lhs and rhs free dimensions are unrelated to each other and do not co-iterate, which should be expressed in their indexing maps.

An indexing map attribute list must be specified with an entry for lhs, rhs and acc arguments. An indexing map attribute specifies a mapping from each iterator in the iterator type list, to each dimension of an N-D vector.

An optional kind attribute may be used to specify the combining function between the intermediate result and accumulator argument of rank K. This attribute can take the values add/mul/minsi/minui/maxsi/maxui /and/or/xor for integers, and add/mul/minnumf/maxnumf /minimumf/maximumf for floats. The default is add.

Example:

```mlir // Simple DOT product (K = 0). #contraction_accesses = [

affine_map<(i) -> (i)>, affine_map<(i) -> (i)>, affine_map<(i) -> ()>

] #contraction_trait = {

indexing_maps = #contraction_accesses, iterator_types = [“reduction”]

} %3 = vector.contract #contraction_trait %0, %1, %2

: vector<10xf32>, vector<10xf32> into f32

// 2D vector contraction with one contracting dimension (matmul, K = 2). #contraction_accesses = [

affine_map<(i, j, k) -> (i, k)>, affine_map<(i, j, k) -> (k, j)>, affine_map<(i, j, k) -> (i, j)>

] #contraction_trait = {

indexing_maps = #contraction_accesses, iterator_types = [“parallel”, “parallel”, “reduction”]

}

%3 = vector.contract #contraction_trait %0, %1, %2

: vector<4x3xf32>, vector<3x7xf32> into vector<4x7xf32>

// 4D to 3D vector contraction with two contracting dimensions and // one batch dimension (K = 3). #contraction_accesses = [

affine_map<(b0, f0, f1, c0, c1) -> (c0, b0, c1, f0)>, affine_map<(b0, f0, f1, c0, c1) -> (b0, c1, c0, f1)>, affine_map<(b0, f0, f1, c0, c1) -> (b0, f0, f1)>

] #contraction_trait = {

indexing_maps = #contraction_accesses, iterator_types = [“parallel”, “parallel”, “parallel”,

“reduction”, “reduction”]

}

%4 = vector.contract #contraction_trait %0, %1, %2

: vector<7x8x16x15xf32>, vector<8x16x7x5xf32> into vector<8x15x5xf32>

// Vector contraction with mixed typed. lhs/rhs have different element // types than accumulator/result. %5 = vector.contract #contraction_trait %0, %1, %2

: vector<10xf16>, vector<10xf16> into f32

// Contract with max (K = 0). #contraction_accesses = [

affine_map<(i) -> (i)>, affine_map<(i) -> (i)>, affine_map<(i) -> ()>

] #contraction_trait = {

indexing_maps = #contraction_accesses, iterator_types = [“reduction”], kind = #vector.kind<maxnumf>

} %6 = vector.contract #contraction_trait %0, %1, %2

: vector<10xf32>, vector<10xf32> into f32

```

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.ContractionOpAdaptor

OPERATION_NAME = 'vector.contract'
property acc: iree.compiler._mlir_libs._mlir.ir.Value
property indexing_maps: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property iterator_types: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property kind: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property rhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.ContractionOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.contract'
property acc: iree.compiler._mlir_libs._mlir.ir.Value
property indexing_maps: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property iterator_types: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property kind: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property rhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.CreateMaskOp(result, operands_, *, loc=None, ip=None)

Creates and returns a vector mask where elements of the result vector are set to ‘0’ or ‘1’, based on whether the element indices are contained within a hyper-rectangular region specified by the operands. Specifically, each operand specifies a range [0, operand-value) for a unique dimension in the vector result. The conjunction of the operand ranges define a hyper-rectangular region within which elements values are set to 1 (otherwise element values are set to 0). If operand-value is negative, it is treated as if it were zero, and if it is greater than the corresponding dimension size, it is treated as if it were equal to the dimension size.

Example:

```mlir // create a vector mask of size 4x3xi1 where elements in range // 0 <= row <= 2 and 0 <= col <= 1 are set to 1 (others to 0). %1 = vector.create_mask %c3, %c2 : vector<4x3xi1>

print %1

columns

0 1 2

|————

0 | 1 1 0

rows 1 | 1 1 0

2 | 1 1 0 3 | 0 0 0

```

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.CreateMaskOpAdaptor

OPERATION_NAME = 'vector.create_mask'
property operands_: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.vector.CreateMaskOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.create_mask'
property operands_: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.vector.DeinterleaveOp(source, *, results=None, loc=None, ip=None)

The deinterleave operation constructs two vectors from a single input vector. The first result vector contains the elements from even indexes of the input, and the second contains elements from odd indexes. This is the inverse of a vector.interleave operation.

Each output’s trailing dimension is half of the size of the input vector’s trailing dimension. This operation requires the input vector to have a rank > 0 and an even number of elements in its trailing dimension.

The operation supports scalable vectors.

Example: ```mlir %0, %1 = vector.deinterleave %a

: vector<8xi8> -> vector<4xi8>

%2, %3 = vector.deinterleave %b

: vector<2x8xi8> -> vector<2x4xi8>

%4, %5 = vector.deinterleave %c

: vector<2x8x4xi8> -> vector<2x8x2xi8>

%6, %7 = vector.deinterleave %d

: vector<[8]xf32> -> vector<[4]xf32>

%8, %9 = vector.deinterleave %e

: vector<2x[6]xf64> -> vector<2x[3]xf64>

%10, %11 = vector.deinterleave %f

: vector<2x4x[6]xf64> -> vector<2x4x[3]xf64>

```

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.DeinterleaveOpAdaptor

OPERATION_NAME = 'vector.deinterleave'
property res1: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.VectorType]
property res2: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.VectorType]
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.DeinterleaveOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.deinterleave'
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.ExpandLoadOp(result, base, indices, mask, pass_thru, *, alignment=None, loc=None, ip=None)

The expand load reads elements from memory into a vector as defined by a base with indices and a mask vector. Expansion only applies to the innermost dimension. When the mask is set, the next element is read from memory. Otherwise, the corresponding element is taken from a pass-through vector. Informally the semantics are:

` index = i result[0] := if mask[0] then base[index++] else pass_thru[0] result[1] := if mask[1] then base[index++] else pass_thru[1] etc. `

Note that the index increment is done conditionally.

If a mask bit is set and the corresponding index is out-of-bounds for the given base, the behavior is undefined. If a mask bit is not set, the value comes from the pass-through vector regardless of the index, and the index is allowed to be out-of-bounds.

The expand load can be used directly where applicable, or can be used during progressively lowering to bring other memory operations closer to hardware ISA support for an expand. The semantics of the operation closely correspond to those of the llvm.masked.expandload [intrinsic](https://llvm.org/docs/LangRef.html#llvm-masked-expandload-intrinsics).

An optional alignment attribute allows to specify the byte alignment of the load operation. It must be a positive power of 2. The operation must access memory at an address aligned to this boundary. Violating this requirement triggers immediate undefined behavior.

Note, at the moment this Op is only available for fixed-width vectors.

Examples:

```mlir %0 = vector.expandload %base[%i], %mask, %pass_thru

: memref<?xf32>, vector<8xi1>, vector<8xf32> into vector<8xf32>

%1 = vector.expandload %base[%i, %j], %mask, %pass_thru

: memref<?x?xf32>, vector<16xi1>, vector<16xf32> into vector<16xf32>

```

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.ExpandLoadOpAdaptor

OPERATION_NAME = 'vector.expandload'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property base: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property mask: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property pass_thru: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.VectorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.vector.ExpandLoadOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.expandload'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property base: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property mask: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property pass_thru: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.ExtractOp(source, dynamic_position, static_position, *, results=None, loc=None, ip=None)

Extracts an (n − k)-D result sub-vector from an n-D source vector at a specified k-D position. When n = k, the result degenerates to a scalar element.

Static and dynamic indices must be greater or equal to zero and less than the size of the corresponding dimension. The result is undefined if any index is out-of-bounds. The value -1 represents a poison index, which specifies that the extracted element is poison.

Example:

`mlir %1 = vector.extract %0[3]: vector<8x16xf32> from vector<4x8x16xf32> %2 = vector.extract %0[2, 1, 3]: f32 from vector<4x8x16xf32> %4 = vector.extract %0[%a, %b, %c]: f32 from vector<4x8x16xf32> %5 = vector.extract %0[2, %b]: vector<16xf32> from vector<4x8x16xf32> %6 = vector.extract %10[-1, %c]: f32 from vector<4x16xf32> `

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.ExtractOpAdaptor

OPERATION_NAME = 'vector.extract'
property dynamic_position: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property result: iree.compiler._mlir_libs._mlir.ir.OpResult

Shortcut to get an op result if it has only one (throws an error otherwise).

property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property static_position: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
class iree.compiler.dialects.vector.ExtractOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.extract'
property dynamic_position: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property static_position: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
class iree.compiler.dialects.vector.ExtractStridedSliceOp(result, source, offsets, sizes, strides, *, loc=None, ip=None)

Takes an n-D vector, k-D offsets integer array attribute, a k-sized sizes integer array attribute, a k-sized strides integer array attribute and extracts the n-D subvector at the proper offset.

At the moment strides must contain only 1s.

Returns an n-D vector where the first k-D dimensions match the sizes attribute. The returned subvector contains the elements starting at offset offsets and ending at offsets + sizes.

Example:

```mlir %1 = vector.extract_strided_slice %0

{offsets = [0, 2], sizes = [2, 4], strides = [1, 1]}:

vector<4x8x16xf32> to vector<2x4x16xf32>

// TODO: Evolve to a range form syntax similar to: %1 = vector.extract_strided_slice %0[0:2:1][2:4:1]

vector<4x8x16xf32> to vector<2x4x16xf32>

```

TODO: Implement support for poison indices.

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.ExtractStridedSliceOpAdaptor

OPERATION_NAME = 'vector.extract_strided_slice'
property offsets: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property sizes: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property strides: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
class iree.compiler.dialects.vector.ExtractStridedSliceOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.extract_strided_slice'
property offsets: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property sizes: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property strides: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
class iree.compiler.dialects.vector.FMAOp(lhs, rhs, acc, *, results=None, loc=None, ip=None)

Multiply-add expressions operate on n-D vectors and compute a fused pointwise multiply-and-accumulate: $result = $lhs * $rhs + $acc. All operands and result have the same vector type. The semantics of the operation correspond to those of the llvm.fma [intrinsic](https://llvm.org/docs/LangRef.html#int-fma). In the particular case of lowering to LLVM, this is guaranteed to lower to the llvm.fma.* intrinsic.

Example:

`mlir %3 = vector.fma %0, %1, %2: vector<8x16xf32> `

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.FMAOpAdaptor

OPERATION_NAME = 'vector.fma'
property acc: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.VectorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.FMAOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.fma'
property acc: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property rhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.FromElementsOp(dest, elements, *, loc=None, ip=None)

This operation defines a vector from one or multiple scalar elements. The scalar elements are arranged in row-major within the vector. The number of elements must match the number of elements in the result type. All elements must have the same type, which must match the element type of the result vector type. Scalable vectors are not supported.

Examples:

```mlir // Define a 0-D vector. %0 = vector.from_elements %f1 : vector<f32> // [%f1]

// Define a 1-D vector. %1 = vector.from_elements %f1, %f2 : vector<2xf32> // [%f1, %f2]

// Define a 2-D vector. %2 = vector.from_elements %f1, %f2, %f3, %f4, %f5, %f6 : vector<2x3xf32> // [[%f1, %f2, %f3], [%f4, %f5, %f6]]

// Define a 3-D vector. %3 = vector.from_elements %f1, %f2, %f3, %f4, %f5, %f6 : vector<3x1x2xf32> // [[[%f1, %f2]], [[%f3, %f4]], [[%f5, %f6]]] ```

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.FromElementsOpAdaptor

OPERATION_NAME = 'vector.from_elements'
property dest: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.VectorType]
property elements: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.vector.FromElementsOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.from_elements'
property elements: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.vector.GatherOp(result, base, offsets, indices, mask, pass_thru, *, alignment=None, loc=None, ip=None)

The gather operation returns an n-D vector whose elements are either loaded from a k-D memref or tensor, or taken from an n-D pass-through vector, depending on the values of an n-D mask vector.

If a mask bit is set, the corresponding result element is taken from base at an index defined by k indices and n-D index_vec. Otherwise, the element is taken from the pass-through vector. As an example, suppose that base is 3-D and the result is 2-D:

```mlir func.func @gather_3D_to_2D(

%base: memref<?x10x?xf32>, %ofs_0: index, %ofs_1: index, %ofs_2: index, %indices: vector<2x3xi32>, %mask: vector<2x3xi1>, %fall_thru: vector<2x3xf32>) -> vector<2x3xf32> {

%result = vector.gather %base[%ofs_0, %ofs_1, %ofs_2]

[%indices], %mask, %fall_thru : […]

return %result : vector<2x3xf32>

The indexing semantics are then,

``` result[i,j] := if mask[i,j] then base[i0, i1, i2 + indices[i,j]]

else pass_thru[i,j]

``` The index into base only varies in the innermost ((k-1)-th) dimension.

If a mask bit is set and the corresponding index is out-of-bounds for the given base, the behavior is undefined. If a mask bit is not set, the value comes from the pass-through vector regardless of the index, and the index is allowed to be out-of-bounds.

The gather operation can be used directly where applicable, or can be used during progressively lowering to bring other memory operations closer to hardware ISA support for a gather.

An optional alignment attribute allows to specify the byte alignment of the gather operation. It must be a positive power of 2. The operation must access memory at an address aligned to this boundary. Violating this requirement triggers immediate undefined behavior.

Examples:

```mlir // 1-D memref gathered to 2-D vector. %0 = vector.gather %base[%c0][%v], %mask, %pass_thru

: memref<?xf32>, vector<2x16xi32>, vector<2x16xi1>, vector<2x16xf32> into vector<2x16xf32>

// 2-D memref gathered to 1-D vector. %1 = vector.gather %base[%i, %j][%v], %mask, %pass_thru

: memref<16x16xf32>, vector<16xi32>, vector<16xi1>, vector<16xf32> into vector<16xf32>

```

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.GatherOpAdaptor

OPERATION_NAME = 'vector.gather'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property base: iree.compiler._mlir_libs._mlir.ir.Value
property indices: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property mask: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property offsets: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property pass_thru: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.VectorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.vector.GatherOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.gather'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property base: iree.compiler._mlir_libs._mlir.ir.Value
property indices: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property mask: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property offsets: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property pass_thru: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.InsertOp(valueToStore, dest, dynamic_position, static_position, *, results=None, loc=None, ip=None)

Inserts an (n - k)-D sub-vector (value-to-store) into an n-D destination vector at a specified k-D position. When n = 0, value-to-store degenerates to a scalar element inserted into the n-D destination vector.

Static and dynamic indices must be greater or equal to zero and less than the size of the corresponding dimension. The result is undefined if any index is out-of-bounds. The value -1 represents a poison index, which specifies that the resulting vector is poison.

Example:

`mlir %2 = vector.insert %0, %1[3] : vector<8x16xf32> into vector<4x8x16xf32> %5 = vector.insert %3, %4[2, 1, 3] : f32 into vector<4x8x16xf32> %11 = vector.insert %9, %10[%a, %b, %c] : f32 into vector<4x8x16xf32> %12 = vector.insert %4, %10[2, %b] : vector<16xf32> into vector<4x8x16xf32> %13 = vector.insert %20, %1[-1, %c] : f32 into vector<4x16xf32> `

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.InsertOpAdaptor

OPERATION_NAME = 'vector.insert'
property dest: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property dynamic_position: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.VectorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property static_position: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property valueToStore: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.vector.InsertOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.insert'
property dest: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property dynamic_position: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property static_position: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property valueToStore: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.vector.InsertStridedSliceOp(valueToStore, dest, offsets, strides, *, results=None, loc=None, ip=None)

Takes a k-D valueToStore vector, an n-D destination vector (n >= k), n-sized offsets integer array attribute, a k-sized strides integer array attribute and inserts the k-D valueToStore vector as a strided subvector at the proper offset into the n-D destination vector.

At the moment strides must contain only 1s.

Returns an n-D vector that is a copy of the n-D destination vector in which the last k-D dimensions contain the k-D valueToStore vector elements strided at the proper location as specified by the offsets.

Example:

```mlir %2 = vector.insert_strided_slice %0, %1

{offsets = [0, 0, 2], strides = [1, 1]}:

vector<2x4xf32> into vector<16x4x8xf32>

```

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.InsertStridedSliceOpAdaptor

OPERATION_NAME = 'vector.insert_strided_slice'
property dest: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property offsets: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.VectorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property strides: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property valueToStore: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.InsertStridedSliceOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.insert_strided_slice'
property dest: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property offsets: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property strides: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property valueToStore: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
enum iree.compiler.dialects.vector.IntEnum(value)

Enum where members are also (and must be) ints

Member Type

int

flag iree.compiler.dialects.vector.IntFlag(value)

Support for integer-based Flags

Member Type

int

class iree.compiler.dialects.vector.InterleaveOp(lhs, rhs, *, results=None, loc=None, ip=None)

The interleave operation constructs a new vector by interleaving the elements from the trailing (or final) dimension of two input vectors, returning a new vector where the trailing dimension is twice the size.

Note that for the n-D case this differs from the interleaving possible with vector.shuffle, which would only operate on the leading dimension.

Another key difference is this operation supports scalable vectors, though currently a general LLVM lowering is limited to the case where only the trailing dimension is scalable.

Example: ``mlir %a = arith.constant dense<[0, 1]> : vector<2xi32> %b = arith.constant dense<[2, 3]> : vector<2xi32> // The value of `%0 is [0, 2, 1, 3]. %0 = vector.interleave %a, %b : vector<2xi32> -> vector<4xi32>

// Examples showing allowed input and result types. %1 = vector.interleave %c, %d : vector<f16> -> vector<2xf16> %2 = vector.interleave %e, %f : vector<6x3xf32> -> vector<6x6xf32> %3 = vector.interleave %g, %h : vector<[4]xi32> -> vector<[8]xi32> %4 = vector.interleave %i, %j : vector<2x4x[2]xf64> -> vector<2x4x[4]xf64> ```

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.InterleaveOpAdaptor

OPERATION_NAME = 'vector.interleave'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.VectorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property rhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.InterleaveOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.interleave'
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property rhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
enum iree.compiler.dialects.vector.IteratorType(value)

Iterator type

Member Type

int

Valid values are as follows:

parallel = <IteratorType.parallel: 0>
reduction = <IteratorType.reduction: 1>
class iree.compiler.dialects.vector.LoadOp(result, base, indices, *, nontemporal=None, alignment=None, loc=None, ip=None)

The ‘vector.load’ operation reads an n-D slice of memory into an n-D vector. It takes a ‘base’ memref, an index for each memref dimension and a result vector type as arguments. It returns a value of the result vector type. The ‘base’ memref and indices determine the start memory address from which to read. Each index provides an offset for each memref dimension based on the element type of the memref. The shape of the result vector type determines the shape of the slice read from the start memory address. The elements along each dimension of the slice are strided by the memref strides. When loading more than 1 element, only unit strides are allowed along the most minor memref dimension. These constraints guarantee that elements read along the first dimension of the slice are contiguous in memory.

The memref element type can be a scalar or a vector type. If the memref element type is a scalar, it should match the element type of the result vector. If the memref element type is vector, it should match the result vector type.

Example: 0-D vector load on a scalar memref. `mlir %result = vector.load %base[%i, %j] : memref<100x100xf32>, vector<f32> `

Example: 1-D vector load on a scalar memref. `mlir %result = vector.load %base[%i, %j] : memref<100x100xf32>, vector<8xf32> `

Example: 1-D vector load on a vector memref. `mlir %result = vector.load %memref[%i, %j] : memref<200x100xvector<8xf32>>, vector<8xf32> `

Example: 2-D vector load on a scalar memref. `mlir %result = vector.load %memref[%i, %j] : memref<200x100xf32>, vector<4x8xf32> `

Example: 2-D vector load on a vector memref. `mlir %result = vector.load %memref[%i, %j] : memref<200x100xvector<4x8xf32>>, vector<4x8xf32> `

Representation-wise, the ‘vector.load’ operation permits out-of-bounds reads. Support and implementation of out-of-bounds vector loads is target-specific. No assumptions should be made on the value of elements loaded out of bounds. Not all targets may support out-of-bounds vector loads.

Example: Potential out-of-bound vector load. `mlir %result = vector.load %memref[%index] : memref<?xf32>, vector<8xf32> `

Example: Explicit out-of-bound vector load. `mlir %result = vector.load %memref[%c0] : memref<7xf32>, vector<8xf32> `

An optional alignment attribute allows to specify the byte alignment of the load operation. It must be a positive power of 2. The operation must access memory at an address aligned to this boundary. Violating this requirement triggers immediate undefined behavior.

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.LoadOpAdaptor

OPERATION_NAME = 'vector.load'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property base: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property nontemporal: Optional[iree.compiler._mlir_libs._mlir.ir.BoolAttr]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.VectorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.vector.LoadOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.load'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property base: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property nontemporal: Optional[iree.compiler._mlir_libs._mlir.ir.BoolAttr]
class iree.compiler.dialects.vector.MaskOp(results_, mask, *, passthru=None, loc=None, ip=None)

The vector.mask is a MaskingOpInterface operation that predicates the execution of another operation. It takes an i1 vector mask and an optional passthru vector as arguments.

A implicitly vector.yield-terminated region encloses the operation to be masked. Values used within the region are captured from above. Only one maskable operation can be masked with a vector.mask operation at a time. An operation is maskable if it implements the MaskableOpInterface. The terminator yields all results from the maskable operation to the result of this operation. No other values are allowed to be yielded.

An empty vector.mask operation is currently legal to enable optimizations across the vector.mask region. However, this might change in the future once vector transformations gain better support for vector.mask. TODO: Consider making empty vector.mask illegal.

The vector mask argument holds a bit for each vector lane and determines which vector lanes should execute the maskable operation and which ones should not. The vector.mask operation returns the value produced by the masked execution of the nested operation, if any. The masked-off lanes in the result vector are taken from the corresponding lanes of the pass-thru argument, if provided, or left unmodified, otherwise. At this point, 0-D vectors are not supported by vector.mask. They may be supported in the future.

The vector.mask operation does not prescribe how a maskable operation should be masked or how a masked operation should be lowered. Masking constraints and some semantic details are provided by each maskable operation through the MaskableOpInterface. Lowering of masked operations is implementation defined. For instance, scalarizing the masked operation or executing the operation for the masked-off lanes are valid lowerings as long as the execution of masked-off lanes does not change the observable behavior of the program.

Examples:

```

%0 = vector.mask %mask { vector.reduction <add>, %a : vector<8xi32> into i32 } : vector<8xi1> -> i32

```

```

%0 = vector.mask %mask, %passthru { arith.divsi %a, %b : vector<8xi32> } : vector<8xi1> -> vector<8xi32>

```

```

vector.mask %mask { vector.transfer_write %val, %t0[%idx] : vector<16xf32>, memref<?xf32> } : vector<16xi1>

```

```

vector.mask %mask { vector.transfer_write %val, %t0[%idx] : vector<16xf32>, tensor<?xf32> } : vector<16xi1> -> tensor<?xf32>

```

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.MaskOpAdaptor

OPERATION_NAME = 'vector.mask'
property mask: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property maskRegion: iree.compiler._mlir_libs._mlir.ir.Region
property passthru: Optional[iree.compiler._mlir_libs._mlir.ir.Value]
property results_: iree.compiler._mlir_libs._mlir.ir.OpResultList
class iree.compiler.dialects.vector.MaskOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.mask'
property mask: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property passthru: Optional[iree.compiler._mlir_libs._mlir.ir.Value]
class iree.compiler.dialects.vector.MaskedLoadOp(result, base, indices, mask, pass_thru, *, alignment=None, loc=None, ip=None)

The masked load reads elements from memory into a vector as defined by a base with indices and a mask vector. When the mask is set, the element is read from memory. Otherwise, the corresponding element is taken from a pass-through vector. Informally the semantics are: ` result[0] := if mask[0] then base[i + 0] else pass_thru[0] result[1] := if mask[1] then base[i + 1] else pass_thru[1] etc. `

If a mask bit is set and the corresponding index is out-of-bounds for the given base, the behavior is undefined. If a mask bit is not set, the value comes from the pass-through vector regardless of the index, and the index is allowed to be out-of-bounds.

The masked load can be used directly where applicable, or can be used during progressively lowering to bring other memory operations closer to hardware ISA support for a masked load. The semantics of the operation closely correspond to those of the llvm.masked.load [intrinsic](https://llvm.org/docs/LangRef.html#llvm-masked-load-intrinsics).

Examples:

```mlir %0 = vector.maskedload %base[%i], %mask, %pass_thru

: memref<?xf32>, vector<8xi1>, vector<8xf32> into vector<8xf32>

%1 = vector.maskedload %base[%i, %j], %mask, %pass_thru

: memref<?x?xf32>, vector<16xi1>, vector<16xf32> into vector<16xf32>

```

An optional alignment attribute allows to specify the byte alignment of the load operation. It must be a positive power of 2. The operation must access memory at an address aligned to this boundary. Violating this requirement triggers immediate undefined behavior.

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.MaskedLoadOpAdaptor

OPERATION_NAME = 'vector.maskedload'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property base: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property mask: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property pass_thru: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.VectorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.vector.MaskedLoadOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.maskedload'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property base: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property mask: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property pass_thru: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.MaskedStoreOp(base, indices, mask, valueToStore, *, alignment=None, loc=None, ip=None)

The masked store operation writes elements from a vector into memory as defined by a base with indices and a mask vector. When the mask is set, the corresponding element from the vector is written to memory. Otherwise, no action is taken for the element. Informally the semantics are: ` if (mask[0]) base[i+0] = value[0] if (mask[1]) base[i+1] = value[1] etc. `

If a mask bit is set and the corresponding index is out-of-bounds for the given base, the behavior is undefined. If a mask bit is not set, no value is stored regardless of the index, and the index is allowed to be out-of-bounds.

The masked store can be used directly where applicable, or can be used during progressively lowering to bring other memory operations closer to hardware ISA support for a masked store. The semantics of the operation closely correspond to those of the llvm.masked.store [intrinsic](https://llvm.org/docs/LangRef.html#llvm-masked-store-intrinsics).

Examples:

```mlir vector.maskedstore %base[%i], %mask, %value

: memref<?xf32>, vector<8xi1>, vector<8xf32>

vector.maskedstore %base[%i, %j], %mask, %value

: memref<?x?xf32>, vector<16xi1>, vector<16xf32>

```

An optional alignment attribute allows to specify the byte alignment of the store operation. It must be a positive power of 2. The operation must access memory at an address aligned to this boundary. Violating this requirement triggers immediate undefined behavior.

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.MaskedStoreOpAdaptor

OPERATION_NAME = 'vector.maskedstore'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property base: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property mask: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property valueToStore: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.MaskedStoreOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.maskedstore'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property base: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property mask: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property valueToStore: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.MultiDimReductionOp(kind, source, acc, reduction_dims, *, results=None, loc=None, ip=None)

Reduces an n-D vector into an (n-k)-D vector (or a scalar when k == n) using the given operation: add/mul/minsi/minui/maxsi/maxui /and/or/xor for integers, and add/mul/minnumf/maxnumf/minimumf /maximumf for floats. Takes an initial accumulator operand.

Example:

```mlir %1 = vector.multi_reduction <add>, %0, %acc0 [1, 3] :

vector<4x8x16x32xf32> to vector<4x16xf32>

%2 = vector.multi_reduction <add>, %1, %acc1 [0, 1] :

vector<4x16xf32> to f32

```

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.MultiDimReductionOpAdaptor

OPERATION_NAME = 'vector.multi_reduction'
property acc: iree.compiler._mlir_libs._mlir.ir.Value
property dest: iree.compiler._mlir_libs._mlir.ir.OpResult
property kind: iree.compiler._mlir_libs._mlir.ir.Attribute
property reduction_dims: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.MultiDimReductionOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.multi_reduction'
property acc: iree.compiler._mlir_libs._mlir.ir.Value
property kind: iree.compiler._mlir_libs._mlir.ir.Attribute
property reduction_dims: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.OuterProductOp(result, lhs, rhs, *, acc=None, kind=None, loc=None, ip=None)

Takes 2 1-D vectors and returns the 2-D vector containing the outer-product, as illustrated below: ```

outer | [c, d] ——+————

[a, | [ [a*c, a*d],

b] | [b*c, b*d] ]

` This operation also accepts a 1-D vector lhs and a scalar rhs. In this case a simple AXPY operation is performed, which returns a 1-D vector. `

[a, b] * c = [a*c, b*c]

```

An optional extra vector argument with the same shape as the output vector may be specified in which case the operation returns the sum of the outer-product and the extra vector. In this multiply-accumulate scenario for floating-point arguments, the rounding mode is enforced by guaranteeing that a fused-multiply add operation is emitted. When lowered to the LLVMIR dialect, this form emits llvm.intr.fma, which is guaranteed to lower to actual fma instructions on x86.

An optional kind attribute may be specified to be: add/mul/minsi /minui/maxsi/maxui/and/or/xor for integers, and add/mul /minnumf/maxnumf/minimumf/maximumf for floats. The default is add.

Example:

``` %2 = vector.outerproduct %0, %1: vector<4xf32>, vector<8xf32> return %2: vector<4x8xf32>

%3 = vector.outerproduct %0, %1, %2:

vector<4xf32>, vector<8xf32>, vector<4x8xf32>

return %3: vector<4x8xf32>

%4 = vector.outerproduct %0, %1, %2 {kind = #vector.kind<maxnumf>}:

vector<4xf32>, vector<8xf32>, vector<4x8xf32>

return %3: vector<4x8xf32>

%6 = vector.outerproduct %4, %5: vector<10xf32>, f32 return %6: vector<10xf32>

```

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.OuterProductOpAdaptor

OPERATION_NAME = 'vector.outerproduct'
property acc: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]]
property kind: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.vector.OuterProductOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.outerproduct'
property acc: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]]
property kind: iree.compiler._mlir_libs._mlir.ir.Attribute
property lhs: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property rhs: iree.compiler._mlir_libs._mlir.ir.Value
class iree.compiler.dialects.vector.PrintOp(*, source=None, punctuation=None, stringLiteral=None, loc=None, ip=None)

Prints the source vector (or scalar) to stdout in a human-readable format (for testing and debugging). No return value.

Example:

`mlir %v = arith.constant dense<0.0> : vector<4xf32> vector.print %v : vector<4xf32> `

When lowered to LLVM, the vector print is decomposed into elementary printing method calls that at runtime will yield:

` ( 0.0, 0.0, 0.0, 0.0 ) `

This is printed to stdout via a small runtime support library, which only needs to provide a few printing methods (single value for all data types, opening/closing bracket, comma, newline).

By default vector.print adds a newline after the vector, but this can be controlled by the punctuation attribute. For example, to print a comma after instead do:

`mlir vector.print %v : vector<4xf32> punctuation <comma> `

Note that it is possible to use the punctuation attribute alone. The following will print a single newline:

`mlir vector.print punctuation <newline> `

Additionally, to aid with debugging and testing vector.print can also print constant strings:

`mlir vector.print str "Hello, World!" `

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.PrintOpAdaptor

OPERATION_NAME = 'vector.print'
property punctuation: iree.compiler._mlir_libs._mlir.ir.Attribute
property source: Optional[iree.compiler._mlir_libs._mlir.ir.Value]
property stringLiteral: Optional[iree.compiler._mlir_libs._mlir.ir.StringAttr]
class iree.compiler.dialects.vector.PrintOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.print'
property punctuation: iree.compiler._mlir_libs._mlir.ir.Attribute
property source: Optional[iree.compiler._mlir_libs._mlir.ir.Value]
property stringLiteral: Optional[iree.compiler._mlir_libs._mlir.ir.StringAttr]
enum iree.compiler.dialects.vector.PrintPunctuation(value)

Punctuation for separating vectors or vector elements

Member Type

int

Valid values are as follows:

NoPunctuation = <PrintPunctuation.NoPunctuation: 0>
NewLine = <PrintPunctuation.NewLine: 1>
Comma = <PrintPunctuation.Comma: 2>
Open = <PrintPunctuation.Open: 3>
Close = <PrintPunctuation.Close: 4>
class iree.compiler.dialects.vector.ReductionOp(dest, kind, vector, *, acc=None, fastmath=None, loc=None, ip=None)

Reduces an 1-D vector “horizontally” into a scalar using the given operation: add/mul/minsi/minui/maxsi/maxui/and/or/xor for integers, and add/mul/minnumf/maxnumf/minimumf/maximumf for floats. Reductions also allow an optional fused accumulator.

Note that these operations are restricted to 1-D vectors to remain close to the corresponding LLVM intrinsics:

http://llvm.org/docs/LangRef.html#vector-reduction-intrinsics

Example:

```mlir %1 = vector.reduction <add>, %0 : vector<16xf32> into f32

%3 = vector.reduction <xor>, %2 : vector<4xi32> into i32

%4 = vector.reduction <mul>, %0, %1 : vector<16xf32> into f32 ```

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.ReductionOpAdaptor

OPERATION_NAME = 'vector.reduction'
property acc: Optional[iree.compiler._mlir_libs._mlir.ir.Value]
property dest: iree.compiler._mlir_libs._mlir.ir.OpResult
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property kind: iree.compiler._mlir_libs._mlir.ir.Attribute
property vector: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.ReductionOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.reduction'
property acc: Optional[iree.compiler._mlir_libs._mlir.ir.Value]
property fastmath: iree.compiler._mlir_libs._mlir.ir.Attribute
property kind: iree.compiler._mlir_libs._mlir.ir.Attribute
property vector: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.ScalableExtractOp(result, source, pos, *, loc=None, ip=None)

Takes rank-1 source vector and a position pos within the source vector, and extracts a subvector starting from that position.

The extraction position must be a multiple of the minimum size of the result vector. For the operation to be well defined, the destination vector must fit within the source vector from the specified position. Since the source vector is scalable and its runtime length is unknown, the validity of the operation can’t be verified nor guaranteed at compile time.

Example:

`mlir %1 = vector.scalable.extract %0[8] : vector<4xf32> from vector<[8]xf32> %3 = vector.scalable.extract %2[0] : vector<[4]xf32> from vector<[8]xf32> `

Invalid example: `mlir %1 = vector.scalable.extract %0[5] : vector<4xf32> from vector<[16]xf32> `

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.ScalableExtractOpAdaptor

OPERATION_NAME = 'vector.scalable.extract'
property pos: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.VectorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.ScalableExtractOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.scalable.extract'
property pos: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.ScalableInsertOp(valueToStore, dest, pos, *, results=None, loc=None, ip=None)

This operations takes a rank-1 fixed-length or scalable subvector and inserts it within the destination scalable vector starting from the position specificed by pos. If the source vector is scalable, the insertion position will be scaled by the runtime scaling factor of the source subvector.

The insertion position must be a multiple of the minimum size of the source vector. For the operation to be well defined, the source vector must fit in the destination vector from the specified position. Since the destination vector is scalable and its runtime length is unknown, the validity of the operation can’t be verified nor guaranteed at compile time.

Example:

`mlir %2 = vector.scalable.insert %0, %1[8] : vector<4xf32> into vector<[16]xf32> %5 = vector.scalable.insert %3, %4[0] : vector<8xf32> into vector<[4]xf32> %8 = vector.scalable.insert %6, %7[0] : vector<[4]xf32> into vector<[8]xf32> `

Invalid example: `mlir %2 = vector.scalable.insert %0, %1[5] : vector<4xf32> into vector<[16]xf32> `

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.ScalableInsertOpAdaptor

OPERATION_NAME = 'vector.scalable.insert'
property dest: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property pos: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.VectorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property valueToStore: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.ScalableInsertOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.scalable.insert'
property dest: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property pos: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property valueToStore: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.ScanOp(kind, source, initial_value, reduction_dim, inclusive, *, results=None, loc=None, ip=None)

Performs an inclusive/exclusive scan on an n-D vector along a single dimension returning an n-D result vector using the given operation (add/mul/minsi/minui/maxsi/maxui/and/or/xor for integers, and add/mul/minnumf/maxnumf/minimumf/maximumf for floats), and a specified value for the initial value. The operator returns the result of scan as well as the result of the last reduction in the scan.

Example:

```mlir %1:2 = vector.scan <add>, %0, %acc {inclusive = false, reduction_dim = 1 : i64} :

vector<4x8x16x32xf32>, vector<4x16x32xf32>

```

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.ScanOpAdaptor

OPERATION_NAME = 'vector.scan'
property accumulated_value: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.VectorType]
property dest: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.VectorType]
property inclusive: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property initial_value: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property kind: iree.compiler._mlir_libs._mlir.ir.Attribute
property reduction_dim: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.ScanOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.scan'
property inclusive: iree.compiler._mlir_libs._mlir.ir.BoolAttr
property initial_value: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property kind: iree.compiler._mlir_libs._mlir.ir.Attribute
property reduction_dim: iree.compiler._mlir_libs._mlir.ir.IntegerAttr
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.ScatterOp(result, base, offsets, indices, mask, valueToStore, *, alignment=None, loc=None, ip=None)

The scatter operation stores elements from a n-D vector into memory or ranked tensor as defined by a base with indices and an additional n-D index vector, but only if the corresponding bit in a n-D mask vector is set. Otherwise, no action is taken for that element. Informally the semantics are: ` if (mask[0]) base[index[0]] = value[0] if (mask[1]) base[index[1]] = value[1] etc. `

If a mask bit is set and the corresponding index is out-of-bounds for the given base, the behavior is undefined. If a mask bit is not set, no value is stored regardless of the index, and the index is allowed to be out-of-bounds.

If the index vector contains two or more duplicate indices, the behavior is undefined. Underlying implementation may enforce strict sequential semantics. TODO: always enforce strict sequential semantics?

The scatter operation can be used directly where applicable, or can be used during progressively lowering to bring other memory operations closer to hardware ISA support for a scatter. The semantics of the operation closely correspond to those of the llvm.masked.scatter [intrinsic](https://llvm.org/docs/LangRef.html#llvm-masked-scatter-intrinsics).

An optional alignment attribute allows to specify the byte alignment of the scatter operation. It must be a positive power of 2. The operation must access memory at an address aligned to this boundary. Violating this requirement triggers immediate undefined behavior.

Examples:

```mlir vector.scatter %base[%c0][%v], %mask, %value

: memref<?xf32>, vector<16xi32>, vector<16xi1>, vector<16xf32>

vector.scatter %base[%i, %j][%v], %mask, %value

: memref<16x16xf32>, vector<16xi32>, vector<16xi1>, vector<16xf32>

```

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.ScatterOpAdaptor

OPERATION_NAME = 'vector.scatter'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property base: iree.compiler._mlir_libs._mlir.ir.Value
property indices: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property mask: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property offsets: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property result: Optional[iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]]

Shortcut to get an op result if it has only one (throws an error otherwise).

property valueToStore: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.ScatterOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.scatter'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property base: iree.compiler._mlir_libs._mlir.ir.Value
property indices: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property mask: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property offsets: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property valueToStore: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.ShapeCastOp(result, source, *, loc=None, ip=None)

Casts to a vector with the same number of elements, element type, and number of scalable dimensions.

It is currently assumed that this operation does not require moving data, and that it will be folded away before lowering vector operations.

There is an exception to the folding expectation when targeting llvm.intr.matrix operations. We need a type conversion back and forth from a 2-D MLIR vector to a 1-D flattened LLVM vector.shape_cast lowering to LLVM is supported in that particular case, for now.

Examples:

```mlir %1 = vector.shape_cast %0 : vector<4x3xf32> to vector<3x2x2xf32>

// with 2 scalable dimensions (number of which must be preserved). %3 = vector.shape_cast %2 : vector<[2]x3x[4]xi8> to vector<3x[1]x[8]xi8> ```

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.ShapeCastOpAdaptor

OPERATION_NAME = 'vector.shape_cast'
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.VectorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.ShapeCastOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.shape_cast'
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.ShuffleOp(v1, v2, mask, *, results=None, loc=None, ip=None)

The shuffle operation constructs a permutation (or duplication) of elements from two input vectors, returning a vector with the same element type as the input and a length that is the same as the shuffle mask. The two input vectors must have the same element type, same rank, and trailing dimension sizes and shuffles their values in the leading dimension (which may differ in size) according to the given mask. The legality rules are: * the two operands must have the same element type as the result

  • Either, the two operands and the result must have the same rank and trailing dimension sizes, viz. given two k-D operands

    v1 : <s_1 x s_2 x .. x s_k x type> and v2 : <t_1 x t_2 x .. x t_k x type>

    we have s_i = t_i for all 1 < i <= k

  • Or, the two operands must be 0-D vectors and the result is a 1-D vector.

  • the mask length equals the leading dimension size of the result

  • numbering the input vector indices left to right across the operands, all mask values must be within range, viz. given two k-D operands v1 and v2 above, all mask values are in the range [0,s_1+t_1). The value -1 represents a poison mask value, which specifies that the selected element is poison.

Note, scalable vectors are not supported.

Example:

```mlir %0 = vector.shuffle %a, %b[0, 3]

: vector<2xf32>, vector<2xf32> ; yields vector<2xf32>

%1 = vector.shuffle %c, %b[0, 1, 2]

: vector<2x16xf32>, vector<1x16xf32> ; yields vector<3x16xf32>

%2 = vector.shuffle %a, %b[3, 2, 1, 0]

: vector<2xf32>, vector<2xf32> ; yields vector<4xf32>

%3 = vector.shuffle %a, %b[0, 1]

: vector<f32>, vector<f32> ; yields vector<2xf32>

%4 = vector.shuffle %a, %b[0, 4, -1, -1, -1, -1]

: vector<4xf32>, vector<4xf32> ; yields vector<6xf32>

```

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.ShuffleOpAdaptor

OPERATION_NAME = 'vector.shuffle'
property mask: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property v1: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property v2: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property vector: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.ShuffleOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.shuffle'
property mask: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property v1: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
property v2: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.StepOp(result, *, loc=None, ip=None)

A step operation produces an index vector, i.e. a 1-D vector of values of index type that represents a linear sequence from 0 to N-1, where N is the number of elements in the result vector.

Supports fixed-width and scalable vectors.

Examples:

`mlir %0 = vector.step : vector<4xindex> ; [0, 1, 2, 3] %1 = vector.step : vector<[4]xindex> ; [0, 1, .., <vscale * 4 - 1>] `

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.StepOpAdaptor

OPERATION_NAME = 'vector.step'
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.VectorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.vector.StepOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.step'
class iree.compiler.dialects.vector.StoreOp(valueToStore, base, indices, *, nontemporal=None, alignment=None, loc=None, ip=None)

The ‘vector.store’ operation writes an n-D vector to an n-D slice of memory. It takes the vector value to be stored, a ‘base’ memref and an index for each memref dimension. The ‘base’ memref and indices determine the start memory address from which to write. Each index provides an offset for each memref dimension based on the element type of the memref. The shape of the vector value to store determines the shape of the slice written from the start memory address. The elements along each dimension of the slice are strided by the memref strides. When storing more than 1 element, only unit strides are allowed along the most minor memref dimension. These constraints guarantee that elements written along the first dimension of the slice are contiguous in memory.

The memref element type can be a scalar or a vector type. If the memref element type is a scalar, it should match the element type of the value to store. If the memref element type is vector, it should match the type of the value to store.

Example: 0-D vector store on a scalar memref. `mlir vector.store %valueToStore, %memref[%i, %j] : memref<200x100xf32>, vector<f32> `

Example: 1-D vector store on a scalar memref. `mlir vector.store %valueToStore, %memref[%i, %j] : memref<200x100xf32>, vector<8xf32> `

Example: 1-D vector store on a vector memref. `mlir vector.store %valueToStore, %memref[%i, %j] : memref<200x100xvector<8xf32>>, vector<8xf32> `

Example: 2-D vector store on a scalar memref. `mlir vector.store %valueToStore, %memref[%i, %j] : memref<200x100xf32>, vector<4x8xf32> `

Example: 2-D vector store on a vector memref. `mlir vector.store %valueToStore, %memref[%i, %j] : memref<200x100xvector<4x8xf32>>, vector<4x8xf32> `

Representation-wise, the ‘vector.store’ operation permits out-of-bounds writes. Support and implementation of out-of-bounds vector stores are target-specific. No assumptions should be made on the memory written out of bounds. Not all targets may support out-of-bounds vector stores.

Example: Potential out-of-bounds vector store. `mlir vector.store %valueToStore, %memref[%index] : memref<?xf32>, vector<8xf32> `

Example: Explicit out-of-bounds vector store. `mlir vector.store %valueToStore, %memref[%c0] : memref<7xf32>, vector<8xf32> `

An optional alignment attribute allows to specify the byte alignment of the store operation. It must be a positive power of 2. The operation must access memory at an address aligned to this boundary. Violating this requirement triggers immediate undefined behavior.

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.StoreOpAdaptor

OPERATION_NAME = 'vector.store'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property base: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property nontemporal: Optional[iree.compiler._mlir_libs._mlir.ir.BoolAttr]
property valueToStore: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.StoreOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.store'
property alignment: Optional[iree.compiler._mlir_libs._mlir.ir.IntegerAttr]
property base: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property nontemporal: Optional[iree.compiler._mlir_libs._mlir.ir.BoolAttr]
property valueToStore: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.ToElementsOp(source, *, results=None, loc=None, ip=None)

This operation decomposes all the scalar elements from a vector. The decomposed scalar elements are returned in row-major order. The number of scalar results must match the number of elements in the input vector type. All the result elements have the same result type, which must match the element type of the input vector. Scalable vectors are not supported.

Examples:

```mlir // Decompose a 0-D vector. %0 = vector.to_elements %v0 : vector<f32> // %0 = %v0[0]

// Decompose a 1-D vector. %0:2 = vector.to_elements %v1 : vector<2xf32> // %0#0 = %v1[0] // %0#1 = %v1[1]

// Decompose a 2-D. %0:6 = vector.to_elements %v2 : vector<2x3xf32> // %0#0 = %v2[0, 0] // %0#1 = %v2[0, 1] // %0#2 = %v2[0, 2] // %0#3 = %v2[1, 0] // %0#4 = %v2[1, 1] // %0#5 = %v2[1, 2]

// Decompose a 3-D vector. %0:6 = vector.to_elements %v3 : vector<3x1x2xf32> // %0#0 = %v3[0, 0, 0] // %0#1 = %v3[0, 0, 1] // %0#2 = %v3[1, 0, 0] // %0#3 = %v3[1, 0, 1] // %0#4 = %v3[2, 0, 0] // %0#5 = %v3[2, 0, 1] ```

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.ToElementsOpAdaptor

OPERATION_NAME = 'vector.to_elements'
property elements: iree.compiler._mlir_libs._mlir.ir.OpResultList
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.ToElementsOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.to_elements'
property source: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.TransferReadOp(vector, base, indices, permutation_map, padding, in_bounds, *, mask=None, loc=None, ip=None)

The vector.transfer_read op performs a read from a slice within a [MemRef](../LangRef.md#memref-type) or a Ranked [Tensor](../LangRef.md#tensor-type) supplied as its first operand into a [vector](../LangRef.md#vector-type) of the same base elemental type.

A memref/tensor operand with vector element type, must have its vector element type match a suffix (shape and element type) of the vector (e.g. memref<3x2x6x4x3xf32>, vector<1x1x4x3xf32>).

The slice is further defined by a full-rank index within the MemRef/Tensor, supplied as the operands [1 .. 1 + rank(memref/tensor)) that defines the starting point of the transfer (e.g. %A[%i0, %i1, %i2]).

The permutation_map [attribute](../LangRef.md#attributes) is an [affine-map](Affine.md#affine-maps) which specifies the transposition on the slice to match the vector shape. The permutation map may be implicit and omitted from parsing and printing if it is the canonical minor identity map (i.e. if it does not permute or broadcast any dimension).

The size of the slice is specified by the size of the vector, given as the return type.

An SSA value padding of the same elemental type as the MemRef/Tensor is provided to specify a fallback value in the case of out-of-bounds accesses and/or masking.

An optional SSA value mask may be specified to mask out elements read from the MemRef/Tensor. The mask type is an i1 vector with a shape that matches how elements are read from the MemRef/Tensor, before any permutation or broadcasting. Elements whose corresponding mask element is 0 are masked out and replaced with padding.

For every vector dimension, the boolean array attribute in_bounds specifies if the transfer is guaranteed to be within the source bounds. If set to “false”, accesses (including the starting point) may run out-of-bounds along the respective vector dimension as the index increases. Non-vector dimensions must always be in-bounds. The in_bounds array length has to be equal to the vector rank. This attribute has a default value: false (i.e. “out-of-bounds”). When skipped in the textual IR, the default value is assumed. Similarly, the OP printer will omit this attribute when all dimensions are out-of-bounds (i.e. the default value is used).

A vector.transfer_read can be lowered to a simple load if all dimensions are specified to be within bounds and no mask was specified.

This operation is called ‘read’ by opposition to ‘load’ because the super-vector granularity is generally not representable with a single hardware register. A vector.transfer_read is thus a mid-level abstraction that supports super-vectorization with non-effecting padding for full-tile only operations.

More precisely, let’s dive deeper into the permutation_map for the following MLIR:

```mlir vector.transfer_read %A[%expr1, %expr2, %expr3, %expr4]

{ permutation_map : (d0,d1,d2,d3) -> (d2,0,d0) } : memref<?x?x?x?xf32>, vector<3x4x5xf32>

```

This operation always reads a slice starting at %A[%expr1, %expr2, %expr3, %expr4]. The size of the slice can be inferred from the resulting vector shape and walking back through the permutation map: 3 along d2 and 5 along d0, so the slice is: %A[%expr1 : %expr1 + 5, %expr2, %expr3:%expr3 + 3, %expr4]

That slice needs to be read into a vector<3x4x5xf32>. Since the permutation map is not full rank, there must be a broadcast along vector dimension 1.

A notional lowering of vector.transfer_read could generate code resembling:

```mlir // %expr1, %expr2, %expr3, %expr4 defined before this point // alloc a temporary buffer for performing the “gather” of the slice. %tmp = memref.alloc() : memref<vector<3x4x5xf32>> for %i = 0 to 3 {

affine.for %j = 0 to 4 {
affine.for %k = 0 to 5 {

// Note that this load does not involve %j. %a = load %A[%expr1 + %k, %expr2, %expr3 + %i, %expr4] : memref<?x?x?x?xf32> // Update the temporary gathered slice with the individual element %slice = memref.load %tmp : memref<vector<3x4x5xf32>> -> vector<3x4x5xf32> %updated = vector.insert %a, %slice[%i, %j, %k] : f32 into vector<3x4x5xf32> memref.store %updated, %tmp : memref<vector<3x4x5xf32>>

}}} // At this point we gathered the elements from the original // memref into the desired vector layout, stored in the %tmp allocation. %vec = memref.load %tmp : memref<vector<3x4x5xf32>> -> vector<3x4x5xf32> ```

On a GPU one could then map i, j, k to blocks and threads. Notice that the temporary storage footprint could conceptually be only 3 * 5 values but 3 * 4 * 5 values are actually transferred between %A and %tmp.

Alternatively, if a notional vector broadcast operation were available, we could avoid the loop on %j and the lowered code would resemble:

```mlir // %expr1, %expr2, %expr3, %expr4 defined before this point %tmp = memref.alloc() : memref<vector<3x4x5xf32>> for %i = 0 to 3 {

affine.for %k = 0 to 5 {

%a = load %A[%expr1 + %k, %expr2, %expr3 + %i, %expr4] : memref<?x?x?x?xf32> %slice = memref.load %tmp : memref<vector<3x4x5xf32>> -> vector<3x4x5xf32> // Here we only store to the first element in dimension one %updated = vector.insert %a, %slice[%i, 0, %k] : f32 into vector<3x4x5xf32> memref.store %updated, %tmp : memref<vector<3x4x5xf32>>

}} // At this point we gathered the elements from the original // memref into the desired vector layout, stored in the %tmp allocation. // However we haven’t replicated them alongside the first dimension, we need // to broadcast now. %partialVec = load %tmp : memref<vector<3x4x5xf32>> -> vector<3x4x5xf32> %vec = broadcast %tmpvec, 1 : vector<3x4x5xf32> ```

where broadcast broadcasts from element 0 to all others along the specified dimension. This time, the number of loaded element is 3 * 5 values. An additional 1 broadcast is required. On a GPU this broadcast could be implemented using a warp-shuffle if loop j were mapped to threadIdx.x.

Syntax ``` operation ::= ssa-id = vector.transfer_read ssa-use-list

{ attribute-entry } : memref-type , vector-type

```

Example:

``mlir // Read the slice `%A[%i0, %i1:%i1+256, %i2:%i2+32] into vector<32x256xf32> // and pad with %f0 to handle the boundary case: %f0 = arith.constant 0.0f : f32 affine.for %i0 = 0 to %0 {

affine.for %i1 = 0 to %1 step 256 {
affine.for %i2 = 0 to %2 step 32 {
%v = vector.transfer_read %A[%i0, %i1, %i2], (%f0)

{permutation_map: (d0, d1, d2) -> (d2, d1)} : memref<?x?x?xf32>, vector<32x256xf32>

}}}

// or equivalently (rewrite with vector.transpose) %f0 = arith.constant 0.0f : f32 affine.for %i0 = 0 to %0 {

affine.for %i1 = 0 to %1 step 256 {
affine.for %i2 = 0 to %2 step 32 {
%v0 = vector.transfer_read %A[%i0, %i1, %i2], (%f0)

{permutation_map: (d0, d1, d2) -> (d1, d2)} : memref<?x?x?xf32>, vector<256x32xf32>

%v = vector.transpose %v0, [1, 0] :

vector<256x32xf32> to vector<32x256f32>

}}}

// Read the slice %A[%i0, %i1] (i.e. the element %A[%i0, %i1]) into // vector<128xf32>. The underlying implementation will require a 1-D vector // broadcast: affine.for %i0 = 0 to %0 {

affine.for %i1 = 0 to %1 {
%3 = vector.transfer_read %A[%i0, %i1]

{permutation_map: (d0, d1) -> (0)} : memref<?x?xf32>, vector<128xf32>

}

}

// Read from a memref with vector element type. %4 = vector.transfer_read %arg1[%c3, %c3], %vf0

{permutation_map = (d0, d1)->(d0, d1)}

: memref<?x?xvector<4x3xf32>>, vector<1x1x4x3xf32>

// Read from a tensor with vector element type. %4 = vector.transfer_read %arg1[%c3, %c3], %vf0

{permutation_map = (d0, d1)->(d0, d1)}

: tensor<?x?xvector<4x3xf32>>, vector<1x1x4x3xf32>

// Special encoding for 0-d transfer with 0-d tensor/memref, vector shape // {1} and permutation_map () -> (0). %0 = vector.transfer_read %arg0[], %f0 {permutation_map = affine_map<()->(0)>} :

tensor<f32>, vector<1xf32>

```

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.TransferReadOpAdaptor

OPERATION_NAME = 'vector.transfer_read'
property base: iree.compiler._mlir_libs._mlir.ir.Value
property in_bounds: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property mask: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]]
property padding: iree.compiler._mlir_libs._mlir.ir.Value
property permutation_map: iree.compiler._mlir_libs._mlir.ir.AffineMapAttr
property vector: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.TransferReadOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.transfer_read'
property base: iree.compiler._mlir_libs._mlir.ir.Value
property in_bounds: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property mask: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]]
property padding: iree.compiler._mlir_libs._mlir.ir.Value
property permutation_map: iree.compiler._mlir_libs._mlir.ir.AffineMapAttr
class iree.compiler.dialects.vector.TransferWriteOp(result, valueToStore, base, indices, permutation_map, in_bounds, *, mask=None, loc=None, ip=None)

The vector.transfer_write op performs a write from a [vector](../LangRef.md#vector-type), supplied as its first operand, into a slice within a [MemRef](../LangRef.md#memref-type) or a Ranked [Tensor](../LangRef.md#tensor-type) of the same base elemental type, supplied as its second operand.

A vector memref/tensor operand must have its vector element type match a suffix (shape and element type) of the vector (e.g. memref<3x2x6x4x3xf32>, vector<1x1x4x3xf32>). If the operand is a tensor, the operation returns a new tensor of the same type.

The slice is further defined by a full-rank index within the MemRef/Tensor, supplied as the operands [2 .. 2 + rank(memref/tensor)) that defines the starting point of the transfer (e.g. %A[%i0, %i1, %i2, %i3]).

The permutation_map [attribute](../LangRef.md#attributes) is an [affine-map](Affine.md#affine-maps) which specifies the transposition on the slice to match the vector shape. The permutation map may be implicit and omitted from parsing and printing if it is the canonical minor identity map (i.e. if it does not permute any dimension). In contrast to transfer_read, write ops cannot have broadcast dimensions.

The size of the slice is specified by the size of the vector.

An optional SSA value mask may be specified to mask out elements written to the MemRef/Tensor. The mask type is an i1 vector with a shape that matches how elements are written into the MemRef/Tensor, after applying any permutation. Elements whose corresponding mask element is 0 are masked out.

For every vector dimension, the boolean array attribute in_bounds specifies if the transfer is guaranteed to be within the source bounds. If set to “false”, accesses (including the starting point) may run out-of-bounds along the respective vector dimension as the index increases. Non-vector dimensions must always be in-bounds. The in_bounds array length has to be equal to the vector rank. This attribute has a default value: false (i.e. “out-of-bounds”). When skipped in the textual IR, the default value is assumed. Similarly, the OP printer will omit this attribute when all dimensions are out-of-bounds (i.e. the default value is used).

A vector.transfer_write can be lowered to a simple store if all dimensions are specified to be within bounds and no mask was specified.

This operation is called ‘write’ by opposition to ‘store’ because the super-vector granularity is generally not representable with a single hardware register. A vector.transfer_write is thus a mid-level abstraction that supports super-vectorization with non-effecting padding for full-tile-only code. It is the responsibility of vector.transfer_write’s implementation to ensure the memory writes are valid. Different lowerings may be pertinent depending on the hardware support.

Example:

``mlir // write vector<16x32x64xf32> into the slice // `%A[%i0, %i1:%i1+32, %i2:%i2+64, %i3:%i3+16]: for %i0 = 0 to %0 {

affine.for %i1 = 0 to %1 step 32 {
affine.for %i2 = 0 to %2 step 64 {
affine.for %i3 = 0 to %3 step 16 {

%val = ssa-value : vector<16x32x64xf32> vector.transfer_write %val, %A[%i0, %i1, %i2, %i3]

{permutation_map: (d0, d1, d2, d3) -> (d3, d1, d2)} : vector<16x32x64xf32>, memref<?x?x?x?xf32>

// or equivalently (rewrite with vector.transpose) for %i0 = 0 to %0 {

affine.for %i1 = 0 to %1 step 32 {
affine.for %i2 = 0 to %2 step 64 {
affine.for %i3 = 0 to %3 step 16 {

%val = ssa-value : vector<16x32x64xf32> %valt = vector.transpose %val, [1, 2, 0] :

vector<16x32x64xf32> -> vector<32x64x16xf32>

vector.transfer_write %valt, %A[%i0, %i1, %i2, %i3]

{permutation_map: (d0, d1, d2, d3) -> (d1, d2, d3)} : vector<32x64x16xf32>, memref<?x?x?x?xf32>

// write to a memref with vector element type. vector.transfer_write %4, %arg1[%c3, %c3]

{permutation_map = (d0, d1)->(d0, d1)}

: vector<1x1x4x3xf32>, memref<?x?xvector<4x3xf32>>

// return a tensor where the vector is inserted into the source tensor. %5 = vector.transfer_write %4, %arg1[%c3, %c3]

{permutation_map = (d0, d1)->(d0, d1)}

: vector<1x1x4x3xf32>, tensor<?x?xvector<4x3xf32>>

// Special encoding for 0-d transfer with 0-d tensor/memref, vector shape // {1} and permutation_map () -> (0). %1 = vector.transfer_write %0, %arg0[] {permutation_map = affine_map<()->(0)>} :

vector<1xf32>, tensor<f32>

```

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.TransferWriteOpAdaptor

OPERATION_NAME = 'vector.transfer_write'
property base: iree.compiler._mlir_libs._mlir.ir.Value
property in_bounds: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property mask: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]]
property permutation_map: iree.compiler._mlir_libs._mlir.ir.AffineMapAttr
property result: Optional[iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.RankedTensorType]]

Shortcut to get an op result if it has only one (throws an error otherwise).

property valueToStore: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.TransferWriteOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.transfer_write'
property base: iree.compiler._mlir_libs._mlir.ir.Value
property in_bounds: iree.compiler._mlir_libs._mlir.ir.ArrayAttr
property indices: iree.compiler._mlir_libs._mlir.ir.OpOperandList
property mask: Optional[iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]]
property permutation_map: iree.compiler._mlir_libs._mlir.ir.AffineMapAttr
property valueToStore: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.TransposeOp(result, vector, permutation, *, loc=None, ip=None)

Takes a n-D vector and returns the transposed n-D vector defined by the permutation of ranks in the n-sized integer array attribute (in case of 0-D vectors the array attribute must be empty).

In the operation

```mlir %1 = vector.transpose %0, [i_1, .., i_n]

: vector<d_1 x .. x d_n x f32> to vector<d_trans[0] x .. x d_trans[n-1] x f32>

```

the permutation array [i_1, .., i_n] must be a permutation of [0, .., n-1].

Example:

```mlir %1 = vector.transpose %0, [1, 0] : vector<2x3xf32> to vector<3x2xf32>

[ [a, b, c], [ [a, d],
[d, e, f] ] -> [b, e],

[c, f] ]

```

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.TransposeOpAdaptor

OPERATION_NAME = 'vector.transpose'
property permutation: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.VectorType]

Shortcut to get an op result if it has only one (throws an error otherwise).

property vector: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.TransposeOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.transpose'
property permutation: iree.compiler._mlir_libs._mlir.ir.DenseI64ArrayAttr
property vector: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.VectorType]
class iree.compiler.dialects.vector.TypeCastOp(result, memref, *, loc=None, ip=None)

Performs a conversion from a memref with scalar element to a memref with a single vector element, copying the shape of the memref to the vector. This is the minimal viable operation that is required to makeke super-vectorization operational. It can be seen as a special case of the view operation but scoped in the super-vectorization context.

Example:

`mlir %A  = memref.alloc() : memref<5x4x3xf32> %VA = vector.type_cast %A : memref<5x4x3xf32> to memref<vector<5x4x3xf32>> `

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.TypeCastOpAdaptor

OPERATION_NAME = 'vector.type_cast'
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
property result: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.MemRefType]

Shortcut to get an op result if it has only one (throws an error otherwise).

class iree.compiler.dialects.vector.TypeCastOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.type_cast'
property memref: iree.compiler._mlir_libs._mlir.ir.Value[iree.compiler._mlir_libs._mlir.ir.MemRefType]
class iree.compiler.dialects.vector.VectorScaleOp(*, results=None, loc=None, ip=None)

The vscale op returns the scale of the scalable vectors, a positive integer value that is constant at runtime but unknown at compile-time. The scale of the vector indicates the multiplicity of the vectors and vector operations. For example, a vector<[4]xi32> is equivalent to vscale consecutive vector<4xi32>; and an operation on a vector<[4]xi32> is equivalent to performing that operation vscale times, once on each <4xi32> segment of the scalable vector. The vscale op can be used to calculate the step in vector-length agnostic (VLA) loops. Right now we only support one contiguous set of scalable dimensions, all of them grouped and scaled with the value returned by ‘vscale’.

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.VectorScaleOpAdaptor

OPERATION_NAME = 'vector.vscale'
property res: iree.compiler._mlir_libs._mlir.ir.OpResult[iree.compiler._mlir_libs._mlir.ir.IndexType]
class iree.compiler.dialects.vector.VectorScaleOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.vscale'
class iree.compiler.dialects.vector.YieldOp(operands_, *, loc=None, ip=None)

“vector.yield” yields an SSA value from the Vector dialect op region and terminates the regions. The semantics of how the values are yielded is defined by the parent operation. If “vector.yield” has any operands, the operands must correspond to the parent operation’s results. If the parent operation defines no value the vector.yield may be omitted when printing the region.

Adaptor

alias of iree.compiler.dialects._vector_ops_gen.YieldOpAdaptor

OPERATION_NAME = 'vector.yield'
property operands_: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.vector.YieldOpAdaptor(*args, **kwargs)
OPERATION_NAME = 'vector.yield'
property operands_: iree.compiler._mlir_libs._mlir.ir.OpOperandList
class iree.compiler.dialects.vector.auto(value=_auto_null)

Instances are replaced with an appropriate value in Enum class suites.

iree.compiler.dialects.vector.bitcast(result, source, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.broadcast(vector, source, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.compressstore(base, indices, mask, value_to_store, *, alignment=None, loc=None, ip=None) iree.compiler.dialects._vector_ops_gen.CompressStoreOp
iree.compiler.dialects.vector.constant_mask(result, mask_dim_sizes, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.contract(result, lhs, rhs, acc, indexing_maps, iterator_types, *, kind=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.create_mask(result, operands_, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.deinterleave(source, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResultList
iree.compiler.dialects.vector.expandload(result, base, indices, mask, pass_thru, *, alignment=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.extract(source, dynamic_position, static_position, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.extract_strided_slice(result, source, offsets, sizes, strides, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.fma(lhs, rhs, acc, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.from_elements(dest, elements, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.gather(result, base, offsets, indices, mask, pass_thru, *, alignment=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.insert(value_to_store, dest, dynamic_position, static_position, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.insert_strided_slice(value_to_store, dest, offsets, strides, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.interleave(lhs, rhs, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.load(result, base, indices, *, nontemporal=None, alignment=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.mask(results_, mask, *, passthru=None, loc=None, ip=None) Union[iree.compiler._mlir_libs._mlir.ir.OpResult, iree.compiler._mlir_libs._mlir.ir.OpResultList, iree.compiler.dialects._vector_ops_gen.MaskOp]
iree.compiler.dialects.vector.maskedload(result, base, indices, mask, pass_thru, *, alignment=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.maskedstore(base, indices, mask, value_to_store, *, alignment=None, loc=None, ip=None) iree.compiler.dialects._vector_ops_gen.MaskedStoreOp
iree.compiler.dialects.vector.multi_reduction(kind, source, acc, reduction_dims, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.outerproduct(result, lhs, rhs, *, acc=None, kind=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.print_(*, source=None, punctuation=None, string_literal=None, loc=None, ip=None) iree.compiler.dialects._vector_ops_gen.PrintOp
iree.compiler.dialects.vector.reduction(dest, kind, vector, *, acc=None, fastmath=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.register_attribute_builder(kind, replace=False)
iree.compiler.dialects.vector.scalable_extract(result, source, pos, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.scalable_insert(value_to_store, dest, pos, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.scan(kind, source, initial_value, reduction_dim, inclusive, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResultList
iree.compiler.dialects.vector.scatter(result, base, offsets, indices, mask, value_to_store, *, alignment=None, loc=None, ip=None) Union[iree.compiler._mlir_libs._mlir.ir.OpResult, iree.compiler._mlir_libs._mlir.ir.OpResultList, iree.compiler.dialects._vector_ops_gen.ScatterOp]
iree.compiler.dialects.vector.shape_cast(result, source, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.shuffle(v1, v2, mask, *, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.step(result, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.store(value_to_store, base, indices, *, nontemporal=None, alignment=None, loc=None, ip=None) iree.compiler.dialects._vector_ops_gen.StoreOp
iree.compiler.dialects.vector.to_elements(source, *, results=None, loc=None, ip=None) Union[iree.compiler._mlir_libs._mlir.ir.OpResult, iree.compiler._mlir_libs._mlir.ir.OpResultList, iree.compiler.dialects._vector_ops_gen.ToElementsOp]
iree.compiler.dialects.vector.transfer_read(vector, base, indices, permutation_map, padding, in_bounds, *, mask=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.transfer_write(result, value_to_store, base, indices, permutation_map, in_bounds, *, mask=None, loc=None, ip=None) Union[iree.compiler._mlir_libs._mlir.ir.OpResult, iree.compiler._mlir_libs._mlir.ir.OpResultList, iree.compiler.dialects._vector_ops_gen.TransferWriteOp]
iree.compiler.dialects.vector.transpose(result, vector, permutation, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.type_cast(result, memref, *, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.vscale(*, results=None, loc=None, ip=None) iree.compiler._mlir_libs._mlir.ir.OpResult
iree.compiler.dialects.vector.yield_(operands_, *, loc=None, ip=None) iree.compiler.dialects._vector_ops_gen.YieldOp