mlir.dialects.linalg

Submodules

Attributes

Exceptions

MLIRError

Common base class for all non-exit exceptions.

Classes

_Dialect

AbsOp

No numeric casting is performed on the input operand.

AbsOpAdaptor

AddOp

The shapes and element types must be identical. The appropriate casts,

AddOpAdaptor

BatchMatmulOp

Numeric casting is performed on the operands to the inner multiply, promoting

BatchMatmulOpAdaptor

BatchMatvecOp

Numeric casting is performed on the operands to the inner multiply, promoting

BatchMatvecOpAdaptor

BatchMmt4DOp

Besides the outermost batch dimension has the same semantic as

BatchMmt4DOpAdaptor

BatchReduceMatmulOp

Numeric casting is performed on the operands to the inner multiply,

BatchReduceMatmulOpAdaptor

BatchVecmatOp

Numeric casting is performed on the operands to the inner multiply, promoting

BatchVecmatOpAdaptor

BroadcastOp

Broadcast the input into the given shape by adding dimensions.

BroadcastOpAdaptor

CeilOp

No numeric casting is performed on the input operand.

CeilOpAdaptor

ContractOp

The semantics of contracting inputs A and B on top of C to produce

ContractOpAdaptor

Conv1DNcwFcwOp

Layout:

Conv1DNcwFcwOpAdaptor

Conv1DNwcWcfOp

Numeric casting is performed on the operands to the inner multiply, promoting

Conv1DNwcWcfOpAdaptor

Conv1DOp

Numeric casting is performed on the operands to the inner multiply, promoting

Conv1DOpAdaptor

Conv2DNchwFchwOp

Layout:

Conv2DNchwFchwOpAdaptor

Conv2DNchwFchwQOp

Layout:

Conv2DNchwFchwQOpAdaptor

Conv2DNgchwFgchwOp

Layout:

Conv2DNgchwFgchwOpAdaptor

Conv2DNgchwGfchwOp

Layout:

Conv2DNgchwGfchwOpAdaptor

Conv2DNgchwGfchwQOp

Layout:

Conv2DNgchwGfchwQOpAdaptor

Conv2DNhwcFhwcOp

Layout:

Conv2DNhwcFhwcOpAdaptor

Conv2DNhwcFhwcQOp

Layout:

Conv2DNhwcFhwcQOpAdaptor

Conv2DNhwcHwcfOp

Layout:

Conv2DNhwcHwcfOpAdaptor

Conv2DNhwcHwcfQOp

Layout:

Conv2DNhwcHwcfQOpAdaptor

Conv2DNhwgcGfhwcOp

Layout:

Conv2DNhwgcGfhwcOpAdaptor

Conv2DNhwgcGfhwcQOp

Layout:

Conv2DNhwgcGfhwcQOpAdaptor

Conv2DOp

Numeric casting is performed on the operands to the inner multiply, promoting

Conv2DOpAdaptor

Conv3DNcdhwFcdhwOp

Numeric casting is performed on the operands to the inner multiply, promoting

Conv3DNcdhwFcdhwOpAdaptor

Conv3DNdhwcDhwcfOp

Numeric casting is performed on the operands to the inner multiply, promoting

Conv3DNdhwcDhwcfOpAdaptor

Conv3DNdhwcDhwcfQOp

Numeric casting is performed on the operands to the inner multiply, promoting

Conv3DNdhwcDhwcfQOpAdaptor

Conv3DOp

Numeric casting is performed on the operands to the inner multiply, promoting

Conv3DOpAdaptor

CopyOp

Numeric casting is performed on the input operand, promoting it to the same

CopyOpAdaptor

DepthwiseConv1DNcwCwOp

Numeric casting is performed on the operands to the inner multiply, promoting

DepthwiseConv1DNcwCwOpAdaptor

DepthwiseConv1DNwcWcOp

Numeric casting is performed on the operands to the inner multiply, promoting

DepthwiseConv1DNwcWcOpAdaptor

DepthwiseConv1DNwcWcmOp

Numeric casting is performed on the operands to the inner multiply, promoting

DepthwiseConv1DNwcWcmOpAdaptor

DepthwiseConv2DNchwChwOp

Numeric casting is performed on the operands to the inner multiply, promoting

DepthwiseConv2DNchwChwOpAdaptor

DepthwiseConv2DNhwcHwcOp

Numeric casting is performed on the operands to the inner multiply, promoting

DepthwiseConv2DNhwcHwcOpAdaptor

DepthwiseConv2DNhwcHwcQOp

Numeric casting is performed on the operands to the inner multiply, promoting

DepthwiseConv2DNhwcHwcQOpAdaptor

DepthwiseConv2DNhwcHwcmOp

Numeric casting is performed on the operands to the inner multiply, promoting

DepthwiseConv2DNhwcHwcmOpAdaptor

DepthwiseConv2DNhwcHwcmQOp

Numeric casting is performed on the operands to the inner multiply, promoting

DepthwiseConv2DNhwcHwcmQOpAdaptor

DepthwiseConv3DNcdhwCdhwOp

Numeric casting is performed on the operands to the inner multiply, promoting

DepthwiseConv3DNcdhwCdhwOpAdaptor

DepthwiseConv3DNdhwcDhwcOp

Numeric casting is performed on the operands to the inner multiply, promoting

DepthwiseConv3DNdhwcDhwcOpAdaptor

DepthwiseConv3DNdhwcDhwcmOp

Numeric casting is performed on the operands to the inner multiply, promoting

DepthwiseConv3DNdhwcDhwcmOpAdaptor

DivOp

The shapes and element types must be identical. The appropriate casts,

DivOpAdaptor

DivUnsignedOp

The shapes and element types must be identical. The appropriate casts,

DivUnsignedOpAdaptor

DotOp

Numeric casting is performed on the operands to the inner multiply, promoting

DotOpAdaptor

ElementwiseOp

ElementwiseOpAdaptor

ErfOp

No numeric casting is performed on the input operand.

ErfOpAdaptor

ExpOp

No numeric casting is performed on the input operand.

ExpOpAdaptor

FillOp

Works for arbitrary ranked output tensors since the operation performs

FillOpAdaptor

FillRng2DOp

The operation generations pseudo random numbers using a linear congruential

FillRng2DOpAdaptor

FloorOp

No numeric casting is performed on the input operand.

FloorOpAdaptor

GenericOp

Generic Linalg op form where the key properties of the computation are

GenericOpAdaptor

IndexOp

The linalg.index operation returns the iteration index of the immediately

IndexOpAdaptor

PackOp

The "pack" operation converts a source tensor of rank n into a result

PackOpAdaptor

SoftmaxOp

linalg.softmax computes a numerically stable version of softmax.

SoftmaxOpAdaptor

UnPackOp

The "unpack" operation converts a source tensor of rank n with a tiled and

UnPackOpAdaptor

WinogradFilterTransformOp

Winograd Conv2D algorithm will convert linalg Conv2D operator into batched

WinogradFilterTransformOpAdaptor

WinogradInputTransformOp

Winograd Conv2D algorithm will convert linalg Conv2D operator into batched

WinogradInputTransformOpAdaptor

WinogradOutputTransformOp

Winograd Conv2D algorithm will convert linalg Conv2D operator into batched

WinogradOutputTransformOpAdaptor

YieldOp

linalg.yield is a special terminator operation for blocks inside regions

YieldOpAdaptor

LogOp

No numeric casting is performed on the input operand.

LogOpAdaptor

MapOp

Models elementwise operations on tensors in terms of arithmetic operations

MapOpAdaptor

MatmulOp

Numeric casting is performed on the operands to the inner multiply,

MatmulOpAdaptor

MatvecOp

Numeric casting is performed on the operands to the inner multiply, promoting

MatvecOpAdaptor

MaxOp

The shapes and element types must be identical. The appropriate casts,

MaxOpAdaptor

MinOp

The shapes and element types must be identical. The appropriate casts,

MinOpAdaptor

Mmt4DOp

Differences from linalg.matmul:

Mmt4DOpAdaptor

MulOp

The shapes and element types must be identical. The appropriate casts,

MulOpAdaptor

NegFOp

No numeric casting is performed on the input operand.

NegFOpAdaptor

PoolingNchwMaxOp

Numeric casting is performed on the input operand, promoting it to the same

PoolingNchwMaxOpAdaptor

PoolingNchwSumOp

Layout:

PoolingNchwSumOpAdaptor

PoolingNcwMaxOp

Numeric casting is performed on the input operand, promoting it to the same

PoolingNcwMaxOpAdaptor

PoolingNcwSumOp

Layout:

PoolingNcwSumOpAdaptor

PoolingNdhwcMaxOp

Numeric casting is performed on the input operand, promoting it to the same

PoolingNdhwcMaxOpAdaptor

PoolingNdhwcMinOp

Numeric casting is performed on the input operand, promoting it to the same

PoolingNdhwcMinOpAdaptor

PoolingNdhwcSumOp

Numeric casting is performed on the input operand, promoting it to the same

PoolingNdhwcSumOpAdaptor

PoolingNhwcMaxOp

Numeric casting is performed on the input operand, promoting it to the same

PoolingNhwcMaxOpAdaptor

PoolingNhwcMaxUnsignedOp

Numeric casting is performed on the input operand, promoting it to the same

PoolingNhwcMaxUnsignedOpAdaptor

PoolingNhwcMinOp

Numeric casting is performed on the input operand, promoting it to the same

PoolingNhwcMinOpAdaptor

PoolingNhwcMinUnsignedOp

Numeric casting is performed on the input operand, promoting it to the same

PoolingNhwcMinUnsignedOpAdaptor

PoolingNhwcSumOp

Layout:

PoolingNhwcSumOpAdaptor

PoolingNwcMaxOp

Numeric casting is performed on the input operand, promoting it to the same

PoolingNwcMaxOpAdaptor

PoolingNwcMaxUnsignedOp

Numeric casting is performed on the input operand, promoting it to the same

PoolingNwcMaxUnsignedOpAdaptor

PoolingNwcMinOp

Numeric casting is performed on the input operand, promoting it to the same

PoolingNwcMinOpAdaptor

PoolingNwcMinUnsignedOp

Numeric casting is performed on the input operand, promoting it to the same

PoolingNwcMinUnsignedOpAdaptor

PoolingNwcSumOp

Layout:

PoolingNwcSumOpAdaptor

PowFOp

Only applies to floating point values.

PowFOpAdaptor

QuantizedBatchMatmulOp

Numeric casting is performed on the operands to the inner multiply, promoting

QuantizedBatchMatmulOpAdaptor

QuantizedMatmulOp

Numeric casting is performed on the operands to the inner multiply, promoting

QuantizedMatmulOpAdaptor

ReciprocalOp

No numeric casting is performed on the input operand.

ReciprocalOpAdaptor

ReduceOp

Executes combiner on the dimensions of inputs and returns the

ReduceOpAdaptor

RoundOp

No numeric casting is performed on the input operand.

RoundOpAdaptor

RsqrtOp

No numeric casting is performed on the input operand.

RsqrtOpAdaptor

SelectOp

The shapes and element types must be identical. The appropriate casts,

SelectOpAdaptor

SqrtOp

No numeric casting is performed on the input operand.

SqrtOpAdaptor

SquareOp

No numeric casting is performed on the input operand.

SquareOpAdaptor

SubOp

The shapes and element types must be identical. The appropriate casts,

SubOpAdaptor

TanhOp

No numeric casting is performed on the input operand.

TanhOpAdaptor

TransposeOp

Permutes the dimensions of input according to the given permutation.

TransposeOpAdaptor

VecmatOp

Numeric casting is performed on the operands to the inner multiply, promoting

VecmatOpAdaptor

_Dialect

BinaryFn

Binary function namespace.

ElementwiseArityGroup

allowed 32-bit signless integer cases: 1, 2, 3

ElementwiseCaseLimits

allowed 32-bit signless integer cases:

ElementwiseKind

allowed 32-bit signless integer cases: 0, 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

IteratorType

Iterator type

TernaryFn

Ternary function namespace.

TypeFn

Type conversion function namespace.

UnaryFn

Unary function namespace.

WinogradConv2DFmr

allowed 32-bit signless integer cases: 0, 1, 2

DefinedOpCallable

Callable that wraps any defined op function.

TensorExpression

An expression that can appear on the RHS of a comprehension.

TensorUse

A used tensor represented by its (tensor_name, indices).

TensorFn

Application of a tensor function.

TensorReduceFn

Application of a reduction function.

const

Returns the given constant floating point or integer value.

index

Returns the iteration index for a given dimension name.

FunctionKind

Generic enumeration.

UnaryFnType

Unary function.

UnaryFn

Unary function namespace.

BinaryFnType

Binary function.

BinaryFn

Binary function namespace.

TernaryFnType

Ternary function.

TernaryFn

Ternary function namespace.

TypeFnType

Type conversion function.

TypeFn

Type conversion function namespace.

ReduceFnUse

Reduction function use.

ReduceFnType

Reduction function.

ReduceFn

OperandKind

Generic enumeration.

OperandDef

Definition of an operand passed to an operation.

TensorDef

Tensor operand definition.

ScalarDef

Scalar operand definition.

IndexAttrDef

Index attribute definition.

UnaryFnAttrDef

Unary function attribute definition.

BinaryFnAttrDef

Binary function attribute definition.

TernaryFnAttrDef

Ternary function attribute definition.

TypeFnAttrDef

Type conversion function attribute definition.

Comprehension

Represents a single comprehension.

OpInterfaceDef

An interface that an op implements.

OpDefinitionDef

A method that an op implements.

OpMetadataDef

Metadata about the op (generally not behavior impacting).

LinalgOpDef

Definition of a linalg op.

AffineBuildState

Internal state for the AffineExprDef._create impls.

AffineExprDef

Base class for an affine expression being defined.

DimDef

Represents a named dimension.

SymbolDef

Represents a named symbol.

ScalarAssign

An assignment to a named argument (LHS of a comprehension).

ScalarFn

A type of ScalarExpression that applies a function.

ScalarArg

A type of ScalarExpression that references a named argument.

ScalarConst

A type of ScalarExpression representing a constant.

ScalarIndex

A type of ScalarExpression accessing an iteration index.

ScalarExpression

An expression on scalar values.

TypeVar

A replaceable type variable.

YAMLObject

An object that can dump itself to a YAML stream

LinalgStructuredOpConfig

Configuration for metadata sufficient to construct a linalg named op.

LinalgOpConfig

Container for any supported linalg op type.

OperandDefConfig

Wrapper containing an operand definition with additional state.

_GlobalDebug

_OperationBase

OnExplicitAction

Generic enumeration.

CurrentLocAction

Generic enumeration.

DiagnosticSeverity

Generic enumeration.

WalkOrder

Generic enumeration.

OperationEquivalenceFlags

Support for integer-based Flags

WalkResult

Generic enumeration.

Diagnostic

DiagnosticInfo

DiagnosticHandler

ThreadPool

Context

DialectDescriptor

Dialects

Dialect

DialectRegistry

Location

UnknownLoc

FileLineColLoc

NameLoc

CallSiteLoc

FusedLoc

Module

Operation

OpView

OpAdaptor

Region

Block

InsertionPoint

Attribute

NamedAttribute

Type

TypeID

Value

Abstract base class for generic types.

BlockArgument

Abstract base class for generic types.

OpResult

Abstract base class for generic types.

OpOperand

AsmState

SymbolTable

BlockArgumentList

All the operations on a read-only sequence.

BlockIterator

BlockList

BlockSuccessors

All the operations on a read-only sequence.

BlockPredecessors

All the operations on a read-only sequence.

OperationIterator

OperationList

OpAttributeMap

OpOperandIterator

OpOperandList

All the operations on a read-only sequence.

OpOperands

All the operations on a read-only sequence.

OpResultList

All the operations on a read-only sequence.

OpSuccessors

All the operations on a read-only sequence.

RegionSequence

All the operations on a read-only sequence.

AttrBuilder

DynamicOpTrait

IsTerminatorTrait

NoTerminatorTrait

IsIsolatedFromAboveTrait

RecursiveMemoryEffectsTrait

AffineExpr

AffineConstantExpr

AffineDimExpr

AffineSymbolExpr

AffineBinaryExpr

AffineAddExpr

AffineMulExpr

AffineModExpr

AffineFloorDivExpr

AffineCeilDivExpr

AffineMap

AffineExprList

All the operations on a read-only sequence.

IntegerSet

IntegerSetConstraint

IntegerSetConstraintList

All the operations on a read-only sequence.

AffineMapAttr

DenseBoolArrayAttr

DenseBoolArrayIterator

DenseI8ArrayAttr

DenseI8ArrayIterator

DenseI16ArrayAttr

DenseI16ArrayIterator

DenseI32ArrayAttr

DenseI32ArrayIterator

DenseI64ArrayAttr

DenseI64ArrayIterator

DenseF32ArrayAttr

DenseF32ArrayIterator

DenseF64ArrayAttr

DenseF64ArrayIterator

ArrayAttr

ArrayAttributeIterator

BoolAttr

DenseElementsAttr

DenseFPElementsAttr

DenseIntElementsAttr

DenseResourceElementsAttr

DictAttr

SymbolRefAttr

FlatSymbolRefAttr

OpaqueAttr

FloatAttr

IntegerAttr

IntegerSetAttr

StringAttr

TypeAttr

UnitAttr

StridedLayoutAttr

DynamicAttr

Speculatability

Generic enumeration.

MemoryEffect

A memory effect.

SideEffectResource

A side effect resource.

MemoryEffectInstance

A concrete instance of a memory effect.

ConditionallySpeculatable

InferShapedTypeOpInterface

InferTypeOpInterface

MemoryEffectsOpInterface

ShapedTypeComponents

IntegerType

FloatType

IndexType

Float4E2M1FNType

Float6E2M3FNType

Float6E3M2FNType

Float8E4M3FNType

Float8E5M2Type

Float8E4M3Type

Float8E4M3FNUZType

Float8E4M3B11FNUZType

Float8E5M2FNUZType

Float8E3M4Type

Float8E8M0FNUType

Float8E5M3FNUType

BF16Type

F16Type

FloatTF32Type

F32Type

F64Type

NoneType

ComplexType

ShapedType

VectorType

RankedTensorType

UnrankedTensorType

MemRefType

UnrankedMemRefType

TupleType

FunctionType

OpaqueType

DynamicType

GenericOp_

Generic Linalg op form where the key properties of the computation are

ElementwiseOp_

The attribute kind describes arithmetic operation to perform. The

Functions

_ods_equally_sized_accessor(elements, n_simple, ...)

Returns a starting position and a number of elements per variadic group

_ods_get_default_loc_context([location])

Returns a context in which the defaulted location is created. If the location

_get_op_results_or_values(...)

Returns the given sequence of values or the results of the given op.

_ods_segmented_accessor(elements, raw_segments, idx)

Returns a slice of elements corresponding to the idx-th segment.

abs([I, O])

Applies abs(x) elementwise.

add([lhs, rhs, O])

Adds two tensors elementwise.

batch_matmul(*ins, outs[, indexing_maps, cast])

batch_matvec([A, B, C])

Performs a batched matrix-vector multiplication.

batch_mmt4d([lhs, rhs, accum])

Performs a batched matrix-matrix-transpose multiplication of two

batch_reduce_matmul(*ins, outs[, indexing_maps, cast])

batch_vecmat([A, B, C])

Performs a batched matrix-vector multiplication.

broadcast(input, *, outs, dimensions)

ceil([I, O])

Applies ceil(x) elementwise.

contract(*ins, outs, indexing_maps[, cast])

conv_1d_ncw_fcw([I, K, O, strides, dilations])

Performs 1-D convolution.

conv_1d_nwc_wcf([I, K, O, strides, dilations])

Performs 1-D convolution.

conv_1d([I, K, O])

Performs 1-D convolution with no channels.

conv_2d_nchw_fchw([I, K, O, strides, dilations])

Performs 2-D convolution.

conv_2d_nchw_fchw_q([I, K, IZp, KZp, O, strides, ...])

Performs 2-D convolution with zero point offsets.

conv_2d_ngchw_fgchw([I, K, O, strides, dilations])

Performs 2-D grouped convolution.

conv_2d_ngchw_gfchw([I, K, O, strides, dilations])

Performs 2-D grouped convolution.

conv_2d_ngchw_gfchw_q([I, K, IZp, KZp, O, strides, ...])

Performs 2-D grouped convolution with zero-point offsets.

conv_2d_nhwc_fhwc([I, K, O, strides, dilations])

Performs 2-D convolution.

conv_2d_nhwc_fhwc_q([I, K, IZp, KZp, O, strides, ...])

Performs 2-D convolution with zero point offsets.

conv_2d_nhwc_hwcf([I, K, O, strides, dilations])

Performs 2-D convolution.

conv_2d_nhwc_hwcf_q([I, K, IZp, KZp, O, strides, ...])

Performs 2-D convolution with zero point offsets.

conv_2d_nhwgc_gfhwc([I, K, O, strides, dilations])

Performs 2-D grouped convolution.

conv_2d_nhwgc_gfhwc_q([I, K, IZp, KZp, O, strides, ...])

Performs 2-D grouped convolution with zero point offsets.

conv_2d([I, K, O])

Performs 2-D convolution with no channels.

conv_3d_ncdhw_fcdhw([I, K, O, strides, dilations])

Performs 3-D convolution.

conv_3d_ndhwc_dhwcf([I, K, O, strides, dilations])

Performs 3-D convolution.

conv_3d_ndhwc_dhwcf_q([I, K, IZp, KZp, O, strides, ...])

Performs 3-D convolution with zero point offsets.

conv_3d([I, K, O])

Performs 3-D convolution with no channels.

copy([I, O, cast])

Copies the tensor elementwise.

depthwise_conv_1d_ncw_cw([I, K, O, strides, dilations])

Performs depth-wise 1-D convolution.

depthwise_conv_1d_nwc_wc([I, K, O, strides, dilations])

Performs depth-wise 1-D convolution.

depthwise_conv_1d_nwc_wcm([I, K, O, strides, dilations])

Performs depth-wise 1-D convolution.

depthwise_conv_2d_nchw_chw([I, K, O, strides, dilations])

Performs depth-wise 2-D convolution.

depthwise_conv_2d_nhwc_hwc([I, K, O, strides, dilations])

Performs depth-wise 2-D convolution.

depthwise_conv_2d_nhwc_hwc_q([I, K, IZp, KZp, O, ...])

Performs depth-wise 2-D convolution.

depthwise_conv_2d_nhwc_hwcm([I, K, O, strides, dilations])

Performs depth-wise 2-D convolution.

depthwise_conv_2d_nhwc_hwcm_q([I, K, IZp, KZp, O, ...])

Performs depth-wise 2-D convolution.

depthwise_conv_3d_ncdhw_cdhw([I, K, O, strides, dilations])

Performs depth-wise 3-D convolution.

depthwise_conv_3d_ndhwc_dhwc([I, K, O, strides, dilations])

Performs depth-wise 3-D convolution.

depthwise_conv_3d_ndhwc_dhwcm([I, K, O, strides, ...])

Performs depth-wise 3-D convolution.

div([lhs, rhs, O])

Divides the first tensor by the second tensor, elementwise.

div_unsigned([lhs, rhs, O])

Divides the first tensor by the second tensor, elementwise. For integer

dot([A, B, C])

Performs a dot product of two vectors to a scalar result.

elementwise(*ins, outs, kind[, indexing_maps])

erf([I, O])

Applies erf(x) elementwise.

exp([I, O])

Applies exp(x) elementwise.

fill([value, O])

Fills the output tensor with the given value.

fill_rng_2d([min, max, seed, O])

Fills the output tensor with pseudo random numbers.

floor([I, O])

Applies floor(x) elementwise.

generic

index

Returns the iteration index for a given dimension name.

pack(→ opdsl.ops.core_named_ops.ir.Value)

softmax(→ Union[_ods_ir, _ods_ir, SoftmaxOp])

unpack(→ opdsl.ops.core_named_ops.ir.Value)

winograd_filter_transform(→ _ods_ir[_ods_ir])

winograd_input_transform(→ _ods_ir[_ods_ir])

winograd_output_transform(→ _ods_ir[_ods_ir])

yield_(→ YieldOp)

log([I, O])

Applies log(x) elementwise.

map

matmul(*ins, outs[, indexing_maps, cast])

matvec([A, y, x])

Performs a matrix-vector multiplication.

max([lhs, rhs, O])

Takes the max (signed) between two inputs, elementwise.

min([lhs, rhs, O])

Takes the min (signed) between two inputs, elementwise.

mmt4d([lhs, rhs, accum])

Performs a matrix-matrix-transpose multiplication of two 4D inputs.

mul([lhs, rhs, O])

Multiplies two tensors elementwise.

negf([I, O])

Applies negf(x) elementwise.

pooling_nchw_max([I, K, O, strides, dilations])

Performs max pooling.

pooling_nchw_sum([I, K, O, strides, dilations])

Performs sum pooling.

pooling_ncw_max([I, K, O, strides, dilations])

Performs max pooling.

pooling_ncw_sum([I, K, O, strides, dilations])

Performs sum pooling.

pooling_ndhwc_max([I, K, O, strides, dilations])

Performs 3D max pooling.

pooling_ndhwc_min([I, K, O, strides, dilations])

Performs 3D min pooling.

pooling_ndhwc_sum([I, K, O, strides, dilations])

Performs 3D sum pooling.

pooling_nhwc_max([I, K, O, strides, dilations])

Performs max pooling.

pooling_nhwc_max_unsigned([I, K, O, strides, dilations])

Performs unsigned max pooling.

pooling_nhwc_min([I, K, O, strides, dilations])

Performs min pooling.

pooling_nhwc_min_unsigned([I, K, O, strides, dilations])

Performs unsigned min pooling.

pooling_nhwc_sum([I, K, O, strides, dilations])

Performs sum pooling.

pooling_nwc_max([I, K, O, strides, dilations])

Performs max pooling.

pooling_nwc_max_unsigned([I, K, O, strides, dilations])

Performs unsigned max pooling.

pooling_nwc_min([I, K, O, strides, dilations])

Performs min pooling.

pooling_nwc_min_unsigned([I, K, O, strides, dilations])

Performs unsigned min pooling.

pooling_nwc_sum([I, K, O, strides, dilations])

Performs sum pooling.

powf([lhs, rhs, O])

Takes the powf(lhs, rhs) between two inputs, elementwise. For powf(arg, 2) use linalg.square.

quantized_batch_matmul([A, B, AZp, BZp, C])

Performs a batched matrix multiplication of two 3D inputs.

quantized_matmul([A, B, AZp, BZp, C])

Performs a matrix multiplication of two 2D inputs.

reciprocal([I, O])

Applies reciprocal(x) elementwise.

reduce

round([I, O])

Applies round(x) elementwise.

rsqrt([I, O])

Applies rsqrt(x) elementwise.

select([cond, lhs, rhs, O])

Chooses one value based on a binary condition supplied as its first operand.

sqrt([I, O])

Applies sqrt(x) elementwise.

square([I, O])

Applies square(x) elementwise.

sub([lhs, rhs, O])

Subtracts two tensors elementwise.

tanh([I, O])

Applies tanh(x) elementwise.

transpose(input, *, outs, permutation)

vecmat([y, A, x])

Performs a vector-matrix multiplication.

register_attribute_builder(kind[, replace, allow_existing])

_binaryfn(x, context)

_elementwisearitygroup(x, context)

_elementwisecaselimits(x, context)

_elementwisekind(x, context)

_iteratortype(x, context)

_ternaryfn(x, context)

_typefn(x, context)

_unaryfn(x, context)

_winogradconv2dfmr(x, context)

_binaryfnattr(x, context)

_elementwisekindattr(x, context)

_iteratortypeenum(x, context)

_ternaryfnattr(x, context)

_typefnattr(x, context)

_unaryfnattr(x, context)

_iteratortypeenum(x, context)

copy([I, O, cast])

Copies the tensor elementwise.

exp([I, O])

Applies exp(x) elementwise.

log([I, O])

Applies log(x) elementwise.

abs([I, O])

Applies abs(x) elementwise.

ceil([I, O])

Applies ceil(x) elementwise.

floor([I, O])

Applies floor(x) elementwise.

negf([I, O])

Applies negf(x) elementwise.

reciprocal([I, O])

Applies reciprocal(x) elementwise.

round([I, O])

Applies round(x) elementwise.

sqrt([I, O])

Applies sqrt(x) elementwise.

rsqrt([I, O])

Applies rsqrt(x) elementwise.

square([I, O])

Applies square(x) elementwise.

tanh([I, O])

Applies tanh(x) elementwise.

erf([I, O])

Applies erf(x) elementwise.

add([lhs, rhs, O])

Adds two tensors elementwise.

sub([lhs, rhs, O])

Subtracts two tensors elementwise.

mul([lhs, rhs, O])

Multiplies two tensors elementwise.

div([lhs, rhs, O])

Divides the first tensor by the second tensor, elementwise.

div_unsigned([lhs, rhs, O])

Divides the first tensor by the second tensor, elementwise. For integer

max([lhs, rhs, O])

Takes the max (signed) between two inputs, elementwise.

min([lhs, rhs, O])

Takes the min (signed) between two inputs, elementwise.

powf([lhs, rhs, O])

Takes the powf(lhs, rhs) between two inputs, elementwise. For powf(arg, 2) use linalg.square.

select([cond, lhs, rhs, O])

Chooses one value based on a binary condition supplied as its first operand.

quantized_matmul([A, B, AZp, BZp, C])

Performs a matrix multiplication of two 2D inputs.

mmt4d([lhs, rhs, accum])

Performs a matrix-matrix-transpose multiplication of two 4D inputs.

batch_mmt4d([lhs, rhs, accum])

Performs a batched matrix-matrix-transpose multiplication of two

quantized_batch_matmul([A, B, AZp, BZp, C])

Performs a batched matrix multiplication of two 3D inputs.

matvec([A, y, x])

Performs a matrix-vector multiplication.

vecmat([y, A, x])

Performs a vector-matrix multiplication.

batch_matvec([A, B, C])

Performs a batched matrix-vector multiplication.

batch_vecmat([A, B, C])

Performs a batched matrix-vector multiplication.

dot([A, B, C])

Performs a dot product of two vectors to a scalar result.

conv_1d([I, K, O])

Performs 1-D convolution with no channels.

conv_2d([I, K, O])

Performs 2-D convolution with no channels.

conv_3d([I, K, O])

Performs 3-D convolution with no channels.

conv_1d_nwc_wcf([I, K, O, strides, dilations])

Performs 1-D convolution.

conv_1d_ncw_fcw([I, K, O, strides, dilations])

Performs 1-D convolution.

conv_2d_nhwc_hwcf([I, K, O, strides, dilations])

Performs 2-D convolution.

conv_2d_nhwc_fhwc([I, K, O, strides, dilations])

Performs 2-D convolution.

conv_2d_nhwc_hwcf_q([I, K, IZp, KZp, O, strides, ...])

Performs 2-D convolution with zero point offsets.

conv_2d_nhwc_fhwc_q([I, K, IZp, KZp, O, strides, ...])

Performs 2-D convolution with zero point offsets.

conv_2d_nchw_fchw_q([I, K, IZp, KZp, O, strides, ...])

Performs 2-D convolution with zero point offsets.

conv_2d_nchw_fchw([I, K, O, strides, dilations])

Performs 2-D convolution.

conv_2d_ngchw_fgchw([I, K, O, strides, dilations])

Performs 2-D grouped convolution.

conv_2d_ngchw_gfchw([I, K, O, strides, dilations])

Performs 2-D grouped convolution.

conv_2d_nhwgc_gfhwc([I, K, O, strides, dilations])

Performs 2-D grouped convolution.

conv_2d_nhwgc_gfhwc_q([I, K, IZp, KZp, O, strides, ...])

Performs 2-D grouped convolution with zero point offsets.

conv_2d_ngchw_gfchw_q([I, K, IZp, KZp, O, strides, ...])

Performs 2-D grouped convolution with zero-point offsets.

conv_3d_ndhwc_dhwcf([I, K, O, strides, dilations])

Performs 3-D convolution.

conv_3d_ndhwc_dhwcf_q([I, K, IZp, KZp, O, strides, ...])

Performs 3-D convolution with zero point offsets.

conv_3d_ncdhw_fcdhw([I, K, O, strides, dilations])

Performs 3-D convolution.

depthwise_conv_1d_nwc_wc([I, K, O, strides, dilations])

Performs depth-wise 1-D convolution.

depthwise_conv_1d_ncw_cw([I, K, O, strides, dilations])

Performs depth-wise 1-D convolution.

depthwise_conv_1d_nwc_wcm([I, K, O, strides, dilations])

Performs depth-wise 1-D convolution.

depthwise_conv_2d_nhwc_hwc([I, K, O, strides, dilations])

Performs depth-wise 2-D convolution.

depthwise_conv_2d_nchw_chw([I, K, O, strides, dilations])

Performs depth-wise 2-D convolution.

depthwise_conv_2d_nhwc_hwc_q([I, K, IZp, KZp, O, ...])

Performs depth-wise 2-D convolution.

depthwise_conv_2d_nhwc_hwcm([I, K, O, strides, dilations])

Performs depth-wise 2-D convolution.

depthwise_conv_2d_nhwc_hwcm_q([I, K, IZp, KZp, O, ...])

Performs depth-wise 2-D convolution.

depthwise_conv_3d_ndhwc_dhwc([I, K, O, strides, dilations])

Performs depth-wise 3-D convolution.

depthwise_conv_3d_ncdhw_cdhw([I, K, O, strides, dilations])

Performs depth-wise 3-D convolution.

depthwise_conv_3d_ndhwc_dhwcm([I, K, O, strides, ...])

Performs depth-wise 3-D convolution.

pooling_nhwc_sum([I, K, O, strides, dilations])

Performs sum pooling.

pooling_nchw_sum([I, K, O, strides, dilations])

Performs sum pooling.

pooling_nhwc_max([I, K, O, strides, dilations])

Performs max pooling.

pooling_nhwc_max_unsigned([I, K, O, strides, dilations])

Performs unsigned max pooling.

pooling_nchw_max([I, K, O, strides, dilations])

Performs max pooling.

pooling_nhwc_min([I, K, O, strides, dilations])

Performs min pooling.

pooling_nhwc_min_unsigned([I, K, O, strides, dilations])

Performs unsigned min pooling.

pooling_nwc_sum([I, K, O, strides, dilations])

Performs sum pooling.

pooling_ncw_sum([I, K, O, strides, dilations])

Performs sum pooling.

pooling_nwc_max([I, K, O, strides, dilations])

Performs max pooling.

pooling_nwc_max_unsigned([I, K, O, strides, dilations])

Performs unsigned max pooling.

pooling_ncw_max([I, K, O, strides, dilations])

Performs max pooling.

pooling_nwc_min([I, K, O, strides, dilations])

Performs min pooling.

pooling_nwc_min_unsigned([I, K, O, strides, dilations])

Performs unsigned min pooling.

pooling_ndhwc_sum([I, K, O, strides, dilations])

Performs 3D sum pooling.

pooling_ndhwc_max([I, K, O, strides, dilations])

Performs 3D max pooling.

pooling_ndhwc_min([I, K, O, strides, dilations])

Performs 3D min pooling.

fill([value, O])

Fills the output tensor with the given value.

fill_rng_2d([min, max, seed, O])

Fills the output tensor with pseudo random numbers.

_get_op_result_or_value(→ mlir._mlir_libs._mlir.ir.Value)

Returns the given value or the single result of the given op.

_get_op_results_or_values(...)

Returns the given sequence of values or the results of the given op.

bind_op_def(op_def)

current_op_def(...)

_prepare_structured_op_outs(...)

linalg_structured_op(→ DefinedOpCallable)

domain(*dimensions)

implements(*interfaces)

defines(*definitions)

yaml_dump(data[, sort_keys])

yaml_dump_all(data[, sort_keys, explicit_start])

emit_generic_structured_op(op_config, *ins, outs, **attrs)

emit_named_structured_op(op_config, op_name, ...)

register_type_caster(...)

Register a type caster for casting MLIR types to custom user types.

register_value_caster(...)

Register a value caster for casting MLIR values to custom user values.

get_dialect_registry()

append_load_on_create_dialect(dialect)

get_load_on_create_dialects()

get_parent_of_type(→ OpView | None)

Return the closest enclosing parent operation of the given type.

get_ops_of_type(→ list[OpView])

Return all operations of the given type in the operation tree.

loc_tracebacks(→ collections.abc.Generator[None, None, ...)

Enables automatic traceback-based locations for MLIR operations.

register_attribute_builder(kind[, replace, allow_existing])

_affineMapAttr(x, context)

_integerSetAttr(x, context)

_boolAttr(x, context)

_dictAttr(x, context)

_indexAttr(x, context)

_i1Attr(x, context)

_i8Attr(x, context)

_i16Attr(x, context)

_i32Attr(x, context)

_i64Attr(x, context)

_si1Attr(x, context)

_si8Attr(x, context)

_si16Attr(x, context)

_si32Attr(x, context)

_si64Attr(x, context)

_ui1Attr(x, context)

_ui8Attr(x, context)

_ui16Attr(x, context)

_ui32Attr(x, context)

_ui64Attr(x, context)

_f32Attr(x, context)

_f64Attr(x, context)

_stringAttr(x, context)

_symbolNameAttr(x, context)

_symbolRefAttr(x, context)

_flatSymbolRefAttr(x, context)

_unitAttr(x, context)

_arrayAttr(x, context)

_affineMapArrayAttr(x, context)

_boolArrayAttr(x, context)

_dictArrayAttr(x, context)

_flatSymbolRefArrayAttr(x, context)

_i32ArrayAttr(x, context)

_i64ArrayAttr(x, context)

_i64SmallVectorArrayAttr(x, context)

_indexListArrayAttr(x, context)

_f32ArrayAttr(x, context)

_f64ArrayAttr(x, context)

_strArrayAttr(x, context)

_symbolRefArrayAttr(x, context)

_denseF32ArrayAttr(x, context)

_denseF64ArrayAttr(x, context)

_denseI8ArrayAttr(x, context)

_denseI16ArrayAttr(x, context)

_denseI32ArrayAttr(x, context)

_denseI64ArrayAttr(x, context)

_denseBoolArrayAttr(x, context)

_typeAttr(x, context)

_typeArrayAttr(x, context)

_memref_type_attr(x, context)

_f64ElementsAttr(x, context)

_get_op_result_or_value(→ mlir._mlir_libs._mlir.ir.Value)

Returns the given value or the single result of the given op.

_get_op_result_or_op_results(...)

_dispatch_mixed_values(→ Tuple[List[mlir.ir.Value], ...)

region_op(op_constructor[, terminator])

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

transpose(input, *, outs, permutation)

broadcast(input, *, outs, dimensions)

_IteratorTypeArrayAttr(x, context)

_create_matmul_like_op(op_type, *ins, outs[, ...])

matmul(*ins, outs[, indexing_maps, cast])

batch_matmul(*ins, outs[, indexing_maps, cast])

batch_reduce_matmul(*ins, outs[, indexing_maps, cast])

contract(*ins, outs, indexing_maps[, cast])

elementwise(*ins, outs, kind[, indexing_maps])

pack(→ opdsl.ops.core_named_ops.ir.Value)

unpack(→ opdsl.ops.core_named_ops.ir.Value)

Package Contents

mlir.dialects.linalg._ods_equally_sized_accessor(elements, n_simple, n_variadic, n_preceding_simple, n_preceding_variadic)

Returns a starting position and a number of elements per variadic group assuming equally-sized groups and the given numbers of preceding groups.

elements: a sequential container. n_simple: the number of non-variadic groups in the container. n_variadic: the number of variadic groups in the container. n_preceding_simple: the number of non-variadic groups preceding the current group. n_preceding_variadic: the number of variadic groups preceding the current group.

mlir.dialects.linalg._ods_get_default_loc_context(location=None)

Returns a context in which the defaulted location is created. If the location is None, takes the current location from the stack.

mlir.dialects.linalg._get_op_results_or_values(arg: mlir._mlir_libs._mlir.ir.OpView | mlir._mlir_libs._mlir.ir.Operation | Sequence[mlir._mlir_libs._mlir.ir.OpView | mlir._mlir_libs._mlir.ir.Operation | mlir._mlir_libs._mlir.ir.Value]) Sequence[mlir._mlir_libs._mlir.ir.OpView | mlir._mlir_libs._mlir.ir.Operation | mlir._mlir_libs._mlir.ir.Value] | mlir._mlir_libs._mlir.ir.OpResultList

Returns the given sequence of values or the results of the given op.

This is useful to implement op constructors so that they can take other ops as lists of arguments instead of requiring the caller to extract results for every op.

mlir.dialects.linalg._ods_segmented_accessor(elements, raw_segments, idx)

Returns a slice of elements corresponding to the idx-th segment.

elements: a sliceable container (operands or results). raw_segments: an mlir.ir.Attribute, of DenseI32Array subclass containing sizes of the segments. idx: index of the segment.

mlir.dialects.linalg._ods_ir
mlir.dialects.linalg._Buffer
class mlir.dialects.linalg._Dialect(descriptor: object)

Bases: _ods_ir

DIALECT_NAMESPACE = 'linalg'
class mlir.dialects.linalg.AbsOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

No numeric casting is performed on the input operand.

OPERATION_NAME = 'linalg.abs'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.AbsOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.AbsOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.abs'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.abs(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | AbsOp
class mlir.dialects.linalg.AddOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

The shapes and element types must be identical. The appropriate casts, broadcasts and reductions should be done previously to calling this op.

This means reduction/broadcast/element cast semantics is explicit. Further passes can take that into account when lowering this code. For example, a linalg.broadcast + linalg.add sequence can be lowered to a linalg.generic with different affine maps for the two operands.

OPERATION_NAME = 'linalg.add'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.AddOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.AddOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.add'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.add(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | AddOp
class mlir.dialects.linalg.BatchMatmulOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, indexing_maps: Any | _ods_ir | None = None, cast: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

Broadcast and Transpose semantics can be appiled by specifying the explicit attribute
'indexing_maps' as shown below. This is a list attribute, so must include maps for all
arguments if specified.

Example Transpose:
```mlir
linalg.batch_matmul
    indexing_maps = [affine_map<(batch, m, n, k) -> (batch, k, m)>, // transpose
                     affine_map<(batch, m, n, k) -> (batch, k, n)>,
                     affine_map<(batch, m, n, k) -> (batch, m, n)>]
    ins(%arg0, %arg1 : memref<2x5x3xf32>,memref<2x5x7xf32>)
    outs(%arg2: memref<2x3x7xf32>)
```

Example Broadcast:
```mlir
linalg.batch_matmul
    indexing_maps = [affine_map<(batch, m, n, k) -> (k)>,           // broadcast
                     affine_map<(batch, m, n, k) -> (batch, k, n)>,
                     affine_map<(batch, m, n, k) -> (batch, m, n)>]
    ins(%arg0, %arg1 : memref<5xf32>, memref<2x5x7xf32>)
    outs(%arg2: memref<2x3x7xf32>)
```

Example Broadcast and Transpose:
```mlir
linalg.batch_matmul
    indexing_maps = [affine_map<(batch, m, n, k) -> (m, k)>,        // broadcast
                     affine_map<(batch, m, n, k) -> (batch, n, k)>, // transpose
                     affine_map<(batch, m, n, k) -> (batch, m, n)>]
    ins(%arg0, %arg1 : memref<3x5xf32>, memref<2x7x5xf32>)
    outs(%arg2: memref<2x3x7xf32>)
```
OPERATION_NAME = 'linalg.batch_matmul'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
indexing_maps() _ods_ir | None
cast() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.BatchMatmulOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.BatchMatmulOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.batch_matmul'
inputs() _ods_ir
outputs() _ods_ir
indexing_maps() _ods_ir | None
cast() _ods_ir | None
mlir.dialects.linalg.batch_matmul(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, indexing_maps: Any | _ods_ir | None = None, cast: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | BatchMatmulOp
class mlir.dialects.linalg.BatchMatvecOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.batch_matvec'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.BatchMatvecOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.BatchMatvecOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.batch_matvec'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.batch_matvec(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | BatchMatvecOp
class mlir.dialects.linalg.BatchMmt4DOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Besides the outermost batch dimension has the same semantic as linalg.batch_matmul, the differences from linalg.batch_matmul in the non-batch dimensions are the same as linalg.mmt4d vs. linalg.matmul. See the description of lingalg.mmt4d.

OPERATION_NAME = 'linalg.batch_mmt4d'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.BatchMmt4DOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.BatchMmt4DOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.batch_mmt4d'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.batch_mmt4d(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | BatchMmt4DOp
class mlir.dialects.linalg.BatchReduceMatmulOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, indexing_maps: Any | _ods_ir | None = None, cast: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

Broadcast and Transpose semantics can be applied by specifying the explicit attribute ‘indexing_maps’ as shown below. This is a list attribute, so must include maps for all arguments if specified.

Example Transpose:

linalg.batch_reduce_matmul
    indexing_maps = [affine_map<(batch, m, n, k) -> (batch, k, m)>, // transpose
                     affine_map<(batch, m, n, k) -> (batch, k, n)>,
                     affine_map<(batch, m, n, k) -> (m, n)>]
    ins(%arg0, %arg1 : memref<2x5x3xf32>,memref<2x5x7xf32>)
    outs(%arg2: memref<3x7xf32>)

Example Broadcast:

linalg.batch_reduce_matmul
    indexing_maps = [affine_map<(batch, m, n, k) -> (k)>,         // broadcast
                     affine_map<(batch, m, n, k) -> (batch, k, n)>,
                     affine_map<(batch, m, n, k) -> (m, n)>]
    ins(%arg0, %arg1 : memref<5xf32>, memref<2x5x7xf32>)
    outs(%arg2: memref<3x7xf32>)

Example Broadcast and Transpose:

linalg.batch_reduce_matmul
    indexing_maps = [affine_map<(batch, m, n, k) -> (m, k)>,        // broadcast
                     affine_map<(batch, m, n, k) -> (batch, n, k)>, // transpose
                     affine_map<(batch, m, n, k) -> (m, n)>]
    ins(%arg0, %arg1 : memref<3x5xf32>, memref<2x7x5xf32>)
    outs(%arg2: memref<3x7xf32>)
OPERATION_NAME = 'linalg.batch_reduce_matmul'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
indexing_maps() _ods_ir | None
cast() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.BatchReduceMatmulOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.BatchReduceMatmulOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.batch_reduce_matmul'
inputs() _ods_ir
outputs() _ods_ir
indexing_maps() _ods_ir | None
cast() _ods_ir | None
mlir.dialects.linalg.batch_reduce_matmul(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, indexing_maps: Any | _ods_ir | None = None, cast: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | BatchReduceMatmulOp
class mlir.dialects.linalg.BatchVecmatOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.batch_vecmat'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.BatchVecmatOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.BatchVecmatOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.batch_vecmat'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.batch_vecmat(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | BatchVecmatOp
class mlir.dialects.linalg.BroadcastOp(result: Sequence[_ods_ir], input: _ods_ir, init: _ods_ir, dimensions: Sequence[int] | _ods_ir, *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Broadcast the input into the given shape by adding dimensions.

Each index in the dimensions attribute refers to a dimension of init that is added by the operation. The indices must be unique and within the rank of init; the sizes of the remaining (non-added) dimensions of init must match the shape of input.

Example:

%bcast = linalg.broadcast
    ins(%input:tensor<16xf32>)
    outs(%init:tensor<16x64xf32>)
    dimensions = [1]
OPERATION_NAME = 'linalg.broadcast'
_ODS_REGIONS = (1, True)
input() _ods_ir
init() _ods_ir
dimensions() _ods_ir
result() _ods_ir

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

region() _ods_ir
class mlir.dialects.linalg.BroadcastOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.BroadcastOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.broadcast'
input() _ods_ir
init() _ods_ir
dimensions() _ods_ir
mlir.dialects.linalg.broadcast(result: Sequence[_ods_ir], input: _ods_ir, init: _ods_ir, dimensions: Sequence[int] | _ods_ir, *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | BroadcastOp
class mlir.dialects.linalg.CeilOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

No numeric casting is performed on the input operand.

OPERATION_NAME = 'linalg.ceil'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.CeilOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.CeilOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.ceil'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.ceil(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | CeilOp
class mlir.dialects.linalg.ContractOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], indexing_maps: Any | _ods_ir, *, cast: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

The semantics of contracting inputs A and B on top of C to produce output D is given by

D[H] = (SUM_{(I J) \ H} A[I] * B[J]) + C[H]

where I, J, and H are tuples of (pairwise distinct) dimension identifiers - meant to range over valid indices - corresponding to the results of the mandatory (projected permutation) indexing_maps for A, B and C. SUM_{dims} means reduce over all valid indices for the dimensions in the set dims (with I, J, and K treated as sets of dim identifiers).

The iteration space consists of all dimensions in I, J and H, i.e. the domain of each of the ``affine_map``s. Like for einsums, the iteration type of each dim is inferred and is either:

  • reduction: the dim is used to index into A and B but not C. Per the

above semantics, these dims will be contracted, i.e. reduced over. * parallel: the dim is used to index into C and at least one of A and B, and - deriving from matmul terminology - is either an “M-like” dim (if used on A and C), an “N-like” dim (if used on B and C) or a “batch”-dim (if used to index into A, B, and C).

For example, batch-matmul is given by I = b, m, k , J = b, k, n , H = b, m, n (with k as a contracting reduction-dimension while m, n and b have parallel iteration-type) and gets represented as:

%D = linalg.contract
    indexing_maps = [affine_map<(batch, m, n, k) -> (batch, m, k)>,
                     affine_map<(batch, m, n, k) -> (batch, k, n)>,
                     affine_map<(batch, m, n, k) -> (batch, m, n)>]
    ins(%A, %B: tensor<?x?x?xf32>, tensor<?x?x?xf32>)
    outs(%C: tensor<?x?x?xf32>) -> tensor<?x?x?xf32>

Note that by permuting dims in the affine_map``s' results, accesses to to the inputs and output can be arbitrarily transposed. Similarly, arbitrary broadcasts can be achieved through leaving out dims on either input operand. For example, the following is a variant of batch-matmul with a transposition applied to ``A while B’s 2D-matrix gets broadcasted along the batch dim:

linalg.contract
    indexing_maps = [affine_map<(batch, m, n, k) -> (batch, k, m)>,
                     affine_map<(batch, m, n, k) -> (k, n)>,
                     affine_map<(batch, m, n, k) -> (batch, m, n)>]
    ins(%A, %B: memref<?x?x?xf32>, memref<?x?xf32>)
    outs(%C: memref<?x?x?xf32>)

Numeric casting is performed on the operands to the inner multiplication, promoting/truncating them to the same data type as the accumulator/output.

TODO: Allow control over the combining/accumulating op and possibly the multiplication op.

OPERATION_NAME = 'linalg.contract'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
indexing_maps() _ods_ir
cast() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
combiner() _ods_ir
class mlir.dialects.linalg.ContractOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.ContractOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.contract'
inputs() _ods_ir
outputs() _ods_ir
indexing_maps() _ods_ir
cast() _ods_ir | None
mlir.dialects.linalg.contract(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], indexing_maps: Any | _ods_ir, *, cast: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | ContractOp
class mlir.dialects.linalg.Conv1DNcwFcwOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Layout:

  • Input: NCW.

  • Kernel: FCW.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.conv_1d_ncw_fcw'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.Conv1DNcwFcwOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.Conv1DNcwFcwOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.conv_1d_ncw_fcw'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.conv_1d_ncw_fcw(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | Conv1DNcwFcwOp
class mlir.dialects.linalg.Conv1DNwcWcfOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.conv_1d_nwc_wcf'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.Conv1DNwcWcfOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.Conv1DNwcWcfOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.conv_1d_nwc_wcf'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.conv_1d_nwc_wcf(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | Conv1DNwcWcfOp
class mlir.dialects.linalg.Conv1DOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.conv_1d'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.Conv1DOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.Conv1DOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.conv_1d'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.conv_1d(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | Conv1DOp
class mlir.dialects.linalg.Conv2DNchwFchwOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Layout:

  • Input: NCHW.

  • Kernel: FCHW.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.conv_2d_nchw_fchw'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.Conv2DNchwFchwOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.Conv2DNchwFchwOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.conv_2d_nchw_fchw'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.conv_2d_nchw_fchw(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | Conv2DNchwFchwOp
class mlir.dialects.linalg.Conv2DNchwFchwQOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Layout:

  • Input: NCHW.

  • Kernel: FCHW.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. This includes the zero point offsets common to quantized operations.

OPERATION_NAME = 'linalg.conv_2d_nchw_fchw_q'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.Conv2DNchwFchwQOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.Conv2DNchwFchwQOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.conv_2d_nchw_fchw_q'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.conv_2d_nchw_fchw_q(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | Conv2DNchwFchwQOp
class mlir.dialects.linalg.Conv2DNgchwFgchwOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Layout:

  • Input: NGCHW.

  • Kernel: FGCHW.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.conv_2d_ngchw_fgchw'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.Conv2DNgchwFgchwOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.Conv2DNgchwFgchwOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.conv_2d_ngchw_fgchw'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.conv_2d_ngchw_fgchw(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | Conv2DNgchwFgchwOp
class mlir.dialects.linalg.Conv2DNgchwGfchwOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Layout:

  • Input: NGCHW.

  • Kernel: GFCHW.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.conv_2d_ngchw_gfchw'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.Conv2DNgchwGfchwOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.Conv2DNgchwGfchwOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.conv_2d_ngchw_gfchw'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.conv_2d_ngchw_gfchw(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | Conv2DNgchwGfchwOp
class mlir.dialects.linalg.Conv2DNgchwGfchwQOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Layout:

  • Input: NGCHW.

  • Kernel: GFCHW.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. This includes the zero point offsets common to quantized operations.

OPERATION_NAME = 'linalg.conv_2d_ngchw_gfchw_q'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.Conv2DNgchwGfchwQOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.Conv2DNgchwGfchwQOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.conv_2d_ngchw_gfchw_q'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.conv_2d_ngchw_gfchw_q(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | Conv2DNgchwGfchwQOp
class mlir.dialects.linalg.Conv2DNhwcFhwcOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Layout:

  • Input: NHWC.

  • Kernel: FHWC.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.conv_2d_nhwc_fhwc'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.Conv2DNhwcFhwcOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.Conv2DNhwcFhwcOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.conv_2d_nhwc_fhwc'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.conv_2d_nhwc_fhwc(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | Conv2DNhwcFhwcOp
class mlir.dialects.linalg.Conv2DNhwcFhwcQOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Layout:

  • Input: NHWC.

  • Kernel: FHWC.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. This includes the zero point offsets common to quantized operations.

OPERATION_NAME = 'linalg.conv_2d_nhwc_fhwc_q'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.Conv2DNhwcFhwcQOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.Conv2DNhwcFhwcQOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.conv_2d_nhwc_fhwc_q'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.conv_2d_nhwc_fhwc_q(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | Conv2DNhwcFhwcQOp
class mlir.dialects.linalg.Conv2DNhwcHwcfOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Layout:

  • Input: NHWC.

  • Kernel: HWCF.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.conv_2d_nhwc_hwcf'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.Conv2DNhwcHwcfOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.Conv2DNhwcHwcfOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.conv_2d_nhwc_hwcf'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.conv_2d_nhwc_hwcf(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | Conv2DNhwcHwcfOp
class mlir.dialects.linalg.Conv2DNhwcHwcfQOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Layout:

  • Input: NHWC.

  • Kernel: HWCF.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. This includes the zero point offsets common to quantized operations.

OPERATION_NAME = 'linalg.conv_2d_nhwc_hwcf_q'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.Conv2DNhwcHwcfQOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.Conv2DNhwcHwcfQOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.conv_2d_nhwc_hwcf_q'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.conv_2d_nhwc_hwcf_q(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | Conv2DNhwcHwcfQOp
class mlir.dialects.linalg.Conv2DNhwgcGfhwcOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Layout:

  • Input: NHWGC.

  • Kernel: GFHWC.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.conv_2d_nhwgc_gfhwc'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.Conv2DNhwgcGfhwcOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.Conv2DNhwgcGfhwcOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.conv_2d_nhwgc_gfhwc'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.conv_2d_nhwgc_gfhwc(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | Conv2DNhwgcGfhwcOp
class mlir.dialects.linalg.Conv2DNhwgcGfhwcQOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Layout:

  • Input: NHWGC.

  • Kernel: GFHWC.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. This includes the zero point offsets common to quantized operations.

OPERATION_NAME = 'linalg.conv_2d_nhwgc_gfhwc_q'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.Conv2DNhwgcGfhwcQOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.Conv2DNhwgcGfhwcQOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.conv_2d_nhwgc_gfhwc_q'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.conv_2d_nhwgc_gfhwc_q(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | Conv2DNhwgcGfhwcQOp
class mlir.dialects.linalg.Conv2DOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.conv_2d'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.Conv2DOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.Conv2DOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.conv_2d'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.conv_2d(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | Conv2DOp
class mlir.dialects.linalg.Conv3DNcdhwFcdhwOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.conv_3d_ncdhw_fcdhw'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.Conv3DNcdhwFcdhwOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.Conv3DNcdhwFcdhwOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.conv_3d_ncdhw_fcdhw'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.conv_3d_ncdhw_fcdhw(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | Conv3DNcdhwFcdhwOp
class mlir.dialects.linalg.Conv3DNdhwcDhwcfOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.conv_3d_ndhwc_dhwcf'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.Conv3DNdhwcDhwcfOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.Conv3DNdhwcDhwcfOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.conv_3d_ndhwc_dhwcf'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.conv_3d_ndhwc_dhwcf(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | Conv3DNdhwcDhwcfOp
class mlir.dialects.linalg.Conv3DNdhwcDhwcfQOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. This includes the zero point offsets common to quantized operations.

OPERATION_NAME = 'linalg.conv_3d_ndhwc_dhwcf_q'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.Conv3DNdhwcDhwcfQOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.Conv3DNdhwcDhwcfQOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.conv_3d_ndhwc_dhwcf_q'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.conv_3d_ndhwc_dhwcf_q(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | Conv3DNdhwcDhwcfQOp
class mlir.dialects.linalg.Conv3DOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.conv_3d'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.Conv3DOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.Conv3DOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.conv_3d'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.conv_3d(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | Conv3DOp
class mlir.dialects.linalg.CopyOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, cast: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.copy'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
cast() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.CopyOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.CopyOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.copy'
inputs() _ods_ir
outputs() _ods_ir
cast() _ods_ir | None
mlir.dialects.linalg.copy(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, cast: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | CopyOp
class mlir.dialects.linalg.DepthwiseConv1DNcwCwOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. Multiplier is set to 1 which is a special case for most depthwise convolutions.

OPERATION_NAME = 'linalg.depthwise_conv_1d_ncw_cw'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.DepthwiseConv1DNcwCwOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.DepthwiseConv1DNcwCwOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.depthwise_conv_1d_ncw_cw'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.depthwise_conv_1d_ncw_cw(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | DepthwiseConv1DNcwCwOp
class mlir.dialects.linalg.DepthwiseConv1DNwcWcOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. Multiplier is set to 1 which is a special case for most depthwise convolutions.

OPERATION_NAME = 'linalg.depthwise_conv_1d_nwc_wc'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.DepthwiseConv1DNwcWcOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.DepthwiseConv1DNwcWcOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.depthwise_conv_1d_nwc_wc'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.depthwise_conv_1d_nwc_wc(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | DepthwiseConv1DNwcWcOp
class mlir.dialects.linalg.DepthwiseConv1DNwcWcmOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.depthwise_conv_1d_nwc_wcm'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.DepthwiseConv1DNwcWcmOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.DepthwiseConv1DNwcWcmOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.depthwise_conv_1d_nwc_wcm'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.depthwise_conv_1d_nwc_wcm(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | DepthwiseConv1DNwcWcmOp
class mlir.dialects.linalg.DepthwiseConv2DNchwChwOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. Multiplier is set to 1 which is a special case for most depthwise convolutions.

OPERATION_NAME = 'linalg.depthwise_conv_2d_nchw_chw'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.DepthwiseConv2DNchwChwOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.DepthwiseConv2DNchwChwOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.depthwise_conv_2d_nchw_chw'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.depthwise_conv_2d_nchw_chw(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | DepthwiseConv2DNchwChwOp
class mlir.dialects.linalg.DepthwiseConv2DNhwcHwcOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. Multiplier is set to 1 which is a special case for most depthwise convolutions.

OPERATION_NAME = 'linalg.depthwise_conv_2d_nhwc_hwc'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.DepthwiseConv2DNhwcHwcOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.DepthwiseConv2DNhwcHwcOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.depthwise_conv_2d_nhwc_hwc'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.depthwise_conv_2d_nhwc_hwc(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | DepthwiseConv2DNhwcHwcOp
class mlir.dialects.linalg.DepthwiseConv2DNhwcHwcQOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.depthwise_conv_2d_nhwc_hwc_q'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.DepthwiseConv2DNhwcHwcQOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.DepthwiseConv2DNhwcHwcQOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.depthwise_conv_2d_nhwc_hwc_q'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.depthwise_conv_2d_nhwc_hwc_q(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | DepthwiseConv2DNhwcHwcQOp
class mlir.dialects.linalg.DepthwiseConv2DNhwcHwcmOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.depthwise_conv_2d_nhwc_hwcm'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.DepthwiseConv2DNhwcHwcmOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.DepthwiseConv2DNhwcHwcmOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.depthwise_conv_2d_nhwc_hwcm'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.depthwise_conv_2d_nhwc_hwcm(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | DepthwiseConv2DNhwcHwcmOp
class mlir.dialects.linalg.DepthwiseConv2DNhwcHwcmQOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.depthwise_conv_2d_nhwc_hwcm_q'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.DepthwiseConv2DNhwcHwcmQOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.DepthwiseConv2DNhwcHwcmQOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.depthwise_conv_2d_nhwc_hwcm_q'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.depthwise_conv_2d_nhwc_hwcm_q(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | DepthwiseConv2DNhwcHwcmQOp
class mlir.dialects.linalg.DepthwiseConv3DNcdhwCdhwOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. Multiplier is set to 1 which is a special case for most depthwise convolutions.

OPERATION_NAME = 'linalg.depthwise_conv_3d_ncdhw_cdhw'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.DepthwiseConv3DNcdhwCdhwOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.DepthwiseConv3DNcdhwCdhwOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.depthwise_conv_3d_ncdhw_cdhw'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.depthwise_conv_3d_ncdhw_cdhw(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | DepthwiseConv3DNcdhwCdhwOp
class mlir.dialects.linalg.DepthwiseConv3DNdhwcDhwcOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. Multiplier is set to 1 which is a special case for most depthwise convolutions.

OPERATION_NAME = 'linalg.depthwise_conv_3d_ndhwc_dhwc'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.DepthwiseConv3DNdhwcDhwcOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.DepthwiseConv3DNdhwcDhwcOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.depthwise_conv_3d_ndhwc_dhwc'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.depthwise_conv_3d_ndhwc_dhwc(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | DepthwiseConv3DNdhwcDhwcOp
class mlir.dialects.linalg.DepthwiseConv3DNdhwcDhwcmOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.depthwise_conv_3d_ndhwc_dhwcm'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.DepthwiseConv3DNdhwcDhwcmOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.DepthwiseConv3DNdhwcDhwcmOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.depthwise_conv_3d_ndhwc_dhwcm'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.depthwise_conv_3d_ndhwc_dhwcm(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | DepthwiseConv3DNdhwcDhwcmOp
class mlir.dialects.linalg.DivOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

The shapes and element types must be identical. The appropriate casts, broadcasts and reductions should be done previously to calling this op.

This means reduction/broadcast/element cast semantics is explicit. Further passes can take that into account when lowering this code. For example, a linalg.broadcast + linalg.div sequence can be lowered to a linalg.generic with different affine maps for the two operands.

OPERATION_NAME = 'linalg.div'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.DivOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.DivOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.div'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.div(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | DivOp
class mlir.dialects.linalg.DivUnsignedOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

The shapes and element types must be identical. The appropriate casts, broadcasts and reductions should be done previously to calling this op.

This means reduction/broadcast/element cast semantics is explicit. Further passes can take that into account when lowering this code. For example, a linalg.broadcast + linalg.div sequence can be lowered to a linalg.generic with different affine maps for the two operands.

OPERATION_NAME = 'linalg.div_unsigned'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.DivUnsignedOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.DivUnsignedOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.div_unsigned'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.div_unsigned(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | DivUnsignedOp
class mlir.dialects.linalg.DotOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.dot'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.DotOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.DotOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.dot'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.dot(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | DotOp
class mlir.dialects.linalg.ElementwiseOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], kind: Any | _ods_ir, *, indexing_maps: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

The attribute kind describes arithmetic operation to perform. The operation kind can be unary (e.g. max), binary (e.g. add) or ternary (e.g. select).

By default, all indexing maps are identities. In the case of default indexing map, all input and output shapes must match. The number of dims in each of the identity maps is equal to the rank of the output type.

Affine-maps for operands and result are required to be provided by the user when a transpose and/or broadcast is needed on any operand. When a map is not provided, default identity maps are inferred for each operand.

Iterator-types are always all parallel. Iterator-types are needed for constructing the underlying structured op.

The number of dims of the iterator-types are inferred from the rank of the result type.

Example:

Defining a unary linalg.elementwise with default indexing-map:

%exp = linalg.elementwise
    kind=#linalg.elementwise_kind<exp>
    ins(%x : tensor<4x16x8xf32>)
    outs(%y: tensor<4x16x8xf32>) -> tensor<4x16x8xf32>

Defining a binary linalg.elementwise with user-defined indexing-map:

%add = linalg.elementwise
    kind=#linalg.elementwise_kind<add>
    indexing_maps = [#transpose, #broadcast, #identity]
    ins(%exp, %arg1 : tensor<4x16x8xf32>, tensor<4x16xf32>)
    outs(%arg2: tensor<4x8x16xf32>) -> tensor<4x8x16xf32>
OPERATION_NAME = 'linalg.elementwise'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
kind() _ods_ir
indexing_maps() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.ElementwiseOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.ElementwiseOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.elementwise'
inputs() _ods_ir
outputs() _ods_ir
kind() _ods_ir
indexing_maps() _ods_ir | None
mlir.dialects.linalg.elementwise(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], kind: Any | _ods_ir, *, indexing_maps: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | ElementwiseOp
class mlir.dialects.linalg.ErfOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

No numeric casting is performed on the input operand.

OPERATION_NAME = 'linalg.erf'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.ErfOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.ErfOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.erf'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.erf(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | ErfOp
class mlir.dialects.linalg.ExpOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

No numeric casting is performed on the input operand.

OPERATION_NAME = 'linalg.exp'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.ExpOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.ExpOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.exp'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.exp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | ExpOp
class mlir.dialects.linalg.FillOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Works for arbitrary ranked output tensors since the operation performs scalar accesses only and is thus rank polymorphic. The value operand type must match the element type of the output.

OPERATION_NAME = 'linalg.fill'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.FillOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.FillOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.fill'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.fill(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | FillOp
class mlir.dialects.linalg.FillRng2DOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

The operation generations pseudo random numbers using a linear congruential generator. It provides no guarantees regarding the distribution of the generated random numbers. Instead of generating the random numbers sequentially, it instantiates one random number generator per data element and runs them in parallel. The seed operand and the indices of the data element seed the random number generation. The min and max operands limit the range of the generated random numbers.

OPERATION_NAME = 'linalg.fill_rng_2d'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.FillRng2DOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.FillRng2DOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.fill_rng_2d'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.fill_rng_2d(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | FillRng2DOp
class mlir.dialects.linalg.FloorOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

No numeric casting is performed on the input operand.

OPERATION_NAME = 'linalg.floor'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.FloorOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.FloorOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.floor'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.floor(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | FloorOp
class mlir.dialects.linalg.GenericOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], indexing_maps: Any | _ods_ir, iterator_types: Any | _ods_ir, *, doc: str | _ods_ir | None = None, library_call: str | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Generic Linalg op form where the key properties of the computation are specified as attributes. In pretty form, a linalg.generic op is written as:

linalg.generic #trait_attribute
    ins(%A, %B : memref<?x?xf32>, memref<?x?xf32>)
    outs(%C : memref<?x?xf32>)
    attrs = {other-optional-attributes}
    {region}

Where #trait_attribute is an alias of a dictionary attribute containing:

  • doc [optional]: a documentation string

  • indexing_maps: a list of AffineMapAttr, one AffineMapAttr per each input

and output view. Such AffineMapAttr specifies the mapping between the loops and the indexing within each view. * library_call [optional]: a StringAttr containing the name of an external library function that the linalg.generic operation maps to. The external library is assumed to be dynamically linked and no strong compile-time guarantees are provided. In the absence of such a library call, linalg.generic will always lower to loops. * iterator_types: an ArrayAttr specifying the type of the enclosing loops. Each element of the list represents an iterator of one of the following types: parallel, reduction

Example: Defining a #matmul_trait attribute in MLIR can be done as follows:

#matmul_accesses = [
  affine_map<(m, n, k) -> (m, k)>,
  affine_map<(m, n, k) -> (k, n)>,
  affine_map<(m, n, k) -> (m, n)>
]
#matmul_trait = {
  doc = "C(m, n) += A(m, k) * B(k, n)",
  indexing_maps = #matmul_accesses,
  library_call = "linalg_matmul",
  iterator_types = ["parallel", "parallel", "reduction"]
}

And can be reused in multiple places as:

linalg.generic #matmul_trait
  ins(%A, %B : memref<?x?xf32>, memref<?x?xf32>)
  outs(%C : memref<?x?xf32>)
  attrs = {other-optional-attributes} {
  ^bb0(%a: f32, %b: f32, %c: f32) :
    %d = arith.mulf %a, %b: f32
    %e = arith.addf %c, %d: f32
    linalg.yield %e : f32
}

This may lower to either:

call @linalg_matmul(%A, %B, %C) :
  (memref<?x?xf32, strided<[?, ?], offset: ?>>,
   memref<?x?xf32, strided<[?, ?], offset: ?>>,
   memref<?x?xf32, strided<[?, ?], offset: ?>>)
  -> ()

or IR resembling:

scf.for %m = %c0 to %M step %c1 {
  scf.for %n = %c0 to %N step %c1 {
    scf.for %k = %c0 to %K step %c1 {
      %a = memref.load %A[%m, %k] : memref<?x?xf32>
      %b = memref.load %B[%k, %n] : memref<?x?xf32>
      %c = memref.load %C[%m, %n] : memref<?x?xf32>
      %d = arith.mulf %a, %b: f32
      %e = arith.addf %c, %d: f32
      memref.store %e, %C[%m, %n] : memref<?x?xf32>
    }
  }
}
OPERATION_NAME = 'linalg.generic'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
indexing_maps() _ods_ir
iterator_types() _ods_ir
doc() _ods_ir | None
library_call() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.GenericOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.GenericOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.generic'
inputs() _ods_ir
outputs() _ods_ir
indexing_maps() _ods_ir
iterator_types() _ods_ir
doc() _ods_ir | None
library_call() _ods_ir | None
mlir.dialects.linalg.generic(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], indexing_maps: Any | _ods_ir, iterator_types: Any | _ods_ir, *, doc: str | _ods_ir | None = None, library_call: str | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | GenericOp
class mlir.dialects.linalg.IndexOp(dim: int | _ods_ir, *, results: Sequence[_ods_ir] | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

The linalg.index operation returns the iteration index of the immediately enclosing linalg structured operation for the iteration dimension dim. The dim attribute specifies the position of the accessed dimension in the indexing map domain.

Example:

#map = affine_map<(i, j) -> (i, j)>
linalg.generic {indexing_maps = [#map, #map],
                iterator_types = ["parallel", "parallel"]}
  outs(%I, %J : memref<?x?xindex>, memref<?x?xindex>) {
  ^bb0(%arg0 : index, %arg1 : index):
  // Access the outer iteration dimension i
  %i = linalg.index 0 : index
  // Access the inner iteration dimension j
  %j = linalg.index 1 : index
  linalg.yield %i, %j : index, index
}

This may lower to IR resembling:

%0 = dim %I, %c0 : memref<?x?xindex>
%1 = dim %I, %c1 : memref<?x?xindex>
scf.for %i = %c0 to %0 step %c1 {
  scf.for %j = %c0 to %1 step %c1 {
    store %i, %I[%i, %j] : memref<?x?xindex>
    store %j, %J[%i, %j] : memref<?x?xindex>
  }
}
OPERATION_NAME = 'linalg.index'
_ODS_REGIONS = (0, True)
dim() _ods_ir
result() _ods_ir[_ods_ir]

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

class mlir.dialects.linalg.IndexOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.IndexOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.index'
dim() _ods_ir
mlir.dialects.linalg.index(dim: int | _ods_ir, *, results: Sequence[_ods_ir] | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir[_ods_ir]
class mlir.dialects.linalg.PackOp(result: _ods_ir | None, source: _ods_ir, dest: _ods_ir, inner_dims_pos: Sequence[int] | _ods_ir, inner_tiles: Sequence[_ods_ir[_ods_ir]], static_inner_tiles: Sequence[int] | _ods_ir, *, padding_value: _ods_ir | None = None, outer_dims_perm: Sequence[int] | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

The “pack” operation converts a source tensor of rank n into a result tensor of rank n + k with a tiled and packed layout (maybe with padding) and optionally transposes the tiled source tensor dimensions.

inner_tiles (mandatory) specifies k tile sizes. These tile sizes correspond to the least significant (“inner”) result tensor dimension sizes, in the same order. Tile sizes can be static or dynamic.

inner_dims_pos (mandatory) specifies k source tensor dimensions that are being tiled, where 0 <= k <= n.

  • inner_dims_pos[i] specifies the source tensor dimension tiled by

inner_tiles[i] where 0 <= i < k. All the values in inner_dims_pos are within [0, n). * The tiled dimensions (of size inner_tiles) are added to the end of the result tensor in the order in which they appear, i.e. shape(result)[rank(source) + i] = inner_tiles[i] for 0 <= i < k. * The following relationship for the tiled dimensions holds: shape(result)[inner_dims_pos[i]] = shape(source)[inner_dims_pos[i]] / inner_tiles[i], where (⌈/⌉ indicates CeilDiv).

Example: If inner_tiles = [16, 32], the result tensor has a shape of ...x16x32. If inner_dims_pos = [0, 1], the 0th source dimension is tiled by 16 and the 1st source dimension is tiled by 32. Other source dimensions (if any) are not tiled. If inner_dims_pos = [1, 0], the 1st dimension is tiled by 16 and the 0th dimension is tiled by 32.

Example:

// NC to NCnc
%0 = linalg.pack %source inner_dims_pos = [0, 1] inner_tiles = [8, 32]
    into %dest : tensor<128x256xf32> -> tensor<16x8 x 8x32 xf32>
//                                             \  /   \  /
//                                 Outer Dims: 16x8   Inner Dims: 8x32

// CHW to CHWhw
%0 = linalg.pack %source inner_dims_pos = [2, 1] inner_tiles = [4, 2]
    into %dest : tensor<3x20x24xf32> -> tensor<3x10x6 x 4x2 xf32>
//                                              \  /    \ /
//                                 Outer Dims: 3x10x6  Inner Dims: 4x2

// HCW to HCWhw
%0 = linalg.pack %source inner_dims_pos = [2, 0] inner_tiles = [4, 2]
    into %dest : tensor<18x3x32xf32> -> tensor<9x3x8 x 4x2 xf32>
//                                              \  /   \ /
//                                 Outer Dims: 9x3x8  Inner Dims: 4x2

outer_dims_perm (optional) specifies a permutation for the outer dimensions. If specified, it must have n elements.

Example:

// CK to KCck
%0 = linalg.pack %source outer_dims_perm = [1, 0] inner_dims_pos = [0, 1]
    inner_tiles = [8, 32] into %dest
    : tensor<128x256xf32> -> tensor<8x16 x 8x32 xf32>
//                                  \  /
//            compare with "NC to NCnc": outer dims are transposed

padding_value specifies a padding value at the boundary on non-perfectly divisible dimensions. Padding is optional:

  • If absent, it is assumed that for all inner tiles,

shape(source)[inner_dims_pos[i]] % inner_tiles[i] == 0, i.e. all inner tiles divide perfectly the corresponding outer dimension in the result tensor. It is UB if the tile does not perfectly divide the dimension. * If present, it will pad along high dimensions (high-padding) to make the tile complete. Note that it is not allowed to have artificial padding that is not strictly required by linalg.pack (i.e., padding past what is needed to complete the last tile along each packed dimension). It is UB if extra padding is requested. It is not possible to verify the requirements statically with dynamic shapes, so they are treated as UB.

Example:

%0 = linalg.pack %arg0 padding_value(%pad : f32) outer_dims_perm = [2, 1, 0]
    inner_dims_pos = [1] inner_tiles = [2] into %arg1
    : tensor<200x127x256xf32> -> tensor<256x64x200x2xf32>
//                 \
//                padded and tiled dim
//
// Source dimension 1 is tiled. 64 does not divide 127 evenly, so 1 padded
// element is added at the end.
//
// Note: Only tiled dimensions can be padded.

Invalid example that has artificial padding:

%0 = linalg.pack %src padding_value(%cst : f32) inner_dims_pos = [0]
    inner_tiles = [8] into %dest
    : tensor<9xf32> -> tensor<3x8xf32>
//                             \
//            expect tensor<2x8xf32> because CeilDiv(9, 8) = 2
OPERATION_NAME = 'linalg.pack'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (0, True)
source() _ods_ir
dest() _ods_ir
padding_value() _ods_ir | None
inner_tiles() _ods_ir[_ods_ir]
outer_dims_perm() _ods_ir | None
inner_dims_pos() _ods_ir
static_inner_tiles() _ods_ir
result() _ods_ir[_ods_ir] | None

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

class mlir.dialects.linalg.PackOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.PackOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.pack'
source() _ods_ir
dest() _ods_ir
padding_value() _ods_ir | None
inner_tiles() _ods_ir[_ods_ir]
outer_dims_perm() _ods_ir | None
inner_dims_pos() _ods_ir
static_inner_tiles() _ods_ir
mlir.dialects.linalg.pack(result: _ods_ir | None, source: _ods_ir, dest: _ods_ir, inner_dims_pos: Sequence[int] | _ods_ir, inner_tiles: Sequence[_ods_ir[_ods_ir]], static_inner_tiles: Sequence[int] | _ods_ir, *, padding_value: _ods_ir | None = None, outer_dims_perm: Sequence[int] | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | PackOp
class mlir.dialects.linalg.SoftmaxOp(result: Sequence[_ods_ir], input: _ods_ir, output: _ods_ir, dimension: int | _ods_ir, *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

linalg.softmax computes a numerically stable version of softmax.

For a given input tensor and a specified dimension d, compute:

  1. the max m along that dimension d

  2. f(x) = exp(x - m)

  3. sum f(x) along dimension d to get l(x).

  4. compute the final result f(x) / l(x).

This is an aggregate linalg operation that further reduces to a small DAG of structured operations.

Warning: Regarding the tiling capabilities, the implementation doesn’t check that the provided dimensions make sense. This is the responsability of the transformation calling the tiling to ensure that the provided sizes for each dimension make sense with respect to the semantic of softmax.

OPERATION_NAME = 'linalg.softmax'
_ODS_REGIONS = (0, True)
input() _ods_ir
output() _ods_ir
dimension() _ods_ir
result() _ods_ir[_ods_ir]

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

class mlir.dialects.linalg.SoftmaxOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.SoftmaxOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.softmax'
input() _ods_ir
output() _ods_ir
dimension() _ods_ir
mlir.dialects.linalg.softmax(result: Sequence[_ods_ir], input: _ods_ir, output: _ods_ir, dimension: int | _ods_ir, *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | SoftmaxOp
class mlir.dialects.linalg.UnPackOp(result: _ods_ir | None, source: _ods_ir, dest: _ods_ir, inner_dims_pos: Sequence[int] | _ods_ir, inner_tiles: Sequence[_ods_ir[_ods_ir]], static_inner_tiles: Sequence[int] | _ods_ir, *, outer_dims_perm: Sequence[int] | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

The “unpack” operation converts a source tensor of rank n with a tiled and packed layout to a result tensor of rank n - k.

inner_tiles (mandatory) specifies k tile sizes. These tile sizes correspond to the least significant (“inner”) source tensor dimension sizes. The behavior of this op is undefined if:

  • inner_tiles do not exactly match with the corresponding source tensor

dimension sizes. * Or, inner_tiles[i] does not divide the size of dimension inner_dims_pos[i] (assuming that outer_dims_perm is not specified) evenly.

inner_dims_pos (mandatory) specifies k result tensor (i.e. unpacked tensor) dimensions that were tiled with the inner_tiles to create the packed source tensor. The source tensor (i.e. packed tensor) dimensions can be unpacked given inner_dims_pos as follows.

  • For 0 <= i < k the following relationship holds:

shape(result)[inner_dims_pos[i]] <= shape(source)[n-k+i] * shape(source)[inner_dims_pos[i]]. * For 0 <= j < n-k and j not in inner_dims_pos the following relationship holds: shape(result)[j] = shape(source)[j].

outer_dims_perm (optional) specifies a permutation for the outer dimensions. If specified, it must have n - k elements. If specified, this permutation is applied before combining any dimensions.

Note, the unpack operation may drop any padding introduced by the pack operation and hence the following holds NumElementsOf(source) >= NumElementsOf(result).

Examples:

// NCnc to NC:
%0 = linalg.unpack %source inner_dims_pos = [0, 1] inner_tiles = [8, 32]
    into %dest : tensor<16x8 x 8x32 xf32> -> tensor<128x256xf32>
//                      \  /   \  /
//          Outer Dims: 16x8  Inner Dims: 8x32

// CK to KCck:
%0 = linalg.unpack %source outer_dims_perm = [1, 0] inner_dims_pos = [0, 1]
    inner_tiles = [8, 32]
    into %dest : tensor<8x16 x 8x32 xf32> -> tensor<128x256xf32>
//                      \  /   \  /
//          Outer Dims: 8x16  Inner Dims: 8x32

// CHW to CHWhw:
%0 = linalg.unpack %source inner_dims_pos = [2, 1] inner_tiles = [4, 2]
    into %dest : tensor<3x10x6 x 4x2 xf32> -> tensor<3x20x24xf32>
//                       \  /    \ /
//          Outer Dims: 3x10x6  Inner Dims: 4x2

// HCW to HCWhw
%0 = linalg.unpack %source inner_dims_pos = [2, 0] inner_tiles = [4, 2]
    into %dest : tensor<9x3x8 x 4x2 xf32> -> tensor<18x3x32xf32>
//                       \  /   \ /
//          Outer Dims: 9x3x8   Inner Dims: 4x2
OPERATION_NAME = 'linalg.unpack'
_ODS_REGIONS = (0, True)
source() _ods_ir
dest() _ods_ir
inner_tiles() _ods_ir[_ods_ir]
outer_dims_perm() _ods_ir | None
inner_dims_pos() _ods_ir
static_inner_tiles() _ods_ir
result() _ods_ir[_ods_ir] | None

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

class mlir.dialects.linalg.UnPackOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.UnPackOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.unpack'
source() _ods_ir
dest() _ods_ir
inner_tiles() _ods_ir[_ods_ir]
outer_dims_perm() _ods_ir | None
inner_dims_pos() _ods_ir
static_inner_tiles() _ods_ir
mlir.dialects.linalg.unpack(result: _ods_ir | None, source: _ods_ir, dest: _ods_ir, inner_dims_pos: Sequence[int] | _ods_ir, inner_tiles: Sequence[_ods_ir[_ods_ir]], static_inner_tiles: Sequence[int] | _ods_ir, *, outer_dims_perm: Sequence[int] | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | UnPackOp
class mlir.dialects.linalg.WinogradFilterTransformOp(result: _ods_ir, filter: _ods_ir[_ods_ir], output: _ods_ir[_ods_ir], fmr: Any | _ods_ir, *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Winograd Conv2D algorithm will convert linalg Conv2D operator into batched matrix multiply. Before the matrix multiply, it will convert filter and input into a format suitable for batched matrix multiply. After the matrix multiply, it will convert output to the final result tensor.

The algorithm F(m x m, r x r) is

Y = A^T x [(G x g x G^T) @ (B^T x d x B)] x A

The size of output Y is m x m. The size of filter g is r x r. The size of input d is (m + r - 1) x (m + r - 1). A^T, A, G^T, G, B^T, and B are transformation matrices.

This operator is defined to represent the high level concept of filter transformation (G x g x G^T) in the Winograd Conv2D algorithm.

OPERATION_NAME = 'linalg.winograd_filter_transform'
_ODS_REGIONS = (0, True)
filter() _ods_ir[_ods_ir]
output() _ods_ir[_ods_ir]
fmr() _ods_ir
result() _ods_ir[_ods_ir]

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

class mlir.dialects.linalg.WinogradFilterTransformOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.WinogradFilterTransformOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.winograd_filter_transform'
filter() _ods_ir[_ods_ir]
output() _ods_ir[_ods_ir]
fmr() _ods_ir
mlir.dialects.linalg.winograd_filter_transform(result: _ods_ir, filter: _ods_ir[_ods_ir], output: _ods_ir[_ods_ir], fmr: Any | _ods_ir, *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir[_ods_ir]
class mlir.dialects.linalg.WinogradInputTransformOp(result: _ods_ir, input: _ods_ir[_ods_ir], output: _ods_ir[_ods_ir], fmr: Any | _ods_ir, *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Winograd Conv2D algorithm will convert linalg Conv2D operator into batched matrix multiply. Before the matrix multiply, it will convert filter and input into a format suitable for batched matrix multiply. After the matrix multiply, it will convert output to the final result tensor.

The algorithm F(m x m, r x r) is

Y = A^T x [(G x g x G^T) @ (B^T x d x B)] x A

The size of output Y is m x m. The size of filter g is r x r. The size of input d is (m + r - 1) x (m + r - 1). A^T, A, G^T, G, B^T, and B are transformation matrices.

This operator is defined to represent the high level concept of input transformation (B^T x d x B) in the Winograd Conv2D algorithm.

OPERATION_NAME = 'linalg.winograd_input_transform'
_ODS_REGIONS = (0, True)
input() _ods_ir[_ods_ir]
output() _ods_ir[_ods_ir]
fmr() _ods_ir
result() _ods_ir[_ods_ir]

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

class mlir.dialects.linalg.WinogradInputTransformOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.WinogradInputTransformOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.winograd_input_transform'
input() _ods_ir[_ods_ir]
output() _ods_ir[_ods_ir]
fmr() _ods_ir
mlir.dialects.linalg.winograd_input_transform(result: _ods_ir, input: _ods_ir[_ods_ir], output: _ods_ir[_ods_ir], fmr: Any | _ods_ir, *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir[_ods_ir]
class mlir.dialects.linalg.WinogradOutputTransformOp(result: _ods_ir, value: _ods_ir[_ods_ir], output: _ods_ir[_ods_ir], fmr: Any | _ods_ir, *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Winograd Conv2D algorithm will convert linalg Conv2D operator into batched matrix multiply. Before the matrix multiply, it will convert filter and input into a format suitable for batched matrix multiply. After the matrix multiply, it will convert output to the final result tensor.

The algorithm F(m x m, r x r) is

Y = A^T x [(G x g x G^T) @ (B^T x d x B)] x A

The size of output Y is m x m. The size of filter g is r x r. The size of input d is (m + r - 1) x (m + r - 1). A^T, A, G^T, G, B^T, and B are transformation matrices.

This operator is defined to represent the high level concept of output transformation (A^T x y x A) in the Winograd Conv2D algorithm.

OPERATION_NAME = 'linalg.winograd_output_transform'
_ODS_REGIONS = (0, True)
value() _ods_ir[_ods_ir]
output() _ods_ir[_ods_ir]
fmr() _ods_ir
result() _ods_ir[_ods_ir]

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

class mlir.dialects.linalg.WinogradOutputTransformOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.WinogradOutputTransformOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.winograd_output_transform'
value() _ods_ir[_ods_ir]
output() _ods_ir[_ods_ir]
fmr() _ods_ir
mlir.dialects.linalg.winograd_output_transform(result: _ods_ir, value: _ods_ir[_ods_ir], output: _ods_ir[_ods_ir], fmr: Any | _ods_ir, *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir[_ods_ir]
class mlir.dialects.linalg.YieldOp(values: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

linalg.yield is a special terminator operation for blocks inside regions in linalg generic ops. It returns values to the immediately enclosing linalg generic op.

Example:

linalg.yield %f0, %f1 : f32, f32
OPERATION_NAME = 'linalg.yield'
_ODS_REGIONS = (0, True)
values() _ods_ir
class mlir.dialects.linalg.YieldOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.YieldOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.yield'
values() _ods_ir
mlir.dialects.linalg.yield_(values: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) YieldOp
class mlir.dialects.linalg.LogOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

No numeric casting is performed on the input operand.

OPERATION_NAME = 'linalg.log'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.LogOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.LogOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.log'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.log(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | LogOp
class mlir.dialects.linalg.MapOp(result: Sequence[_ods_ir], inputs: Sequence[_ods_ir], init: _ods_ir, *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Models elementwise operations on tensors in terms of arithmetic operations on the corresponding elements.

Example:

%add = linalg.map
    ins(%lhs, %rhs : tensor<64xf32>, tensor<64xf32>)
    outs(%init: tensor<64xf32>)
    (%lhs_elem: f32, %rhs_elem: f32) {
      %0 = arith.addf %lhs_elem, %rhs_elem: f32
      linalg.yield %0: f32
    }

Shortened print form is available for simple maps where the body contains exactly two operations (the payload operation and a yield), the payload operation has the same number of operands as block arguments with operands matching block arguments in order, and the yield operand is the result of the payload operation.

The example above will be printed using the shortened form as:

%add = linalg.map { arith.addf }
    ins(%lhs, %rhs : tensor<64xf32>, tensor<64xf32>)
    outs(%init: tensor<64xf32>)
OPERATION_NAME = 'linalg.map'
_ODS_REGIONS = (1, True)
inputs() _ods_ir
init() _ods_ir
result() _ods_ir

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

mapper() _ods_ir
class mlir.dialects.linalg.MapOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.MapOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.map'
inputs() _ods_ir
init() _ods_ir
mlir.dialects.linalg.map(result: Sequence[_ods_ir], inputs: Sequence[_ods_ir], init: _ods_ir, *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | MapOp
class mlir.dialects.linalg.MatmulOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, indexing_maps: Any | _ods_ir | None = None, cast: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

Broadcast and Transpose semantics can be appiled by specifying the explicit attribute ‘indexing_maps’ as shown below.This is a list attribute, so the list must include all the maps if specified.

Example Transpose:

linalg.matmul
    indexing_maps = [affine_map<(m, n, k) -> (k, m)>, // transpose
                     affine_map<(m, n, k) -> (k, n)>,
                     affine_map<(m, n, k) -> (m, n)>]
    ins(%arg0, %arg1 : memref<5x3xf32>,memref<5x7xf32>)
    outs(%arg2: memref<3x7xf32>)

Example Broadcast:

linalg.matmul
   indexing_maps = [affine_map<(m, n, k) -> (k)>,     // broadcast
                    affine_map<(m, n, k) -> (k, n)>,
                    affine_map<(m, n, k) -> (m, n)>]
   ins(%arg0, %arg1 : memref<3xf32>, memref<5x7xf32>)
   outs(%arg2: memref<3x7xf32>)

Example Broadcast and transpose:

linalg.matmul
    indexing_maps = [affine_map<(m, n, k) -> (k, m)>, // transpose
                     affine_map<(m, n, k) -> (k)>,    // broadcast
                     affine_map<(m, n, k) -> (m, n)>]
    ins(%arg0, %arg1 : memref<5x3xf32>, memref<7xf32>)
    outs(%arg2: memref<3x7xf32>)
OPERATION_NAME = 'linalg.matmul'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
indexing_maps() _ods_ir | None
cast() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.MatmulOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.MatmulOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.matmul'
inputs() _ods_ir
outputs() _ods_ir
indexing_maps() _ods_ir | None
cast() _ods_ir | None
mlir.dialects.linalg.matmul(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, indexing_maps: Any | _ods_ir | None = None, cast: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | MatmulOp
class mlir.dialects.linalg.MatvecOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.matvec'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.MatvecOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.MatvecOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.matvec'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.matvec(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | MatvecOp
class mlir.dialects.linalg.MaxOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

The shapes and element types must be identical. The appropriate casts, broadcasts and reductions should be done previously to calling this op.

This means reduction/broadcast/element cast semantics is explicit. Further passes can take that into account when lowering this code. For example, a linalg.broadcast + linalg.max sequence can be lowered to a linalg.generic with different affine maps for the two operands.

OPERATION_NAME = 'linalg.max'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.MaxOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.MaxOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.max'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.max(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | MaxOp
class mlir.dialects.linalg.MinOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

The shapes and element types must be identical. The appropriate casts, broadcasts and reductions should be done previously to calling this op.

This means reduction/broadcast/element cast semantics is explicit. Further passes can take that into account when lowering this code. For example, a linalg.broadcast + linalg.min sequence can be lowered to a linalg.generic with different affine maps for the two operands.

OPERATION_NAME = 'linalg.min'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.MinOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.MinOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.min'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.min(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | MinOp
class mlir.dialects.linalg.Mmt4DOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Differences from linalg.matmul:

  • The right hand side is transposed, whence the ‘t’ in ‘mmt’.

  • The input and output tensors have a 4D shape instead of a 2D shape. They

are interpreted as 2D matrices with one level of 2D tile subdivision, whence the 2+2=4 dimensions. The inner tile dimensions are identified with ‘0’ suffixes below, for instance the LHS matrix shape (M, K, M0, K0) reads as: MxK tiles, each of shape M0xK0.

OPERATION_NAME = 'linalg.mmt4d'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.Mmt4DOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.Mmt4DOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.mmt4d'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.mmt4d(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | Mmt4DOp
class mlir.dialects.linalg.MulOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

The shapes and element types must be identical. The appropriate casts, broadcasts and reductions should be done previously to calling this op.

This means reduction/broadcast/element cast semantics is explicit. Further passes can take that into account when lowering this code. For example, a linalg.broadcast + linalg.mul sequence can be lowered to a linalg.generic with different affine maps for the two operands.

OPERATION_NAME = 'linalg.mul'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.MulOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.MulOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.mul'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.mul(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | MulOp
class mlir.dialects.linalg.NegFOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

No numeric casting is performed on the input operand.

OPERATION_NAME = 'linalg.negf'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.NegFOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.NegFOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.negf'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.negf(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | NegFOp
class mlir.dialects.linalg.PoolingNchwMaxOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.pooling_nchw_max'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.PoolingNchwMaxOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.PoolingNchwMaxOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.pooling_nchw_max'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.pooling_nchw_max(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | PoolingNchwMaxOp
class mlir.dialects.linalg.PoolingNchwSumOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Layout:

  • Input: NCHW.

  • Kernel: HW.

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.pooling_nchw_sum'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.PoolingNchwSumOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.PoolingNchwSumOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.pooling_nchw_sum'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.pooling_nchw_sum(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | PoolingNchwSumOp
class mlir.dialects.linalg.PoolingNcwMaxOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.pooling_ncw_max'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.PoolingNcwMaxOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.PoolingNcwMaxOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.pooling_ncw_max'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.pooling_ncw_max(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | PoolingNcwMaxOp
class mlir.dialects.linalg.PoolingNcwSumOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Layout:

  • Input: NCW.

  • Kernel: W.

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.pooling_ncw_sum'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.PoolingNcwSumOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.PoolingNcwSumOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.pooling_ncw_sum'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.pooling_ncw_sum(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | PoolingNcwSumOp
class mlir.dialects.linalg.PoolingNdhwcMaxOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.pooling_ndhwc_max'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.PoolingNdhwcMaxOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.PoolingNdhwcMaxOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.pooling_ndhwc_max'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.pooling_ndhwc_max(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | PoolingNdhwcMaxOp
class mlir.dialects.linalg.PoolingNdhwcMinOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.pooling_ndhwc_min'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.PoolingNdhwcMinOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.PoolingNdhwcMinOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.pooling_ndhwc_min'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.pooling_ndhwc_min(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | PoolingNdhwcMinOp
class mlir.dialects.linalg.PoolingNdhwcSumOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.pooling_ndhwc_sum'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.PoolingNdhwcSumOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.PoolingNdhwcSumOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.pooling_ndhwc_sum'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.pooling_ndhwc_sum(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | PoolingNdhwcSumOp
class mlir.dialects.linalg.PoolingNhwcMaxOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.pooling_nhwc_max'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.PoolingNhwcMaxOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.PoolingNhwcMaxOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.pooling_nhwc_max'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.pooling_nhwc_max(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | PoolingNhwcMaxOp
class mlir.dialects.linalg.PoolingNhwcMaxUnsignedOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.pooling_nhwc_max_unsigned'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.PoolingNhwcMaxUnsignedOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.PoolingNhwcMaxUnsignedOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.pooling_nhwc_max_unsigned'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.pooling_nhwc_max_unsigned(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | PoolingNhwcMaxUnsignedOp
class mlir.dialects.linalg.PoolingNhwcMinOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.pooling_nhwc_min'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.PoolingNhwcMinOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.PoolingNhwcMinOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.pooling_nhwc_min'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.pooling_nhwc_min(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | PoolingNhwcMinOp
class mlir.dialects.linalg.PoolingNhwcMinUnsignedOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.pooling_nhwc_min_unsigned'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.PoolingNhwcMinUnsignedOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.PoolingNhwcMinUnsignedOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.pooling_nhwc_min_unsigned'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.pooling_nhwc_min_unsigned(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | PoolingNhwcMinUnsignedOp
class mlir.dialects.linalg.PoolingNhwcSumOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Layout:

  • Input: NHWC.

  • Kernel: HW.

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.pooling_nhwc_sum'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.PoolingNhwcSumOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.PoolingNhwcSumOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.pooling_nhwc_sum'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.pooling_nhwc_sum(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | PoolingNhwcSumOp
class mlir.dialects.linalg.PoolingNwcMaxOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.pooling_nwc_max'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.PoolingNwcMaxOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.PoolingNwcMaxOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.pooling_nwc_max'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.pooling_nwc_max(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | PoolingNwcMaxOp
class mlir.dialects.linalg.PoolingNwcMaxUnsignedOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.pooling_nwc_max_unsigned'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.PoolingNwcMaxUnsignedOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.PoolingNwcMaxUnsignedOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.pooling_nwc_max_unsigned'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.pooling_nwc_max_unsigned(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | PoolingNwcMaxUnsignedOp
class mlir.dialects.linalg.PoolingNwcMinOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.pooling_nwc_min'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.PoolingNwcMinOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.PoolingNwcMinOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.pooling_nwc_min'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.pooling_nwc_min(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | PoolingNwcMinOp
class mlir.dialects.linalg.PoolingNwcMinUnsignedOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.pooling_nwc_min_unsigned'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.PoolingNwcMinUnsignedOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.PoolingNwcMinUnsignedOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.pooling_nwc_min_unsigned'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.pooling_nwc_min_unsigned(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | PoolingNwcMinUnsignedOp
class mlir.dialects.linalg.PoolingNwcSumOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Layout:

  • Input: NWC.

  • Kernel: W.

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.pooling_nwc_sum'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.PoolingNwcSumOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.PoolingNwcSumOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.pooling_nwc_sum'
inputs() _ods_ir
outputs() _ods_ir
strides() _ods_ir | None
dilations() _ods_ir | None
mlir.dialects.linalg.pooling_nwc_sum(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, strides: Any | _ods_ir | None = None, dilations: Any | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | PoolingNwcSumOp
class mlir.dialects.linalg.PowFOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Only applies to floating point values.

The shapes and element types must be identical. The appropriate casts, broadcasts and reductions should be done previously to calling this op.

This means reduction/broadcast/element cast semantics is explicit. Further passes can take that into account when lowering this code. For example, a linalg.broadcast + linalg.powf sequence can be lowered to a linalg.generic with different affine maps for the two operands.

OPERATION_NAME = 'linalg.powf'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.PowFOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.PowFOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.powf'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.powf(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | PowFOp
class mlir.dialects.linalg.QuantizedBatchMatmulOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. The quantized variant includes zero-point adjustments for the left and right operands of the matmul.

OPERATION_NAME = 'linalg.quantized_batch_matmul'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.QuantizedBatchMatmulOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.QuantizedBatchMatmulOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.quantized_batch_matmul'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.quantized_batch_matmul(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | QuantizedBatchMatmulOp
class mlir.dialects.linalg.QuantizedMatmulOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. The quantized variant includes zero-point adjustments for the left and right operands of the matmul.

OPERATION_NAME = 'linalg.quantized_matmul'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.QuantizedMatmulOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.QuantizedMatmulOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.quantized_matmul'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.quantized_matmul(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | QuantizedMatmulOp
class mlir.dialects.linalg.ReciprocalOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

No numeric casting is performed on the input operand.

OPERATION_NAME = 'linalg.reciprocal'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.ReciprocalOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.ReciprocalOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.reciprocal'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.reciprocal(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | ReciprocalOp
class mlir.dialects.linalg.ReduceOp(result: Sequence[_ods_ir], inputs: Sequence[_ods_ir], inits: Sequence[_ods_ir], dimensions: Sequence[int] | _ods_ir, *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Executes combiner on the dimensions of inputs and returns the reduced result. The dimensions attribute needs to list the reduction dimensions in increasing order.

Example:

%reduce = linalg.reduce
    ins(%input:tensor<16x32x64xf32>)
    outs(%init:tensor<16x64xf32>)
    dimensions = [1]
    (%in: f32, %out: f32) {
      %0 = arith.addf %out, %in: f32
      linalg.yield %0: f32
    }

Shortened print form is available for simple reduces where the body contains exactly two operations (the payload operation and a yield), the payload operation has the same number of operands as block arguments, the first block argument (init) is the last operand of the payload operation with remaining operands matching remaining block arguments in order, and the yield operand is the result of the payload operation.

The example above will be printed using the shortened form as:

%reduce = linalg.reduce { arith.addf }
    ins(%input:tensor<16x32x64xf32>)
    outs(%init:tensor<16x64xf32>)
    dimensions = [1]
OPERATION_NAME = 'linalg.reduce'
_ODS_REGIONS = (1, True)
inputs() _ods_ir
inits() _ods_ir
dimensions() _ods_ir
combiner() _ods_ir
class mlir.dialects.linalg.ReduceOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.ReduceOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.reduce'
inputs() _ods_ir
inits() _ods_ir
dimensions() _ods_ir
mlir.dialects.linalg.reduce(result: Sequence[_ods_ir], inputs: Sequence[_ods_ir], inits: Sequence[_ods_ir], dimensions: Sequence[int] | _ods_ir, *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | ReduceOp
class mlir.dialects.linalg.RoundOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

No numeric casting is performed on the input operand.

OPERATION_NAME = 'linalg.round'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.RoundOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.RoundOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.round'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.round(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | RoundOp
class mlir.dialects.linalg.RsqrtOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

No numeric casting is performed on the input operand.

OPERATION_NAME = 'linalg.rsqrt'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.RsqrtOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.RsqrtOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.rsqrt'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.rsqrt(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | RsqrtOp
class mlir.dialects.linalg.SelectOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

The shapes and element types must be identical. The appropriate casts, broadcasts and reductions should be done previously to calling this op.

This means reduction/broadcast/element cast semantics is explicit. Further passes can take that into account when lowering this code. For example, a linalg.broadcast + linalg.select sequence can be lowered to a linalg.generic with different affine maps for the two operands.

OPERATION_NAME = 'linalg.select'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.SelectOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.SelectOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.select'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.select(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | SelectOp
class mlir.dialects.linalg.SqrtOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

No numeric casting is performed on the input operand.

OPERATION_NAME = 'linalg.sqrt'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.SqrtOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.SqrtOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.sqrt'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.sqrt(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | SqrtOp
class mlir.dialects.linalg.SquareOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

No numeric casting is performed on the input operand.

OPERATION_NAME = 'linalg.square'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.SquareOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.SquareOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.square'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.square(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | SquareOp
class mlir.dialects.linalg.SubOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

The shapes and element types must be identical. The appropriate casts, broadcasts and reductions should be done previously to calling this op.

This means reduction/broadcast/element cast semantics is explicit. Further passes can take that into account when lowering this code. For example, a linalg.broadcast + linalg.sub sequence can be lowered to a linalg.generic with different affine maps for the two operands.

OPERATION_NAME = 'linalg.sub'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.SubOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.SubOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.sub'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.sub(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | SubOp
class mlir.dialects.linalg.TanhOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

No numeric casting is performed on the input operand.

OPERATION_NAME = 'linalg.tanh'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.TanhOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.TanhOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.tanh'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.tanh(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | TanhOp
class mlir.dialects.linalg.TransposeOp(result: Sequence[_ods_ir], input: _ods_ir, init: _ods_ir, permutation: Sequence[int] | _ods_ir, *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Permutes the dimensions of input according to the given permutation. dim(result, i) = dim(input, permutation[i])

This op actually moves data, unlike memref.transpose which is a metadata operation only that produces a transposed “view”.

Example:

%transpose = linalg.transpose
    ins(%input:tensor<16x64xf32>)
    outs(%init:tensor<64x16xf32>)
    permutation = [1, 0]
OPERATION_NAME = 'linalg.transpose'
_ODS_REGIONS = (1, True)
input() _ods_ir
init() _ods_ir
permutation() _ods_ir
result() _ods_ir

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

region() _ods_ir
class mlir.dialects.linalg.TransposeOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.TransposeOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.transpose'
input() _ods_ir
init() _ods_ir
permutation() _ods_ir
mlir.dialects.linalg.transpose(result: Sequence[_ods_ir], input: _ods_ir, init: _ods_ir, permutation: Sequence[int] | _ods_ir, *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | TransposeOp
class mlir.dialects.linalg.VecmatOp(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

OPERATION_NAME = 'linalg.vecmat'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (1, True)
inputs() _ods_ir
outputs() _ods_ir
result_tensors() _ods_ir[_ods_ir]
region() _ods_ir
class mlir.dialects.linalg.VecmatOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.VecmatOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'linalg.vecmat'
inputs() _ods_ir
outputs() _ods_ir
mlir.dialects.linalg.vecmat(result_tensors: Sequence[_ods_ir], inputs: Sequence[_ods_ir], outputs: Sequence[_ods_ir], *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) _ods_ir | _ods_ir | VecmatOp
class mlir.dialects.linalg._Dialect(descriptor: object)

Bases: _ods_ir

DIALECT_NAMESPACE = 'linalg'
mlir.dialects.linalg.register_attribute_builder(kind, replace=False, allow_existing=False)
mlir.dialects.linalg._ods_ir
class mlir.dialects.linalg.BinaryFn

Bases: enum.IntEnum

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

add = 0
sub = 1
mul = 2
div = 3
div_unsigned = 4
max_signed = 5
min_signed = 6
max_unsigned = 7
min_unsigned = 8
powf = 9
__str__()

Return str(self).

mlir.dialects.linalg._binaryfn(x, context)
class mlir.dialects.linalg.ElementwiseArityGroup

Bases: enum.IntEnum

allowed 32-bit signless integer cases: 1, 2, 3

Unary = 1
Binary = 2
Ternary = 3
__str__()

Return str(self).

mlir.dialects.linalg._elementwisearitygroup(x, context)
class mlir.dialects.linalg.ElementwiseCaseLimits

Bases: enum.IntEnum

allowed 32-bit signless integer cases:

LastUnary = 25
LastBinary = 35
LastTernary = 36
__str__()

Return str(self).

mlir.dialects.linalg._elementwisecaselimits(x, context)
class mlir.dialects.linalg.ElementwiseKind

Bases: enum.IntEnum

allowed 32-bit signless integer cases: 0, 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

exp = 0
log = 1
abs = 2
ceil = 3
floor = 4
negf = 5
reciprocal = 6
round = 7
sqrt = 8
rsqrt = 9
square = 10
tanh = 11
erf = 12
sin = 13
cos = 14
tan = 15
acos = 16
acosh = 17
asin = 18
asinh = 19
atan = 20
atanh = 21
log10 = 22
log1p = 23
log2 = 24
add = 25
sub = 26
mul = 27
div = 28
div_unsigned = 29
max_signed = 30
min_signed = 31
max_unsigned = 32
min_unsigned = 33
powf = 34
select = 35
__str__()

Return str(self).

mlir.dialects.linalg._elementwisekind(x, context)
class mlir.dialects.linalg.IteratorType

Bases: enum.IntEnum

Iterator type

parallel = 0
reduction = 1
__str__()

Return str(self).

mlir.dialects.linalg._iteratortype(x, context)
class mlir.dialects.linalg.TernaryFn

Bases: enum.IntEnum

allowed 32-bit signless integer cases: 0

select = 0
__str__()

Return str(self).

mlir.dialects.linalg._ternaryfn(x, context)
class mlir.dialects.linalg.TypeFn

Bases: enum.IntEnum

allowed 32-bit signless integer cases: 0, 1

cast_signed = 0
cast_unsigned = 1
__str__()

Return str(self).

mlir.dialects.linalg._typefn(x, context)
class mlir.dialects.linalg.UnaryFn

Bases: enum.IntEnum

allowed 32-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24

exp = 0
log = 1
abs = 2
ceil = 3
floor = 4
negf = 5
reciprocal = 6
round = 7
sqrt = 8
rsqrt = 9
square = 10
tanh = 11
erf = 12
sin = 13
cos = 14
tan = 15
acos = 16
acosh = 17
asin = 18
asinh = 19
atan = 20
atanh = 21
log10 = 22
log1p = 23
log2 = 24
__str__()

Return str(self).

mlir.dialects.linalg._unaryfn(x, context)
class mlir.dialects.linalg.WinogradConv2DFmr

Bases: enum.IntEnum

allowed 32-bit signless integer cases: 0, 1, 2

F_2_3 = 0
F_4_3 = 1
F_2_5 = 2
__str__()

Return str(self).

mlir.dialects.linalg._winogradconv2dfmr(x, context)
mlir.dialects.linalg._binaryfnattr(x, context)
mlir.dialects.linalg._elementwisekindattr(x, context)
mlir.dialects.linalg._iteratortypeenum(x, context)
mlir.dialects.linalg._ternaryfnattr(x, context)
mlir.dialects.linalg._typefnattr(x, context)
mlir.dialects.linalg._unaryfnattr(x, context)
mlir.dialects.linalg._iteratortypeenum(x, context)
mlir.dialects.linalg.T1
mlir.dialects.linalg.T2
mlir.dialects.linalg.Batch
mlir.dialects.linalg.copy(I=TensorDef(T1), O=TensorDef(U, output=True), cast=TypeFnAttrDef(default=TypeFn.cast_signed))

Copies the tensor elementwise.

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

mlir.dialects.linalg.exp(I=TensorDef(T1), O=TensorDef(T1, output=True))

Applies exp(x) elementwise.

No numeric casting is performed on the input operand.

mlir.dialects.linalg.log(I=TensorDef(T1), O=TensorDef(T1, output=True))

Applies log(x) elementwise.

No numeric casting is performed on the input operand.

mlir.dialects.linalg.abs(I=TensorDef(T1), O=TensorDef(T1, output=True))

Applies abs(x) elementwise.

No numeric casting is performed on the input operand.

mlir.dialects.linalg.ceil(I=TensorDef(T1), O=TensorDef(T1, output=True))

Applies ceil(x) elementwise.

No numeric casting is performed on the input operand.

mlir.dialects.linalg.floor(I=TensorDef(T1), O=TensorDef(T1, output=True))

Applies floor(x) elementwise.

No numeric casting is performed on the input operand.

mlir.dialects.linalg.negf(I=TensorDef(T1), O=TensorDef(T1, output=True))

Applies negf(x) elementwise.

No numeric casting is performed on the input operand.

mlir.dialects.linalg.reciprocal(I=TensorDef(T1), O=TensorDef(T1, output=True))

Applies reciprocal(x) elementwise.

No numeric casting is performed on the input operand.

mlir.dialects.linalg.round(I=TensorDef(T1), O=TensorDef(T1, output=True))

Applies round(x) elementwise.

No numeric casting is performed on the input operand.

mlir.dialects.linalg.sqrt(I=TensorDef(T1), O=TensorDef(T1, output=True))

Applies sqrt(x) elementwise.

No numeric casting is performed on the input operand.

mlir.dialects.linalg.rsqrt(I=TensorDef(T1), O=TensorDef(T1, output=True))

Applies rsqrt(x) elementwise.

No numeric casting is performed on the input operand.

mlir.dialects.linalg.square(I=TensorDef(T1), O=TensorDef(T1, output=True))

Applies square(x) elementwise.

No numeric casting is performed on the input operand.

mlir.dialects.linalg.tanh(I=TensorDef(T1), O=TensorDef(T1, output=True))

Applies tanh(x) elementwise.

No numeric casting is performed on the input operand.

mlir.dialects.linalg.erf(I=TensorDef(T1), O=TensorDef(T1, output=True))

Applies erf(x) elementwise.

No numeric casting is performed on the input operand.

mlir.dialects.linalg.add(lhs=TensorDef(T1), rhs=TensorDef(T1), O=TensorDef(T1, output=True))

Adds two tensors elementwise.

The shapes and element types must be identical. The appropriate casts, broadcasts and reductions should be done previously to calling this op.

This means reduction/broadcast/element cast semantics is explicit. Further passes can take that into account when lowering this code. For example, a linalg.broadcast + linalg.add sequence can be lowered to a linalg.generic with different affine maps for the two operands.

mlir.dialects.linalg.sub(lhs=TensorDef(T1), rhs=TensorDef(T1), O=TensorDef(T1, output=True))

Subtracts two tensors elementwise.

The shapes and element types must be identical. The appropriate casts, broadcasts and reductions should be done previously to calling this op.

This means reduction/broadcast/element cast semantics is explicit. Further passes can take that into account when lowering this code. For example, a linalg.broadcast + linalg.sub sequence can be lowered to a linalg.generic with different affine maps for the two operands.

mlir.dialects.linalg.mul(lhs=TensorDef(T1), rhs=TensorDef(T1), O=TensorDef(T1, output=True))

Multiplies two tensors elementwise.

The shapes and element types must be identical. The appropriate casts, broadcasts and reductions should be done previously to calling this op.

This means reduction/broadcast/element cast semantics is explicit. Further passes can take that into account when lowering this code. For example, a linalg.broadcast + linalg.mul sequence can be lowered to a linalg.generic with different affine maps for the two operands.

mlir.dialects.linalg.div(lhs=TensorDef(T1), rhs=TensorDef(T1), O=TensorDef(T1, output=True))

Divides the first tensor by the second tensor, elementwise.

The shapes and element types must be identical. The appropriate casts, broadcasts and reductions should be done previously to calling this op.

This means reduction/broadcast/element cast semantics is explicit. Further passes can take that into account when lowering this code. For example, a linalg.broadcast + linalg.div sequence can be lowered to a linalg.generic with different affine maps for the two operands.

mlir.dialects.linalg.div_unsigned(lhs=TensorDef(T1), rhs=TensorDef(T1), O=TensorDef(T1, output=True))

Divides the first tensor by the second tensor, elementwise. For integer types, performs an unsigned division.

The shapes and element types must be identical. The appropriate casts, broadcasts and reductions should be done previously to calling this op.

This means reduction/broadcast/element cast semantics is explicit. Further passes can take that into account when lowering this code. For example, a linalg.broadcast + linalg.div sequence can be lowered to a linalg.generic with different affine maps for the two operands.

mlir.dialects.linalg.max(lhs=TensorDef(T1), rhs=TensorDef(T1), O=TensorDef(T1, output=True))

Takes the max (signed) between two inputs, elementwise.

The shapes and element types must be identical. The appropriate casts, broadcasts and reductions should be done previously to calling this op.

This means reduction/broadcast/element cast semantics is explicit. Further passes can take that into account when lowering this code. For example, a linalg.broadcast + linalg.max sequence can be lowered to a linalg.generic with different affine maps for the two operands.

mlir.dialects.linalg.min(lhs=TensorDef(T1), rhs=TensorDef(T1), O=TensorDef(T1, output=True))

Takes the min (signed) between two inputs, elementwise.

The shapes and element types must be identical. The appropriate casts, broadcasts and reductions should be done previously to calling this op.

This means reduction/broadcast/element cast semantics is explicit. Further passes can take that into account when lowering this code. For example, a linalg.broadcast + linalg.min sequence can be lowered to a linalg.generic with different affine maps for the two operands.

mlir.dialects.linalg.powf(lhs=TensorDef(T1), rhs=TensorDef(T1), O=TensorDef(T1, output=True))

Takes the powf(lhs, rhs) between two inputs, elementwise. For powf(arg, 2) use linalg.square.

Only applies to floating point values.

The shapes and element types must be identical. The appropriate casts, broadcasts and reductions should be done previously to calling this op.

This means reduction/broadcast/element cast semantics is explicit. Further passes can take that into account when lowering this code. For example, a linalg.broadcast + linalg.powf sequence can be lowered to a linalg.generic with different affine maps for the two operands.

mlir.dialects.linalg.select(cond=TensorDef(U), lhs=TensorDef(T1), rhs=TensorDef(T1), O=TensorDef(T1, output=True))

Chooses one value based on a binary condition supplied as its first operand.

The shapes and element types must be identical. The appropriate casts, broadcasts and reductions should be done previously to calling this op.

This means reduction/broadcast/element cast semantics is explicit. Further passes can take that into account when lowering this code. For example, a linalg.broadcast + linalg.select sequence can be lowered to a linalg.generic with different affine maps for the two operands.

mlir.dialects.linalg.quantized_matmul(A=TensorDef(T1, S.M, S.K), B=TensorDef(T2, S.K, S.N), AZp=ScalarDef(I32), BZp=ScalarDef(I32), C=TensorDef(U, S.M, S.N, output=True))

Performs a matrix multiplication of two 2D inputs.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. The quantized variant includes zero-point adjustments for the left and right operands of the matmul.

mlir.dialects.linalg.mmt4d(lhs=TensorDef(TV.LhsType, S.M, S.K, S.M0, S.K0), rhs=TensorDef(TV.RhsType, S.N, S.K, S.N0, S.K0), accum=TensorDef(TV.AccumType, S.M, S.N, S.M0, S.N0, output=True))

Performs a matrix-matrix-transpose multiplication of two 4D inputs.

Differences from linalg.matmul:

  • The right hand side is transposed, whence the ‘t’ in ‘mmt’.

  • The input and output tensors have a 4D shape instead of a 2D shape. They

are interpreted as 2D matrices with one level of 2D tile subdivision, whence the 2+2=4 dimensions. The inner tile dimensions are identified with ‘0’ suffixes below, for instance the LHS matrix shape (M, K, M0, K0) reads as: MxK tiles, each of shape M0xK0.

mlir.dialects.linalg.batch_mmt4d(lhs=TensorDef(TV.LhsType, Batch, S.M, S.K, S.M0, S.K0), rhs=TensorDef(TV.RhsType, Batch, S.N, S.K, S.N0, S.K0), accum=TensorDef(TV.AccumType, Batch, S.M, S.N, S.M0, S.N0, output=True))

Performs a batched matrix-matrix-transpose multiplication of two batched-4D (5D) inputs.

Besides the outermost batch dimension has the same semantic as linalg.batch_matmul, the differences from linalg.batch_matmul in the non-batch dimensions are the same as linalg.mmt4d vs. linalg.matmul. See the description of lingalg.mmt4d.

mlir.dialects.linalg.quantized_batch_matmul(A=TensorDef(T1, Batch, S.M, S.K), B=TensorDef(T2, Batch, S.K, S.N), AZp=ScalarDef(I32), BZp=ScalarDef(I32), C=TensorDef(U, Batch, S.M, S.N, output=True))

Performs a batched matrix multiplication of two 3D inputs.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. The quantized variant includes zero-point adjustments for the left and right operands of the matmul.

mlir.dialects.linalg.matvec(A=TensorDef(T1, S.M, S.N), y=TensorDef(T2, S.N), x=TensorDef(U, S.M, output=True))

Performs a matrix-vector multiplication.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

mlir.dialects.linalg.vecmat(y=TensorDef(T1, S.M), A=TensorDef(T2, S.M, S.N), x=TensorDef(U, S.N, output=True))

Performs a vector-matrix multiplication.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

mlir.dialects.linalg.batch_matvec(A=TensorDef(T1, Batch, S.M, S.K), B=TensorDef(T2, Batch, S.K), C=TensorDef(U, Batch, S.M, output=True))

Performs a batched matrix-vector multiplication.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

mlir.dialects.linalg.batch_vecmat(A=TensorDef(T1, Batch, S.K), B=TensorDef(T2, Batch, S.K, S.N), C=TensorDef(U, Batch, S.N, output=True))

Performs a batched matrix-vector multiplication.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

mlir.dialects.linalg.dot(A=TensorDef(T1, S.M), B=TensorDef(T2, S.M), C=TensorDef(U, output=True))

Performs a dot product of two vectors to a scalar result.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

mlir.dialects.linalg.conv_1d(I=TensorDef(T1, S.OW + S.KW), K=TensorDef(T2, S.KW), O=TensorDef(U, S.OW, output=True))

Performs 1-D convolution with no channels.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

mlir.dialects.linalg.conv_2d(I=TensorDef(T1, S.OH + S.KH, S.OW + S.KW), K=TensorDef(T2, S.KH, S.KW), O=TensorDef(U, S.OH, S.OW, output=True))

Performs 2-D convolution with no channels.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

mlir.dialects.linalg.conv_3d(I=TensorDef(T1, S.OD + S.KD, S.OH + S.KH, S.OW + S.KW), K=TensorDef(T2, S.KD, S.KH, S.KW), O=TensorDef(U, S.OD, S.OH, S.OW, output=True))

Performs 3-D convolution with no channels.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

mlir.dialects.linalg.conv_1d_nwc_wcf(I=TensorDef(T1, S.N, S.OW * S.SW + S.KW * S.DW, S.C), K=TensorDef(T2, S.KW, S.C, S.F), O=TensorDef(U, S.N, S.OW, S.F, output=True), strides=IndexAttrDef(S.SW, default=[1]), dilations=IndexAttrDef(S.DW, default=[1]))

Performs 1-D convolution.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

mlir.dialects.linalg.conv_1d_ncw_fcw(I=TensorDef(T1, S.N, S.C, S.OW * S.SW + S.KW * S.DW), K=TensorDef(T2, S.F, S.C, S.KW), O=TensorDef(U, S.N, S.F, S.OW, output=True), strides=IndexAttrDef(S.SW, default=[1]), dilations=IndexAttrDef(S.DW, default=[1]))

Performs 1-D convolution.

Layout:

  • Input: NCW.

  • Kernel: FCW.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

mlir.dialects.linalg.conv_2d_nhwc_hwcf(I=TensorDef(T1, S.N, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW, S.C), K=TensorDef(T2, S.KH, S.KW, S.C, S.F), O=TensorDef(U, S.N, S.OH, S.OW, S.F, output=True), strides=IndexAttrDef(S.SH, S.SW, default=[1, 1]), dilations=IndexAttrDef(S.DH, S.DW, default=[1, 1]))

Performs 2-D convolution.

Layout:

  • Input: NHWC.

  • Kernel: HWCF.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

mlir.dialects.linalg.conv_2d_nhwc_fhwc(I=TensorDef(T1, S.N, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW, S.C), K=TensorDef(T2, S.F, S.KH, S.KW, S.C), O=TensorDef(U, S.N, S.OH, S.OW, S.F, output=True), strides=IndexAttrDef(S.SH, S.SW, default=[1, 1]), dilations=IndexAttrDef(S.DH, S.DW, default=[1, 1]))

Performs 2-D convolution.

Layout:

  • Input: NHWC.

  • Kernel: FHWC.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

mlir.dialects.linalg.conv_2d_nhwc_hwcf_q(I=TensorDef(T1, S.N, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW, S.C), K=TensorDef(T2, S.KH, S.KW, S.C, S.F), IZp=ScalarDef(I32), KZp=ScalarDef(I32), O=TensorDef(U, S.N, S.OH, S.OW, S.F, output=True), strides=IndexAttrDef(S.SH, S.SW, default=[1, 1]), dilations=IndexAttrDef(S.DH, S.DW, default=[1, 1]))

Performs 2-D convolution with zero point offsets.

Layout:

  • Input: NHWC.

  • Kernel: HWCF.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. This includes the zero point offsets common to quantized operations.

mlir.dialects.linalg.conv_2d_nhwc_fhwc_q(I=TensorDef(T1, S.N, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW, S.C), K=TensorDef(T2, S.F, S.KH, S.KW, S.C), IZp=ScalarDef(I32), KZp=ScalarDef(I32), O=TensorDef(U, S.N, S.OH, S.OW, S.F, output=True), strides=IndexAttrDef(S.SH, S.SW, default=[1, 1]), dilations=IndexAttrDef(S.DH, S.DW, default=[1, 1]))

Performs 2-D convolution with zero point offsets.

Layout:

  • Input: NHWC.

  • Kernel: FHWC.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. This includes the zero point offsets common to quantized operations.

mlir.dialects.linalg.conv_2d_nchw_fchw_q(I=TensorDef(T1, S.N, S.C, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW), K=TensorDef(T2, S.F, S.C, S.KH, S.KW), IZp=ScalarDef(I32), KZp=ScalarDef(I32), O=TensorDef(U, S.N, S.F, S.OH, S.OW, output=True), strides=IndexAttrDef(S.SH, S.SW, default=[1, 1]), dilations=IndexAttrDef(S.DH, S.DW, default=[1, 1]))

Performs 2-D convolution with zero point offsets.

Layout:

  • Input: NCHW.

  • Kernel: FCHW.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. This includes the zero point offsets common to quantized operations.

mlir.dialects.linalg.conv_2d_nchw_fchw(I=TensorDef(T1, S.N, S.C, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW), K=TensorDef(T2, S.F, S.C, S.KH, S.KW), O=TensorDef(U, S.N, S.F, S.OH, S.OW, output=True), strides=IndexAttrDef(S.SH, S.SW, default=[1, 1]), dilations=IndexAttrDef(S.DH, S.DW, default=[1, 1]))

Performs 2-D convolution.

Layout:

  • Input: NCHW.

  • Kernel: FCHW.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

mlir.dialects.linalg.conv_2d_ngchw_fgchw(I=TensorDef(T1, S.N, S.G, S.C, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW), K=TensorDef(T2, S.FG, S.G, S.C, S.KH, S.KW), O=TensorDef(U, S.N, S.G, S.FG, S.OH, S.OW, output=True), strides=IndexAttrDef(S.SH, S.SW, default=[1, 1]), dilations=IndexAttrDef(S.DH, S.DW, default=[1, 1]))

Performs 2-D grouped convolution.

Layout:

  • Input: NGCHW.

  • Kernel: FGCHW.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

mlir.dialects.linalg.conv_2d_ngchw_gfchw(I=TensorDef(T1, S.N, S.G, S.C, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW), K=TensorDef(T2, S.G, S.FG, S.C, S.KH, S.KW), O=TensorDef(U, S.N, S.G, S.FG, S.OH, S.OW, output=True), strides=IndexAttrDef(S.SH, S.SW, default=[1, 1]), dilations=IndexAttrDef(S.DH, S.DW, default=[1, 1]))

Performs 2-D grouped convolution.

Layout:

  • Input: NGCHW.

  • Kernel: GFCHW.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

mlir.dialects.linalg.conv_2d_nhwgc_gfhwc(I=TensorDef(T1, S.N, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW, S.G, S.C), K=TensorDef(T2, S.G, S.FG, S.KH, S.KW, S.C), O=TensorDef(U, S.N, S.OH, S.OW, S.G, S.FG, output=True), strides=IndexAttrDef(S.SH, S.SW, default=[1, 1]), dilations=IndexAttrDef(S.DH, S.DW, default=[1, 1]))

Performs 2-D grouped convolution.

Layout:

  • Input: NHWGC.

  • Kernel: GFHWC.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

mlir.dialects.linalg.conv_2d_nhwgc_gfhwc_q(I=TensorDef(T1, S.N, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW, S.G, S.C), K=TensorDef(T2, S.G, S.FG, S.KH, S.KW, S.C), IZp=ScalarDef(I32), KZp=ScalarDef(I32), O=TensorDef(U, S.N, S.OH, S.OW, S.G, S.FG, output=True), strides=IndexAttrDef(S.SH, S.SW, default=[1, 1]), dilations=IndexAttrDef(S.DH, S.DW, default=[1, 1]))

Performs 2-D grouped convolution with zero point offsets.

Layout:

  • Input: NHWGC.

  • Kernel: GFHWC.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. This includes the zero point offsets common to quantized operations.

mlir.dialects.linalg.conv_2d_ngchw_gfchw_q(I=TensorDef(T1, S.N, S.G, S.C, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW), K=TensorDef(T2, S.G, S.FG, S.C, S.KH, S.KW), IZp=ScalarDef(I32), KZp=ScalarDef(I32), O=TensorDef(U, S.N, S.G, S.FG, S.OH, S.OW, output=True), strides=IndexAttrDef(S.SH, S.SW, default=[1, 1]), dilations=IndexAttrDef(S.DH, S.DW, default=[1, 1]))

Performs 2-D grouped convolution with zero-point offsets.

Layout:

  • Input: NGCHW.

  • Kernel: GFCHW.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. This includes the zero point offsets common to quantized operations.

mlir.dialects.linalg.conv_3d_ndhwc_dhwcf(I=TensorDef(T1, S.N, S.OD * S.SD + S.KD * S.DD, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW, S.C), K=TensorDef(T2, S.KD, S.KH, S.KW, S.C, S.F), O=TensorDef(U, S.N, S.OD, S.OH, S.OW, S.F, output=True), strides=IndexAttrDef(S.SD, S.SH, S.SW, default=[1, 1, 1]), dilations=IndexAttrDef(S.DD, S.DH, S.DW, default=[1, 1, 1]))

Performs 3-D convolution.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

mlir.dialects.linalg.conv_3d_ndhwc_dhwcf_q(I=TensorDef(T1, S.N, S.OD * S.SD + S.KD * S.DD, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW, S.C), K=TensorDef(T2, S.KD, S.KH, S.KW, S.C, S.F), IZp=ScalarDef(I32), KZp=ScalarDef(I32), O=TensorDef(U, S.N, S.OD, S.OH, S.OW, S.F, output=True), strides=IndexAttrDef(S.SD, S.SH, S.SW, default=[1, 1, 1]), dilations=IndexAttrDef(S.DD, S.DH, S.DW, default=[1, 1, 1]))

Performs 3-D convolution with zero point offsets.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. This includes the zero point offsets common to quantized operations.

mlir.dialects.linalg.conv_3d_ncdhw_fcdhw(I=TensorDef(T1, S.N, S.C, S.OD * S.SD + S.KD * S.DD, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW), K=TensorDef(T2, S.F, S.C, S.KD, S.KH, S.KW), O=TensorDef(U, S.N, S.F, S.OD, S.OH, S.OW, output=True), strides=IndexAttrDef(S.SD, S.SH, S.SW, default=[1, 1, 1]), dilations=IndexAttrDef(S.DD, S.DH, S.DW, default=[1, 1, 1]))

Performs 3-D convolution.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

mlir.dialects.linalg.depthwise_conv_1d_nwc_wc(I=TensorDef(T1, S.N, S.OW * S.SW + S.KW * S.DW, S.IC), K=TensorDef(T2, S.KW, S.IC), O=TensorDef(U, S.N, S.OW, S.IC, output=True), strides=IndexAttrDef(S.SW, default=[1]), dilations=IndexAttrDef(S.DW, default=[1]))

Performs depth-wise 1-D convolution.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. Multiplier is set to 1 which is a special case for most depthwise convolutions.

mlir.dialects.linalg.depthwise_conv_1d_ncw_cw(I=TensorDef(T1, S.N, S.IC, S.OW * S.SW + S.KW * S.DW), K=TensorDef(T2, S.IC, S.KW), O=TensorDef(U, S.N, S.IC, S.OW, output=True), strides=IndexAttrDef(S.SW, default=[1]), dilations=IndexAttrDef(S.DW, default=[1]))

Performs depth-wise 1-D convolution.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. Multiplier is set to 1 which is a special case for most depthwise convolutions.

mlir.dialects.linalg.depthwise_conv_1d_nwc_wcm(I=TensorDef(T1, S.N, S.OW * S.SW + S.KW * S.DW, S.IC), K=TensorDef(T2, S.KW, S.IC, S.CM), O=TensorDef(U, S.N, S.OW, S.IC, S.CM, output=True), strides=IndexAttrDef(S.SW, default=[1]), dilations=IndexAttrDef(S.DW, default=[1]))

Performs depth-wise 1-D convolution.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

mlir.dialects.linalg.depthwise_conv_2d_nhwc_hwc(I=TensorDef(T1, S.N, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW, S.IC), K=TensorDef(T2, S.KH, S.KW, S.IC), O=TensorDef(U, S.N, S.OH, S.OW, S.IC, output=True), strides=IndexAttrDef(S.SH, S.SW, default=[1, 1]), dilations=IndexAttrDef(S.DH, S.DW, default=[1, 1]))

Performs depth-wise 2-D convolution.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. Multiplier is set to 1 which is a special case for most depthwise convolutions.

mlir.dialects.linalg.depthwise_conv_2d_nchw_chw(I=TensorDef(T1, S.N, S.IC, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW), K=TensorDef(T2, S.IC, S.KH, S.KW), O=TensorDef(U, S.N, S.IC, S.OH, S.OW, output=True), strides=IndexAttrDef(S.SH, S.SW, default=[1, 1]), dilations=IndexAttrDef(S.DH, S.DW, default=[1, 1]))

Performs depth-wise 2-D convolution.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. Multiplier is set to 1 which is a special case for most depthwise convolutions.

mlir.dialects.linalg.depthwise_conv_2d_nhwc_hwc_q(I=TensorDef(T1, S.N, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW, S.IC), K=TensorDef(T2, S.KH, S.KW, S.IC), IZp=ScalarDef(I32), KZp=ScalarDef(I32), O=TensorDef(U, S.N, S.OH, S.OW, S.IC, output=True), strides=IndexAttrDef(S.SH, S.SW, default=[1, 1]), dilations=IndexAttrDef(S.DH, S.DW, default=[1, 1]))

Performs depth-wise 2-D convolution.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

mlir.dialects.linalg.depthwise_conv_2d_nhwc_hwcm(I=TensorDef(T1, S.N, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW, S.IC), K=TensorDef(T2, S.KH, S.KW, S.IC, S.CM), O=TensorDef(U, S.N, S.OH, S.OW, S.IC, S.CM, output=True), strides=IndexAttrDef(S.SH, S.SW, default=[1, 1]), dilations=IndexAttrDef(S.DH, S.DW, default=[1, 1]))

Performs depth-wise 2-D convolution.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

mlir.dialects.linalg.depthwise_conv_2d_nhwc_hwcm_q(I=TensorDef(T1, S.N, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW, S.IC), K=TensorDef(T2, S.KH, S.KW, S.IC, S.CM), IZp=ScalarDef(I32), KZp=ScalarDef(I32), O=TensorDef(U, S.N, S.OH, S.OW, S.IC, S.CM, output=True), strides=IndexAttrDef(S.SH, S.SW, default=[1, 1]), dilations=IndexAttrDef(S.DH, S.DW, default=[1, 1]))

Performs depth-wise 2-D convolution.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

mlir.dialects.linalg.depthwise_conv_3d_ndhwc_dhwc(I=TensorDef(T1, S.N, S.OD * S.SD + S.KD * S.DD, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW, S.IC), K=TensorDef(T2, S.KD, S.KH, S.KW, S.IC), O=TensorDef(U, S.N, S.OD, S.OH, S.OW, output=True), strides=IndexAttrDef(S.SD, S.SH, S.SW, default=[1, 1, 1]), dilations=IndexAttrDef(S.DD, S.DH, S.DW, default=[1, 1, 1]))

Performs depth-wise 3-D convolution.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. Multiplier is set to 1 which is a special case for most depthwise convolutions.

mlir.dialects.linalg.depthwise_conv_3d_ncdhw_cdhw(I=TensorDef(T1, S.N, S.IC, S.OD * S.SD + S.KD * S.DD, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW), K=TensorDef(T2, S.IC, S.KD, S.KH, S.KW), O=TensorDef(U, S.N, S.IC, S.OD, S.OH, S.OW, output=True), strides=IndexAttrDef(S.SD, S.SH, S.SW, default=[1, 1, 1]), dilations=IndexAttrDef(S.DD, S.DH, S.DW, default=[1, 1, 1]))

Performs depth-wise 3-D convolution.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output. Multiplier is set to 1 which is a special case for most depthwise convolutions.

mlir.dialects.linalg.depthwise_conv_3d_ndhwc_dhwcm(I=TensorDef(T1, S.N, S.OD * S.SD + S.KD * S.DD, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW, S.IC), K=TensorDef(T2, S.KD, S.KH, S.KW, S.IC, S.CM), O=TensorDef(U, S.N, S.OD, S.OH, S.OW, S.CM, output=True), strides=IndexAttrDef(S.SD, S.SH, S.SW, default=[1, 1, 1]), dilations=IndexAttrDef(S.DD, S.DH, S.DW, default=[1, 1, 1]))

Performs depth-wise 3-D convolution.

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

mlir.dialects.linalg.pooling_nhwc_sum(I=TensorDef(T1, S.N, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW, S.C), K=TensorDef(T2, S.KH, S.KW, index_dims=[D.kh, D.kw]), O=TensorDef(U, S.N, S.OH, S.OW, S.C, output=True), strides=IndexAttrDef(S.SH, S.SW, default=[1, 1]), dilations=IndexAttrDef(S.DH, S.DW, default=[1, 1]))

Performs sum pooling.

Layout:

  • Input: NHWC.

  • Kernel: HW.

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

mlir.dialects.linalg.pooling_nchw_sum(I=TensorDef(T1, S.N, S.C, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW), K=TensorDef(T2, S.KH, S.KW, index_dims=[D.kh, D.kw]), O=TensorDef(U, S.N, S.C, S.OH, S.OW, output=True), strides=IndexAttrDef(S.SH, S.SW, default=[1, 1]), dilations=IndexAttrDef(S.DH, S.DW, default=[1, 1]))

Performs sum pooling.

Layout:

  • Input: NCHW.

  • Kernel: HW.

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

mlir.dialects.linalg.pooling_nhwc_max(I=TensorDef(T1, S.N, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW, S.C), K=TensorDef(T2, S.KH, S.KW, index_dims=[D.kh, D.kw]), O=TensorDef(U, S.N, S.OH, S.OW, S.C, output=True), strides=IndexAttrDef(S.SH, S.SW, default=[1, 1]), dilations=IndexAttrDef(S.DH, S.DW, default=[1, 1]))

Performs max pooling.

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

mlir.dialects.linalg.pooling_nhwc_max_unsigned(I=TensorDef(T1, S.N, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW, S.C), K=TensorDef(T2, S.KH, S.KW, index_dims=[D.kh, D.kw]), O=TensorDef(U, S.N, S.OH, S.OW, S.C, output=True), strides=IndexAttrDef(S.SH, S.SW, default=[1, 1]), dilations=IndexAttrDef(S.DH, S.DW, default=[1, 1]))

Performs unsigned max pooling.

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

mlir.dialects.linalg.pooling_nchw_max(I=TensorDef(T1, S.N, S.C, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW), K=TensorDef(T2, S.KH, S.KW, index_dims=[D.kh, D.kw]), O=TensorDef(U, S.N, S.C, S.OH, S.OW, output=True), strides=IndexAttrDef(S.SH, S.SW, default=[1, 1]), dilations=IndexAttrDef(S.DH, S.DW, default=[1, 1]))

Performs max pooling.

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

mlir.dialects.linalg.pooling_nhwc_min(I=TensorDef(T1, S.N, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW, S.C), K=TensorDef(T2, S.KH, S.KW, index_dims=[D.kh, D.kw]), O=TensorDef(U, S.N, S.OH, S.OW, S.C, output=True), strides=IndexAttrDef(S.SH, S.SW, default=[1, 1]), dilations=IndexAttrDef(S.DH, S.DW, default=[1, 1]))

Performs min pooling.

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

mlir.dialects.linalg.pooling_nhwc_min_unsigned(I=TensorDef(T1, S.N, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW, S.C), K=TensorDef(T2, S.KH, S.KW, index_dims=[D.kh, D.kw]), O=TensorDef(U, S.N, S.OH, S.OW, S.C, output=True), strides=IndexAttrDef(S.SH, S.SW, default=[1, 1]), dilations=IndexAttrDef(S.DH, S.DW, default=[1, 1]))

Performs unsigned min pooling.

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

mlir.dialects.linalg.pooling_nwc_sum(I=TensorDef(T1, S.N, S.OW * S.SW + S.KW * S.DW, S.C), K=TensorDef(T2, S.KW, index_dims=[D.kw]), O=TensorDef(U, S.N, S.OW, S.C, output=True), strides=IndexAttrDef(S.SW, default=[1]), dilations=IndexAttrDef(S.DW, default=[1]))

Performs sum pooling.

Layout:

  • Input: NWC.

  • Kernel: W.

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

mlir.dialects.linalg.pooling_ncw_sum(I=TensorDef(T1, S.N, S.C, S.OW * S.SW + S.KW * S.DW), K=TensorDef(T2, S.KW, index_dims=[D.kw]), O=TensorDef(U, S.N, S.C, S.OW, output=True), strides=IndexAttrDef(S.SW, default=[1]), dilations=IndexAttrDef(S.DW, default=[1]))

Performs sum pooling.

Layout:

  • Input: NCW.

  • Kernel: W.

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

mlir.dialects.linalg.pooling_nwc_max(I=TensorDef(T1, S.N, S.OW * S.SW + S.KW * S.DW, S.C), K=TensorDef(T2, S.KW, index_dims=[D.kw]), O=TensorDef(U, S.N, S.OW, S.C, output=True), strides=IndexAttrDef(S.SW, default=[1]), dilations=IndexAttrDef(S.DW, default=[1]))

Performs max pooling.

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

mlir.dialects.linalg.pooling_nwc_max_unsigned(I=TensorDef(T1, S.N, S.OW * S.SW + S.KW * S.DW, S.C), K=TensorDef(T2, S.KW, index_dims=[D.kw]), O=TensorDef(U, S.N, S.OW, S.C, output=True), strides=IndexAttrDef(S.SW, default=[1]), dilations=IndexAttrDef(S.DW, default=[1]))

Performs unsigned max pooling.

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

mlir.dialects.linalg.pooling_ncw_max(I=TensorDef(T1, S.N, S.C, S.OW * S.SW + S.KW * S.DW), K=TensorDef(T2, S.KW, index_dims=[D.kw]), O=TensorDef(U, S.N, S.C, S.OW, output=True), strides=IndexAttrDef(S.SW, default=[1]), dilations=IndexAttrDef(S.DW, default=[1]))

Performs max pooling.

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

mlir.dialects.linalg.pooling_nwc_min(I=TensorDef(T1, S.N, S.OW * S.SW + S.KW * S.DW, S.C), K=TensorDef(T2, S.KW, index_dims=[D.kw]), O=TensorDef(U, S.N, S.OW, S.C, output=True), strides=IndexAttrDef(S.SW, default=[1]), dilations=IndexAttrDef(S.DW, default=[1]))

Performs min pooling.

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

mlir.dialects.linalg.pooling_nwc_min_unsigned(I=TensorDef(T1, S.N, S.OW * S.SW + S.KW * S.DW, S.C), K=TensorDef(T2, S.KW, index_dims=[D.kw]), O=TensorDef(U, S.N, S.OW, S.C, output=True), strides=IndexAttrDef(S.SW, default=[1]), dilations=IndexAttrDef(S.DW, default=[1]))

Performs unsigned min pooling.

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

mlir.dialects.linalg.pooling_ndhwc_sum(I=TensorDef(T1, S.N, S.OD * S.SD + S.KD * S.DD, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW, S.C), K=TensorDef(T2, S.KD, S.KH, S.KW, index_dims=[D.kd, D.kh, D.kw]), O=TensorDef(U, S.N, S.OD, S.OH, S.OW, S.C, output=True), strides=IndexAttrDef(S.SD, S.SH, S.SW, default=[1, 1, 1]), dilations=IndexAttrDef(S.DD, S.DH, S.DW, default=[1, 1, 1]))

Performs 3D sum pooling.

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

mlir.dialects.linalg.pooling_ndhwc_max(I=TensorDef(T1, S.N, S.OD * S.SD + S.KD * S.DD, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW, S.C), K=TensorDef(T2, S.KD, S.KH, S.KW, index_dims=[D.kd, D.kh, D.kw]), O=TensorDef(U, S.N, S.OD, S.OH, S.OW, S.C, output=True), strides=IndexAttrDef(S.SD, S.SH, S.SW, default=[1, 1, 1]), dilations=IndexAttrDef(S.DD, S.DH, S.DW, default=[1, 1, 1]))

Performs 3D max pooling.

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

mlir.dialects.linalg.pooling_ndhwc_min(I=TensorDef(T1, S.N, S.OD * S.SD + S.KD * S.DD, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW, S.C), K=TensorDef(T2, S.KD, S.KH, S.KW, index_dims=[D.kd, D.kh, D.kw]), O=TensorDef(U, S.N, S.OD, S.OH, S.OW, S.C, output=True), strides=IndexAttrDef(S.SD, S.SH, S.SW, default=[1, 1, 1]), dilations=IndexAttrDef(S.DD, S.DH, S.DW, default=[1, 1, 1]))

Performs 3D min pooling.

Numeric casting is performed on the input operand, promoting it to the same data type as the accumulator/output.

mlir.dialects.linalg.fill(value=ScalarDef(T), O=TensorDef(T, output=True))

Fills the output tensor with the given value.

Works for arbitrary ranked output tensors since the operation performs scalar accesses only and is thus rank polymorphic. The value type must match the element type of the output tensor or memref.

mlir.dialects.linalg.fill_rng_2d(min=ScalarDef(F64), max=ScalarDef(F64), seed=ScalarDef(I32), O=TensorDef(T, S.M, S.N, output=True))

Fills the output tensor with pseudo random numbers.

The operation generations pseudo random numbers using a linear congruential generator. It provides no guarantees regarding the distribution of the generated random numbers. Instead of generating the random numbers sequentially, it instantiates one random number generator per data element and runs them in parallel. The seed operand and the indices of the data element seed the random number generation. The min and max operands limit the range of the generated random numbers.

mlir.dialects.linalg._get_op_result_or_value(arg: mlir._mlir_libs._mlir.ir.OpView | mlir._mlir_libs._mlir.ir.Operation | mlir._mlir_libs._mlir.ir.Value | mlir._mlir_libs._mlir.ir.OpResultList) mlir._mlir_libs._mlir.ir.Value

Returns the given value or the single result of the given op.

This is useful to implement op constructors so that they can take other ops as arguments instead of requiring the caller to extract results for every op. Raises ValueError if provided with an op that doesn’t have a single result.

mlir.dialects.linalg._get_op_results_or_values(arg: mlir._mlir_libs._mlir.ir.OpView | mlir._mlir_libs._mlir.ir.Operation | Sequence[mlir._mlir_libs._mlir.ir.OpView | mlir._mlir_libs._mlir.ir.Operation | mlir._mlir_libs._mlir.ir.Value]) Sequence[mlir._mlir_libs._mlir.ir.OpView | mlir._mlir_libs._mlir.ir.Operation | mlir._mlir_libs._mlir.ir.Value] | mlir._mlir_libs._mlir.ir.OpResultList

Returns the given sequence of values or the results of the given op.

This is useful to implement op constructors so that they can take other ops as lists of arguments instead of requiring the caller to extract results for every op.

mlir.dialects.linalg._CONTEXT
mlir.dialects.linalg.StructuredOpOuts
mlir.dialects.linalg.bind_op_def(op_def: mlir.dialects.linalg.opdsl.lang.emitter.LinalgOpDef)
mlir.dialects.linalg.current_op_def() mlir.dialects.linalg.opdsl.lang.emitter.LinalgOpDef
mlir.dialects.linalg._prepare_structured_op_outs(outs: StructuredOpOuts) mlir.dialects.linalg.opdsl.lang.emitter.ValueList
class mlir.dialects.linalg.DefinedOpCallable(op_name: str, op_def: mlir.dialects.linalg.opdsl.lang.emitter.LinalgOpDef)

Callable that wraps any defined op function.

op_name
op_def
__call__(*ins: mlir.dialects.linalg.opdsl.lang.emitter.Union[mlir.ir.Operation, mlir.ir.OpView, mlir.ir.Value], outs: StructuredOpOuts, **kwargs)

Emits the corresponding op definition as IR.

Most arguments are passed through to the underlying emitter. The following keyword argument is interpreted here: emit_generic: Emits a generic form as appropriate (default True). If False, a named form is emitted (which must have been built in to the compiler).

mlir.dialects.linalg.linalg_structured_op(dsl_func=None, *, op_name=None, op_class_name=None) DefinedOpCallable
mlir.dialects.linalg.domain(*dimensions: mlir.dialects.linalg.opdsl.lang.emitter.DimDef)
mlir.dialects.linalg.implements(*interfaces: mlir.dialects.linalg.opdsl.lang.emitter.OpInterfaceDef)
mlir.dialects.linalg.defines(*definitions: mlir.dialects.linalg.opdsl.lang.emitter.OpDefinitionDef)
class mlir.dialects.linalg.TensorExpression

An expression that can appear on the RHS of a comprehension.

abstract to_scalar_expression() mlir.dialects.linalg.opdsl.lang.scalar_expr.ScalarExpression
visit_tensor_exprs(callback: mlir.dialects.linalg.opdsl.lang.scalar_expr.Callable[[TensorExpression], None])

Visits all tensor expression reachable by the expression.

collect_dim_uses(uses: mlir.dialects.linalg.opdsl.lang.scalar_expr.Set[mlir.dialects.linalg.opdsl.lang.scalar_expr.DimDef])

Collects all DimDefs reachable through this expression.

collect_tensor_uses(uses: mlir.dialects.linalg.opdsl.lang.scalar_expr.Set[TensorUse])

Collects all TensorUses reachable through this expression.

collect_indices(indices: mlir.dialects.linalg.opdsl.lang.scalar_expr.Set[index])

Collects all index accesses reachable through this expression.

collect_scalar_uses(uses: mlir.dialects.linalg.opdsl.lang.scalar_expr.Set[ScalarDef])

Collects all ScalarDefs reachable through this expression.

__add__(rhs: TensorExpression) TensorExpression
__mul__(rhs) TensorExpression
__sub__(rhs) TensorExpression
__truediv__(rhs) TensorExpression
__hash__()
class mlir.dialects.linalg.TensorUse(operand_def: OperandDef, indices: mlir.dialects.linalg.opdsl.lang.scalar_expr.Sequence[mlir.dialects.linalg.opdsl.lang.scalar_expr.AffineExprDef])

Bases: TensorExpression

A used tensor represented by its (tensor_name, indices).

Note that forming a comprehension via direct assignment is performed through setitem on the TensorDef level. However, performing a reduction with compound ops (+=, =, etc) is done by doing a: TensorDef.**getitem* TensorUse.**iadd** TensorDef.**setitem**

operand_def
indices
to_scalar_expression() mlir.dialects.linalg.opdsl.lang.scalar_expr.ScalarExpression
property tensor_name: str
_compute_reduce_dims(rhs: TensorExpression) mlir.dialects.linalg.opdsl.lang.scalar_expr.Set[mlir.dialects.linalg.opdsl.lang.scalar_expr.DimDef]
__iadd__(rhs: TensorExpression) TensorReduceFn
__repr__()
class mlir.dialects.linalg.TensorFn(kind: FunctionKind, name: mlir.dialects.linalg.opdsl.lang.scalar_expr.Optional[str], operand_def: mlir.dialects.linalg.opdsl.lang.scalar_expr.Optional[OperandDef], type_var: mlir.dialects.linalg.opdsl.lang.scalar_expr.Optional[mlir.dialects.linalg.opdsl.lang.types.TypeVar], args: mlir.dialects.linalg.opdsl.lang.scalar_expr.Sequence[TensorExpression])

Bases: TensorExpression

Application of a tensor function.

name
kind
operand_def
type_var
args
to_scalar_expression() mlir.dialects.linalg.opdsl.lang.scalar_expr.ScalarExpression
visit_tensor_exprs(callback: mlir.dialects.linalg.opdsl.lang.scalar_expr.Callable[[TensorExpression], None])

Visits all tensor expression reachable by the expression.

__repr__()
class mlir.dialects.linalg.TensorReduceFn(reduce_use: ReduceFnUse, args: mlir.dialects.linalg.opdsl.lang.scalar_expr.Sequence[TensorExpression])

Bases: TensorExpression

Application of a reduction function.

This captures the lhs (initial value) separately from the rhs.

reduce_use
lhs: mlir.dialects.linalg.opdsl.lang.scalar_expr.Optional[TensorUse] = None
args
to_scalar_expression() mlir.dialects.linalg.opdsl.lang.scalar_expr.ScalarExpression
visit_tensor_exprs(callback: mlir.dialects.linalg.opdsl.lang.scalar_expr.Callable[[TensorExpression], None])

Visits all tensor expression reachable by the expression.

__repr__()
class mlir.dialects.linalg.const(value: mlir.dialects.linalg.opdsl.lang.scalar_expr.Any)

Bases: TensorExpression

Returns the given constant floating point or integer value.

to_scalar_expression() mlir.dialects.linalg.opdsl.lang.scalar_expr.ScalarExpression
__repr__()
class mlir.dialects.linalg.index(dim: mlir.dialects.linalg.opdsl.lang.scalar_expr.DimDef)

Bases: TensorExpression

Returns the iteration index for a given dimension name.

Resolves the given dimension name to obtain its position in the iteration domain of the operation.

dim_def
dim = -1
resolve_dimension_name(affine_state: mlir.dialects.linalg.opdsl.lang.scalar_expr.AffineBuildState)
to_scalar_expression() mlir.dialects.linalg.opdsl.lang.scalar_expr.ScalarExpression
__repr__()
class mlir.dialects.linalg.FunctionKind

Bases: mlir.dialects.linalg.opdsl.lang.types.Enum

Generic enumeration.

Derive from this class to define new enumerations.

UNARY = 0
BINARY = 1
TERNARY = 2
TYPE = 3
class mlir.dialects.linalg.UnaryFnType(fn_name: str)

Unary function.

A unary function takes one tensor expression and returns the function evaluation result.

fn_name
__call__(arg: TensorExpression) TensorFn
__repr__()
class mlir.dialects.linalg.UnaryFn

Unary function namespace.

exp
log
abs
ceil
floor
negf
reciprocal
round
sqrt
rsqrt
square
tanh
erf
class mlir.dialects.linalg.BinaryFnType(fn_name: str)

Binary function.

A binary function takes two tensor expressions and returns the function evaluation result.

fn_name
__call__(arg0: TensorExpression, arg1: TensorExpression) TensorFn
__repr__()
class mlir.dialects.linalg.BinaryFn

Binary function namespace.

As the integer types are signless, signedness is implement by different functions that treat integers as signed or unsigned values.

Examples:

  • max -> arith.MaxSIOp

  • max_unsigned -> arith.MaxUIOp

add
sub
mul
div
div_unsigned
max_signed
min_signed
max_unsigned
min_unsigned
powf
class mlir.dialects.linalg.TernaryFnType(fn_name: str)

Ternary function.

A ternary function takes three tensor expressions and returns the function evaluation result.

fn_name
__call__(arg0: TensorExpression, arg1: TensorExpression, arg2: TensorExpression) TensorFn
__repr__()
class mlir.dialects.linalg.TernaryFn

Ternary function namespace.

select
class mlir.dialects.linalg.TypeFnType(fn_name: str)

Type conversion function.

A type conversion function takes a target type and a tensor expression and returns the casted tensor expression.

fn_name
__call__(type_var: mlir.dialects.linalg.opdsl.lang.types.TypeVar, arg: TensorExpression) TensorFn
__repr__()
class mlir.dialects.linalg.TypeFn

Type conversion function namespace.

As the integer types are signless, signedness is implement by different cast functions that treat integers as signed (cast_signed) or unsigned (cast_unsigned) values.

Examples:

  • cast_signed(I32 -> I64) -> arith.ExtSIOp

  • cast_unsigned(I32 -> I64) -> arith.ExtUIOp

cast_signed
cast_unsigned
class mlir.dialects.linalg.ReduceFnUse(binary_fn: mlir.dialects.linalg.opdsl.lang.scalar_expr.Optional[BinaryFnType], binary_attr: mlir.dialects.linalg.opdsl.lang.scalar_expr.Optional[BinaryFnAttrDef], *reduce_dims: mlir.dialects.linalg.opdsl.lang.scalar_expr.DimDef)

Reduction function use.

A reduction use specifies the reduction function and dimensions.

binary_fn
binary_attr
reduce_dims = ()
__call__(*args: TensorExpression) TensorReduceFn
__repr__()
class mlir.dialects.linalg.ReduceFnType(binary_fn: BinaryFnType)

Reduction function.

A binary function that reduces its RHS into its LHS.

binary_fn
__getitem__(reduce_dims: mlir.dialects.linalg.opdsl.lang.scalar_expr.Tuple[mlir.dialects.linalg.opdsl.lang.scalar_expr.DimDef]) ReduceFnUse
__repr__()
class mlir.dialects.linalg.ReduceFn
add
mul
max_signed
min_signed
max_unsigned
min_unsigned
class mlir.dialects.linalg.OperandKind

Bases: mlir.dialects.linalg.opdsl.lang.types.Enum

Generic enumeration.

Derive from this class to define new enumerations.

INPUT_TENSOR = 0
SCALAR = 1
OUTPUT_TENSOR = 2
INDEX_ATTR = 3
UNARY_FN_ATTR = 4
BINARY_FN_ATTR = 5
TERNARY_FN_ATTR = 6
TYPE_FN_ATTR = 7
class mlir.dialects.linalg.OperandDef(kind: OperandKind, type_var: mlir.dialects.linalg.opdsl.lang.scalar_expr.Optional[mlir.dialects.linalg.opdsl.lang.types.TypeVar] = None, size_exprs: mlir.dialects.linalg.opdsl.lang.scalar_expr.Optional[mlir.dialects.linalg.opdsl.lang.scalar_expr.Sequence[mlir.dialects.linalg.opdsl.lang.scalar_expr.AffineExprDef]] = None, index_dims: mlir.dialects.linalg.opdsl.lang.scalar_expr.Optional[mlir.dialects.linalg.opdsl.lang.scalar_expr.Sequence[mlir.dialects.linalg.opdsl.lang.scalar_expr.DimDef]] = None, default_indices: mlir.dialects.linalg.opdsl.lang.scalar_expr.Optional[mlir.dialects.linalg.opdsl.lang.scalar_expr.Sequence[int]] = None, default_fn: mlir.dialects.linalg.opdsl.lang.scalar_expr.Optional[str] = None)

Definition of an operand passed to an operation.

Keep the meta information of Tensor, Scalar, and Attribute operands and provide the shared registration functionality.

owner: mlir.dialects.linalg.opdsl.lang.scalar_expr.Optional[LinalgOpDef] = None
type_var = None
size_exprs = None
index_dims = None
default_indices = None
default_fn = None
kind
name: mlir.dialects.linalg.opdsl.lang.scalar_expr.Optional[str] = None
registered_index: int = -1
attach(index: int, name: str, owner: LinalgOpDef)
is_input() bool
is_tensor() bool
is_attribute() bool
__hash__()
__repr__()
class mlir.dialects.linalg.TensorDef(type_var: mlir.dialects.linalg.opdsl.lang.types.TypeVar, *shape: mlir.dialects.linalg.opdsl.lang.scalar_expr.AffineExprDef, index_dims: mlir.dialects.linalg.opdsl.lang.scalar_expr.Optional[mlir.dialects.linalg.opdsl.lang.scalar_expr.Sequence[mlir.dialects.linalg.opdsl.lang.scalar_expr.DimDef]] = None, output: bool = False)

Tensor operand definition.

Tensor operands are indexed using the associated indexing_map when forwarded to the body of the structured op. A unique name identifies the tensor operands and an index determines their position in the operation’s parameter list. A tensor definition takes type, a shape, and an optional flag to mark output tensors. Additionally, a tuple of index dimensions may be used to map the tensor to the loop dimensions of the operation. This mapping is needed to compute the indexing map of shape-only tensors that have no uses.

operand_def
__getitem__(dims: mlir.dialects.linalg.opdsl.lang.scalar_expr.Sequence[mlir.dialects.linalg.opdsl.lang.scalar_expr.AffineExprDef]) TensorUse
__setitem__(dims: mlir.dialects.linalg.opdsl.lang.scalar_expr.Sequence[mlir.dialects.linalg.opdsl.lang.scalar_expr.AffineExprDef], value: TensorExpression)

Creates a new 1:1 comprehension by binding this tensor to an expression.

Note that due to the way assignment works in Python, we have to capture direct assignment as a setitem on the TensorDef.

class mlir.dialects.linalg.ScalarDef(type_var: mlir.dialects.linalg.opdsl.lang.types.TypeVar)

Bases: TensorExpression

Scalar operand definition.

Scalar operands are forwarded to the body of the structured op as they are. A unique name identifies the scalars and an index determines their position in the operation’s parameter list.

operand_def
property scalar_name: str
to_scalar_expression() mlir.dialects.linalg.opdsl.lang.scalar_expr.ScalarExpression
class mlir.dialects.linalg.IndexAttrDef(*sizes: mlir.dialects.linalg.opdsl.lang.scalar_expr.SymbolDef, default: mlir.dialects.linalg.opdsl.lang.scalar_expr.Sequence[int])

Index attribute definition.

Index attributes provide a way to define and set symbols that can be used in indexing expressions. Every attribute specifies a tuple of symbols that at compile-time are replaced by integer values as well as their default values.

operand_def
class mlir.dialects.linalg.UnaryFnAttrDef(default: UnaryFnType)

Unary function attribute definition.

Unary function attributes provide a way to make the arithmetic computation parametrizable. Every attribute specifies a default unary function that may be overwritten at operation instantiation time.

operand_def
__call__(arg: TensorExpression) TensorFn
class mlir.dialects.linalg.BinaryFnAttrDef(default: BinaryFnType)

Binary function attribute definition.

Binary function attributes provide a way to make the arithmetic computation parametrizable. Every attribute specifies a default binary function that may be overwritten at operation instantiation time.

operand_def
__call__(arg0: TensorExpression, arg1: TensorExpression) TensorFn
__getitem__(reduce_dims: mlir.dialects.linalg.opdsl.lang.scalar_expr.Tuple[mlir.dialects.linalg.opdsl.lang.scalar_expr.DimDef]) ReduceFnUse
class mlir.dialects.linalg.TernaryFnAttrDef(default: TernaryFnType)

Ternary function attribute definition.

Ternary function attributes provide a way to make the arithmetic computation parametrizable. Every attribute specifies a default Ternary function that may be overwritten at operation instantiation time.

operand_def
__call__(arg0: TensorExpression, arg1: TensorExpression) TensorFn
__getitem__(reduce_dims: mlir.dialects.linalg.opdsl.lang.scalar_expr.Tuple[mlir.dialects.linalg.opdsl.lang.scalar_expr.DimDef]) ReduceFnUse
class mlir.dialects.linalg.TypeFnAttrDef(default: TypeFnType)

Type conversion function attribute definition.

Type conversion function attributes provide a way to make type conversions parameterizable. Every attribute specifies a default type conversion function that may be overwritten at operation instantiation time.

operand_def
__call__(type_var: mlir.dialects.linalg.opdsl.lang.types.TypeVar, arg: TensorExpression) TensorFn
class mlir.dialects.linalg.Comprehension(*bindings: mlir.dialects.linalg.opdsl.lang.scalar_expr.Tuple[TensorUse, TensorExpression])

Represents a single comprehension.

definitions = []
values = []
property all_reduction_dims: mlir.dialects.linalg.opdsl.lang.scalar_expr.Set[mlir.dialects.linalg.opdsl.lang.scalar_expr.Tuple[mlir.dialects.linalg.opdsl.lang.scalar_expr.DimDef, Ellipsis]]

Gets the reduction dims for the comprehension or None.

__repr__()
class mlir.dialects.linalg.OpInterfaceDef(cpp_name: str)

An interface that an op implements.

cpp_name
mlir.dialects.linalg.ContractionOpInterface
mlir.dialects.linalg.ConvolutionOpInterface
mlir.dialects.linalg.FillOpInterface
class mlir.dialects.linalg.OpDefinitionDef(def_name: str)

A method that an op implements.

def_name
mlir.dialects.linalg.Canonicalizer
class mlir.dialects.linalg.OpMetadataDef(name: str, cpp_class_name: mlir.dialects.linalg.opdsl.lang.scalar_expr.Optional[str], doc: mlir.dialects.linalg.opdsl.lang.scalar_expr.Optional[str])

Bases: mlir.dialects.linalg.opdsl.lang.yaml_helper.YAMLObject

Metadata about the op (generally not behavior impacting).

yaml_tag = '!LinalgOpMetadata'
name
cpp_class_name
doc
implements: mlir.dialects.linalg.opdsl.lang.scalar_expr.List[OpInterfaceDef] = []
defines: mlir.dialects.linalg.opdsl.lang.scalar_expr.List[OpDefinitionsDef] = []
to_yaml_custom_dict()
class mlir.dialects.linalg.LinalgOpDef(name: str, cpp_class_name: mlir.dialects.linalg.opdsl.lang.scalar_expr.Optional[str] = None, doc: mlir.dialects.linalg.opdsl.lang.scalar_expr.Optional[str] = None)

Definition of a linalg op.

metadata
registered_operands: mlir.dialects.linalg.opdsl.lang.types.Dict[str, OperandDef]
domain: mlir.dialects.linalg.opdsl.lang.scalar_expr.List[mlir.dialects.linalg.opdsl.lang.scalar_expr.DimDef] = []
comprehensions: mlir.dialects.linalg.opdsl.lang.scalar_expr.List[Comprehension] = []
_affine_state
add_operand(name: str, operand: OperandDef)

Registers an operand.

__repr__()
class mlir.dialects.linalg.AffineBuildState(*, global_state: AffineBuildState = None, allow_new_symbols: bool = True, allow_new_dims: bool = True)

Internal state for the AffineExprDef._create impls.

Note that a “local” AffineBuildState can be created relative to a “global” AffineBuildState. In that case, any affine expressions built will inherit symbol and dim bindings from the global state and will update both as new ones are discovered. This allows for building expressions across contexts which share a common symbol and dim space.

local_symbols: Dict[str, int]
local_dims: Dict[str, int]
allow_new_symbols = True
allow_new_dims = True
get_dim(dimname: str) int

Gets the dim position given a name.

get_symbol(symname: str) int

Geta a symbol position given a name.

property local_dim_count: int
property local_symbol_count: int
property dim_count: int
property symbol_count: int
__repr__()
class mlir.dialects.linalg.AffineExprDef

Base class for an affine expression being defined.

build(state: AffineBuildState | None = None) mlir.ir.AffineExpr

Builds the corresponding _ir.AffineExpr from the definitions.

abstract _create(state: AffineBuildState) mlir.ir.AffineExpr
static coerce_from(py_value)
visit_affine_exprs(callback)

Visits all AffineExprDefs including self.

__add__(rhs)
__mul__(rhs)
__mod__(rhs)
__floordiv__(rhs)
__truediv__(rhs)
mlir.dialects.linalg.D
class mlir.dialects.linalg.DimDef

Bases: AffineExprDef

Represents a named dimension.

ALL_DIMS: Dict[str, DimDef]
__repr__()
_create(state: AffineBuildState) mlir.ir.AffineExpr
classmethod create_expando()

Create an expando class that creates unique symbols based on attr access.

mlir.dialects.linalg.S
class mlir.dialects.linalg.SymbolDef

Bases: AffineExprDef

Represents a named symbol.

s1 = SymbolDef(“s1”) s1 Symbol(s1) s2 = SymbolDef(“s2”) s1 is s2 False s1 is SymbolDef(“s1”) True

ALL_SYMBOLS: Dict[str, SymbolDef]
__repr__()
_create(state: AffineBuildState) mlir.ir.AffineExpr
classmethod create_expando()

Create an expando class that creates unique symbols based on attr access.

class mlir.dialects.linalg.ScalarAssign(arg: str, value: ScalarExpression)

Bases: mlir.dialects.linalg.opdsl.lang.yaml_helper.YAMLObject

An assignment to a named argument (LHS of a comprehension).

yaml_tag = '!ScalarAssign'
arg
value
to_yaml_custom_dict()
__repr__()
class mlir.dialects.linalg.ScalarFn(kind: mlir.dialects.linalg.opdsl.lang.comprehension.FunctionKind, fn_name: mlir.dialects.linalg.opdsl.lang.comprehension.Optional[str], attr_name: mlir.dialects.linalg.opdsl.lang.comprehension.Optional[str], type_var: mlir.dialects.linalg.opdsl.lang.comprehension.Optional[mlir.dialects.linalg.opdsl.lang.types.TypeVar], operands: mlir.dialects.linalg.opdsl.lang.comprehension.Sequence[ScalarExpression])

A type of ScalarExpression that applies a function.

kind
fn_name
attr_name
type_var
operands
expr() ScalarExpression
__repr__()
class mlir.dialects.linalg.ScalarArg(arg: str)

A type of ScalarExpression that references a named argument.

arg
expr() ScalarExpression
__repr__()
class mlir.dialects.linalg.ScalarConst(value: str)

A type of ScalarExpression representing a constant.

value
expr() ScalarExpression
__repr__()
class mlir.dialects.linalg.ScalarIndex(dim: int)

A type of ScalarExpression accessing an iteration index.

dim
expr() ScalarExpression
__repr__()
class mlir.dialects.linalg.ScalarExpression(scalar_fn: mlir.dialects.linalg.opdsl.lang.comprehension.Optional[ScalarFn] = None, scalar_arg: mlir.dialects.linalg.opdsl.lang.comprehension.Optional[ScalarArg] = None, scalar_const: mlir.dialects.linalg.opdsl.lang.comprehension.Optional[ScalarConst] = None, scalar_index: mlir.dialects.linalg.opdsl.lang.comprehension.Optional[ScalarIndex] = None)

Bases: mlir.dialects.linalg.opdsl.lang.yaml_helper.YAMLObject

An expression on scalar values.

Can be one of:

  • ScalarFn

  • ScalarArg

  • ScalarConst

  • ScalarIndex

yaml_tag = '!ScalarExpression'
scalar_fn = None
scalar_arg = None
scalar_const = None
scalar_index = None
to_yaml_custom_dict()
class mlir.dialects.linalg.TypeVar

A replaceable type variable.

Type variables are uniqued by name.

ALL_TYPEVARS: Dict[str, TypeVar]
__repr__()
classmethod create_expando()

Create an expando class that creates unique type vars on attr access.

mlir.dialects.linalg.TV
mlir.dialects.linalg.I32
mlir.dialects.linalg.I64
mlir.dialects.linalg.F32
mlir.dialects.linalg.F64
mlir.dialects.linalg.T
mlir.dialects.linalg.U
mlir.dialects.linalg.V
mlir.dialects.linalg.yaml_dump(data, sort_keys=False, **kwargs)
mlir.dialects.linalg.yaml_dump_all(data, sort_keys=False, explicit_start=True, **kwargs)
class mlir.dialects.linalg.YAMLObject

Bases: yaml.YAMLObject

An object that can dump itself to a YAML stream and load itself from a YAML stream.

classmethod to_yaml(dumper, self)

Default to a custom dictionary mapping.

abstract to_yaml_custom_dict()
as_linalg_yaml()
class mlir.dialects.linalg.LinalgStructuredOpConfig(comprehension: mlir.dialects.linalg.opdsl.lang.comprehension.Comprehension, domain: mlir.dialects.linalg.opdsl.lang.comprehension.Sequence[mlir.dialects.linalg.opdsl.lang.comprehension.DimDef], registered_operands: mlir.dialects.linalg.opdsl.lang.comprehension.Sequence[mlir.dialects.linalg.opdsl.lang.comprehension.OperandDef], context: mlir.dialects.linalg.opdsl.lang.comprehension.Optional[mlir.ir.Context] = None)

Bases: mlir.dialects.linalg.opdsl.lang.yaml_helper.YAMLObject

Configuration for metadata sufficient to construct a linalg named op.

yaml_tag = '!LinalgStructuredOpConfig'
context = None
affine_state
writes: mlir.dialects.linalg.opdsl.lang.comprehension.List[mlir.dialects.linalg.opdsl.lang.comprehension.Tuple[mlir.dialects.linalg.opdsl.lang.comprehension.TensorUse, mlir.dialects.linalg.opdsl.lang.comprehension.TensorExpression]] = []
operands: mlir.dialects.linalg.opdsl.lang.comprehension.Dict[mlir.dialects.linalg.opdsl.lang.comprehension.OperandDef, OperandDefConfig]
uses: mlir.dialects.linalg.opdsl.lang.comprehension.Dict[mlir.dialects.linalg.opdsl.lang.comprehension.TensorUse, TensorUseConfig]
reduction_dims
assignments
property ordered_operands: mlir.dialects.linalg.opdsl.lang.comprehension.Sequence[OperandDefConfig]
property ordered_dims: mlir.dialects.linalg.opdsl.lang.comprehension.Sequence[mlir.dialects.linalg.opdsl.lang.comprehension.Tuple[str, int]]

Gets the ordered list of dim bindings (symbolic name, position).

TODO: The original parser relies on parse ordering to arrive at the iterator types, but that ordering is not defined on the Python side, so this may be ambiguous.

property indexing_maps: mlir.dialects.linalg.opdsl.lang.comprehension.Sequence[mlir.ir.AffineMap]
property iterator_types: mlir.dialects.linalg.opdsl.lang.comprehension.Sequence[str]
add_operand(operand_def: mlir.dialects.linalg.opdsl.lang.comprehension.OperandDef)
add_indexed_operand(operand_def: mlir.dialects.linalg.opdsl.lang.comprehension.OperandDef)
add_tensor_use(tensor_use: mlir.dialects.linalg.opdsl.lang.comprehension.TensorUse)
_get_scalar_map() mlir.ir.AffineMap

Create an empty affine map used to index a scalar.

_normalize_affine_map(affine_map: mlir.ir.AffineMap, with_dims: bool = True) mlir.ir.AffineMap

Normalizes an indexing map to have the max known symbols and dims.

to_yaml_custom_dict()
__repr__()
class mlir.dialects.linalg.LinalgOpConfig(metadata: mlir.dialects.linalg.opdsl.lang.comprehension.OpMetadataDef, *, structured_op: mlir.dialects.linalg.opdsl.lang.comprehension.Optional[LinalgStructuredOpConfig] = None)

Bases: mlir.dialects.linalg.opdsl.lang.yaml_helper.YAMLObject

Container for any supported linalg op type.

This includes the concrete type by name for ease of parsing by systems that ignore tags.

yaml_tag = '!LinalgOpConfig'
metadata
structured_op = None
to_yaml_custom_dict()
static from_linalg_op_def(op_def: mlir.dialects.linalg.opdsl.lang.comprehension.LinalgOpDef, context: mlir.dialects.linalg.opdsl.lang.comprehension.Optional[mlir.ir.Context] = None) mlir.dialects.linalg.opdsl.lang.comprehension.Sequence[LinalgOpConfig]

Expands a LinalgOpDef into corresponding Linalg configured ops.

__repr__()
class mlir.dialects.linalg.OperandDefConfig(operand_def: mlir.dialects.linalg.opdsl.lang.comprehension.OperandDef, shape_map: mlir.dialects.linalg.opdsl.lang.comprehension.Optional[mlir.ir.AffineMap] = None, index_attr_map: mlir.dialects.linalg.opdsl.lang.comprehension.Optional[mlir.ir.AffineMap] = None)

Bases: mlir.dialects.linalg.opdsl.lang.yaml_helper.YAMLObject

Wrapper containing an operand definition with additional state.

yaml_tag = '!LinalgOperandDefConfig'
operand_def
shape_map: mlir.dialects.linalg.opdsl.lang.comprehension.Optional[mlir.ir.AffineMap] = None
index_attr_map: mlir.dialects.linalg.opdsl.lang.comprehension.Optional[mlir.ir.AffineMap] = None
indexing_map: mlir.dialects.linalg.opdsl.lang.comprehension.Optional[mlir.ir.AffineMap] = None
property name: str
property kind: mlir.dialects.linalg.opdsl.lang.comprehension.OperandKind
property type_var: mlir.dialects.linalg.opdsl.lang.comprehension.TypeVar
to_yaml_custom_dict()
__repr__()
mlir.dialects.linalg.emit_generic_structured_op(op_config: mlir.dialects.linalg.opdsl.lang.config.LinalgStructuredOpConfig, *ins: Value, outs: ValueList, **attrs: mlir.dialects.linalg.opdsl.lang.comprehension.Sequence[int])
mlir.dialects.linalg.emit_named_structured_op(op_config: mlir.dialects.linalg.opdsl.lang.config.LinalgStructuredOpConfig, op_name: str, op_class_name: str, *ins: Value, outs: ValueList, **attrs: mlir.dialects.linalg.opdsl.lang.comprehension.Sequence[int])
mlir.dialects.linalg.ValueList
class mlir.dialects.linalg._GlobalDebug
flag: bool = Ellipsis

LLVM-wide debug flag.

static set_types(types: str) None
static set_types(types: collections.abc.Sequence[str]) None

Sets multiple specific debug types to be produced by LLVM.

class mlir.dialects.linalg._OperationBase
property _CAPIPtr: object

Gets a capsule wrapping the MlirOperation.

__eq__(arg: _OperationBase, /) bool
__eq__(arg: object, /) bool

Compares operation with non-operation object (always returns False).

__hash__() int

Returns the hash value of the operation.

is_structurally_equivalent(other: _OperationBase, flags: OperationEquivalenceFlags = OperationEquivalenceFlags.NONE) bool

“Checks whether two operations are structurally equivalent. The predicate recursively compares regions.”

structural_hash(flags: OperationEquivalenceFlags = OperationEquivalenceFlags.NONE) int

Computes a structural hash for the operation. The hash does not recurse into regions, unlike the predicate.”

property attributes: OpAttributeMap

Returns a dictionary-like map of operation attributes.

property context: Context

Context that owns the operation.

property name: str

Returns the fully qualified name of the operation.

property operands: OpOperandList

Returns the list of operation operands.

property op_operands: OpOperands

Returns the list of op operands.

property regions: RegionSequence

Returns the list of operation regions.

property results: OpResultList

Returns the list of Operation results.

property result: OpResult

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

property location: Location

Returns the source location the operation was defined or derived from.

property parent: Operation | None

Returns the parent operation, or None if at top level.

__str__() str

Returns the assembly form of the operation.

print(state: AsmState, file: object | None = None, binary: bool = False) None
print(large_elements_limit: int | None = None, large_resource_limit: int | None = None, enable_debug_info: bool = False, pretty_debug_info: bool = False, print_generic_op_form: bool = False, use_local_scope: bool = False, use_name_loc_as_prefix: bool = False, assume_verified: bool = False, file: object | None = None, binary: bool = False, skip_regions: bool = False) None

Prints the assembly form of the operation to a file like object.

Parameters:
  • large_elements_limit – Whether to elide elements attributes above this number of elements. Defaults to None (no limit).

  • large_resource_limit – Whether to elide resource attributes above this number of characters. Defaults to None (no limit). If large_elements_limit is set and this is None, the behavior will be to use large_elements_limit as large_resource_limit.

  • enable_debug_info – Whether to print debug/location information. Defaults to False.

  • pretty_debug_info – Whether to format debug information for easier reading by a human (warning: the result is unparseable). Defaults to False.

  • print_generic_op_form – Whether to print the generic assembly forms of all ops. Defaults to False.

  • use_local_scope – Whether to print in a way that is more optimized for multi-threaded access but may not be consistent with how the overall module prints.

  • use_name_loc_as_prefix – Whether to use location attributes (NameLoc) as prefixes for the SSA identifiers. Defaults to False.

  • assume_verified – By default, if not printing generic form, the verifier will be run and if it fails, generic form will be printed with a comment about failed verification. While a reasonable default for interactive use, for systematic use, it is often better for the caller to verify explicitly and report failures in a more robust fashion. Set this to True if doing this in order to avoid running a redundant verification. If the IR is actually invalid, behavior is undefined.

  • file – The file like object to write to. Defaults to sys.stdout.

  • binary – Whether to write bytes (True) or str (False). Defaults to False.

  • skip_regions – Whether to skip printing regions. Defaults to False.

write_bytecode(file: object, desired_version: int | None = None) None

Write the bytecode form of the operation to a file like object.

Parameters:
  • file – The file like object to write to.

  • desired_version – Optional version of bytecode to emit.

Returns:

The bytecode writer status.

get_asm(binary: bool = False, large_elements_limit: int | None = None, large_resource_limit: int | None = None, enable_debug_info: bool = False, pretty_debug_info: bool = False, print_generic_op_form: bool = False, use_local_scope: bool = False, use_name_loc_as_prefix: bool = False, assume_verified: bool = False, skip_regions: bool = False) object

Gets the assembly form of the operation with all options available.

Parameters:
  • binary – Whether to return a bytes (True) or str (False) object. Defaults to False.

  • ... (... others) – See the print() method for common keyword arguments for configuring the printout.

Returns:

Either a bytes or str object, depending on the setting of the binary argument.

verify() bool

Verify the operation. Raises MLIRError if verification fails, and returns true otherwise.

move_after(other: _OperationBase) None

Puts self immediately after the other operation in its parent block.

move_before(other: _OperationBase) None

Puts self immediately before the other operation in its parent block.

is_before_in_block(other: _OperationBase) bool

Checks if this operation is before another in the same block.

Parameters:

other – Another operation in the same parent block.

Returns:

True if this operation is before other in the operation list of the parent block.

clone(ip: object | None = None) Operation

Creates a deep copy of the operation.

Parameters:

ip – Optional insertion point where the cloned operation should be inserted. If None, the current insertion point is used. If False, the operation remains detached.

Returns:

A new Operation that is a clone of this operation.

detach_from_parent() OpView

Detaches the operation from its parent block.

property attached: bool

Reports if the operation is attached to its parent block.

erase() None

Erases the operation and frees its memory.

Note: After erasing, any Python references to the operation become invalid.

walk(callback: collections.abc.Callable[[Operation], WalkResult], walk_order: WalkOrder = ..., op_class: type[OpView] | None = None) None

Walks the operation tree with a callback function.

If op_class is provided, the callback is only invoked on operations of that type; all other operations are skipped silently.

Parameters:
  • callback – A callable that takes an Operation and returns a WalkResult.

  • walk_order – The order of traversal (PRE_ORDER or POST_ORDER).

  • op_class – If provided, only operations of this type are passed to the callback.

has_trait(trait_cls: type) bool

Checks if the operation has a given trait.

mlir.dialects.linalg.register_type_caster(typeid: ir.TypeID, *, replace: bool = False) collections.abc.Callable[[collections.abc.Callable[[T], U]], collections.abc.Callable[[T], U]]

Register a type caster for casting MLIR types to custom user types.

mlir.dialects.linalg.register_value_caster(typeid: ir.TypeID, *, replace: bool = False) collections.abc.Callable[[collections.abc.Callable[[T], U]], collections.abc.Callable[[T], U]]

Register a value caster for casting MLIR values to custom user values.

mlir.dialects.linalg._globals: _Globals = Ellipsis
class mlir.dialects.linalg.OnExplicitAction

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

USE_EXPLICIT = 0
USE_TRACEBACK = 1
class mlir.dialects.linalg.CurrentLocAction

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

FALLBACK = 0
NAMELOC_WRAP = 1
mlir.dialects.linalg.get_dialect_registry()
mlir.dialects.linalg.append_load_on_create_dialect(dialect: str)
mlir.dialects.linalg.get_load_on_create_dialects()
mlir.dialects.linalg.get_parent_of_type(op: OpView | Operation, op_class: type[OpView]) OpView | None

Return the closest enclosing parent operation of the given type.

Walks the parent chain of op and returns the first ancestor that is an instance of op_class. Returns None if no matching parent is found.

Parameters:
  • op – The starting operation.

  • op_class – The OpView subclass to search for (e.g. func.FuncOp).

mlir.dialects.linalg.get_ops_of_type(root: OpView | Operation | Module, op_class: type[OpView] | None = None) list[OpView]

Return all operations of the given type in the operation tree.

Parameters:
  • root – The operation or module to start traversing from.

  • op_class – The OpView subclass to filter by (e.g. func.FuncOp). If None, collects all operations in the tree.

Returns:

A list of operations of the given type.

mlir.dialects.linalg.loc_tracebacks(*, max_depth: int | None = None, on_explicit_actn: mlir._mlir_libs._mlir.OnExplicitAction = OnExplicitAction.USE_EXPLICIT, current_loc_actn: mlir._mlir_libs._mlir.CurrentLocAction = CurrentLocAction.FALLBACK) collections.abc.Generator[None, None, 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.

  • on_explicit_actn

    Policy when an explicit loc= is passed to an op constructor. OnExplicitAction.USE_EXPLICIT (default) — use loc= as base, skip

    traceback.

    OnExplicitAction.USE_TRACEBACK — discard loc=, generate traceback.

  • current_loc_actn

    Policy for composing Location.current with the result. CurrentLocAction.FALLBACK (default) — use Location.current only as

    fallback.

    CurrentLocAction.NAMELOC_WRAP — extract NameLoc names from

    Location.current and wrap the computed location with them.

mlir.dialects.linalg.register_attribute_builder(kind, replace=False, allow_existing=False)
mlir.dialects.linalg._affineMapAttr(x, context)
mlir.dialects.linalg._integerSetAttr(x, context)
mlir.dialects.linalg._boolAttr(x, context)
mlir.dialects.linalg._dictAttr(x, context)
mlir.dialects.linalg._indexAttr(x, context)
mlir.dialects.linalg._i1Attr(x, context)
mlir.dialects.linalg._i8Attr(x, context)
mlir.dialects.linalg._i16Attr(x, context)
mlir.dialects.linalg._i32Attr(x, context)
mlir.dialects.linalg._i64Attr(x, context)
mlir.dialects.linalg._si1Attr(x, context)
mlir.dialects.linalg._si8Attr(x, context)
mlir.dialects.linalg._si16Attr(x, context)
mlir.dialects.linalg._si32Attr(x, context)
mlir.dialects.linalg._si64Attr(x, context)
mlir.dialects.linalg._ui1Attr(x, context)
mlir.dialects.linalg._ui8Attr(x, context)
mlir.dialects.linalg._ui16Attr(x, context)
mlir.dialects.linalg._ui32Attr(x, context)
mlir.dialects.linalg._ui64Attr(x, context)
mlir.dialects.linalg._f32Attr(x, context)
mlir.dialects.linalg._f64Attr(x, context)
mlir.dialects.linalg._stringAttr(x, context)
mlir.dialects.linalg._symbolNameAttr(x, context)
mlir.dialects.linalg._symbolRefAttr(x, context)
mlir.dialects.linalg._flatSymbolRefAttr(x, context)
mlir.dialects.linalg._unitAttr(x, context)
mlir.dialects.linalg._arrayAttr(x, context)
mlir.dialects.linalg._affineMapArrayAttr(x, context)
mlir.dialects.linalg._boolArrayAttr(x, context)
mlir.dialects.linalg._dictArrayAttr(x, context)
mlir.dialects.linalg._flatSymbolRefArrayAttr(x, context)
mlir.dialects.linalg._i32ArrayAttr(x, context)
mlir.dialects.linalg._i64ArrayAttr(x, context)
mlir.dialects.linalg._i64SmallVectorArrayAttr(x, context)
mlir.dialects.linalg._indexListArrayAttr(x, context)
mlir.dialects.linalg._f32ArrayAttr(x, context)
mlir.dialects.linalg._f64ArrayAttr(x, context)
mlir.dialects.linalg._strArrayAttr(x, context)
mlir.dialects.linalg._symbolRefArrayAttr(x, context)
mlir.dialects.linalg._denseF32ArrayAttr(x, context)
mlir.dialects.linalg._denseF64ArrayAttr(x, context)
mlir.dialects.linalg._denseI8ArrayAttr(x, context)
mlir.dialects.linalg._denseI16ArrayAttr(x, context)
mlir.dialects.linalg._denseI32ArrayAttr(x, context)
mlir.dialects.linalg._denseI64ArrayAttr(x, context)
mlir.dialects.linalg._denseBoolArrayAttr(x, context)
mlir.dialects.linalg._typeAttr(x, context)
mlir.dialects.linalg._typeArrayAttr(x, context)
mlir.dialects.linalg._memref_type_attr(x, context)
mlir.dialects.linalg._f64ElementsAttr(x, context)
class mlir.dialects.linalg.DiagnosticSeverity

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

ERROR = 0
WARNING = 1
NOTE = 2
REMARK = 3
class mlir.dialects.linalg.WalkOrder

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

PRE_ORDER = 0
POST_ORDER = 1
class mlir.dialects.linalg.OperationEquivalenceFlags

Bases: enum.IntFlag

Support for integer-based Flags

NONE = 0
IGNORE_LOCATIONS = 1
IGNORE_DISCARDABLE_ATTRS = 2
IGNORE_PROPERTIES = 4
IGNORE_COMMUTATIVITY = 8
class mlir.dialects.linalg.WalkResult

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

ADVANCE = 0
INTERRUPT = 1
SKIP = 2
class mlir.dialects.linalg.Diagnostic
property severity: DiagnosticSeverity

Returns the severity of the diagnostic.

property location: Location

Returns the location associated with the diagnostic.

property message: str

Returns the message text of the diagnostic.

property notes: tuple[Diagnostic]

Returns a tuple of attached note diagnostics.

__str__() str

Returns the diagnostic message as a string.

class mlir.dialects.linalg.DiagnosticInfo(diag: Diagnostic)
property severity: DiagnosticSeverity

The severity level of the diagnostic.

property location: Location

The location associated with the diagnostic.

property message: str

The message text of the diagnostic.

property notes: list[DiagnosticInfo]

List of attached note diagnostics.

__str__() str

Returns the diagnostic message as a string.

class mlir.dialects.linalg.DiagnosticHandler
detach() None

Detaches the diagnostic handler from the context.

property attached: bool

Returns True if the handler is attached to a context.

property had_error: bool

Returns True if an error was encountered during diagnostic handling.

__enter__(/) DiagnosticHandler

Enters the diagnostic handler as a context manager.

__exit__(exc_type: object | None, exc_value: object | None, traceback: object | None) None

Exits the diagnostic handler context manager.

class mlir.dialects.linalg.ThreadPool
get_max_concurrency() int

Returns the maximum number of threads in the pool.

_mlir_thread_pool_ptr() str

Returns the raw pointer to the LLVM thread pool as a string.

class mlir.dialects.linalg.Context
static _get_live_count() int

Gets the number of live Context objects.

_get_context_again() Context

Gets another reference to the same context.

_get_live_module_count() int

Gets the number of live modules owned by this context.

property _CAPIPtr: object

Gets a capsule wrapping the MlirContext.

static _CAPICreate(arg: object, /) object

Creates a Context from a capsule wrapping MlirContext.

__enter__(/) Context

Enters the context as a context manager.

__exit__(exc_type: object | None, exc_value: object | None, traceback: object | None) None

Exits the context manager.

current: Context | None = Ellipsis

Gets the Context bound to the current thread or returns None if no context is set.

property dialects: Dialects

Gets a container for accessing dialects by name.

property d: Dialects

Alias for dialects.

get_dialect_descriptor(dialect_name: str) DialectDescriptor

Gets or loads a dialect by name, returning its descriptor object.

is_dialect_loaded(dialect_name: str) bool

Checks if a dialect is loaded in the context.

property allow_unregistered_dialects: bool

Controls whether unregistered dialects are allowed in this context.

attach_diagnostic_handler(callback: object) object

Attaches a diagnostic handler that will receive callbacks.

enable_multithreading(enable: bool) None

Enables or disables multi-threading support in the context.

Parameters:

enable – Whether to enable (True) or disable (False) multi-threading.

set_thread_pool(arg: ThreadPool, /) None

Sets a custom thread pool for the context to use.

Parameters:

pool – A ThreadPool object to use for parallel operations.

Note

Multi-threading is automatically disabled before setting the thread pool.

get_num_threads() int

Gets the number of threads in the context’s thread pool.

_mlir_thread_pool_ptr() str

Gets the raw pointer to the LLVM thread pool as a string.

is_registered_operation(operation_name: str) bool

Checks whether an operation with the given name is registered.

Parameters:

operation_name – The fully qualified name of the operation (e.g., arith.addf).

Returns:

True if the operation is registered, False otherwise.

append_dialect_registry(registry: DialectRegistry) None

Appends the contents of a dialect registry to the context.

Parameters:

registry – A DialectRegistry containing dialects to append.

property emit_error_diagnostics: bool

Controls whether error diagnostics are emitted to diagnostic handlers.

By default, error diagnostics are captured and reported through MLIRError exceptions.

load_all_available_dialects() None

Loads all dialects available in the registry into the context.

This eagerly loads all dialects that have been registered, making them immediately available for use.

begin_transient_scope() None

Begins a transient scope on the context, freezing the base layer.

All subsequently allocated types, attributes, and unregistered operations are treated as transient and will be deallocated with end_transient_scope(). Raises a ValueError if the context is already in a transient scope.

end_transient_scope() None

Ends the transient scope and resets the context to the base state.

Prunes all transient types, attributes, affine expressions, distinct attributes, and unregistered operations added during the transient scope.

Note: Any Python objects referencing transient IR entities become invalid after this call and must not be accessed.

property is_in_transient_scope: bool

Returns whether the context is currently in a transient scope.

class mlir.dialects.linalg.DialectDescriptor
property namespace: str

Returns the namespace of the dialect.

__repr__() str

Returns a string representation of the dialect descriptor.

class mlir.dialects.linalg.Dialects
__getitem__(arg: str, /) object

Gets a dialect by name using subscript notation.

__getattr__(arg: str, /) object

Gets a dialect by name using attribute notation.

class mlir.dialects.linalg.Dialect(descriptor: object)
property descriptor: object

Returns the DialectDescriptor for this dialect.

__repr__() str

Returns a string representation of the dialect.

class mlir.dialects.linalg.DialectRegistry
property _CAPIPtr: object

Gets a capsule wrapping the MlirDialectRegistry.

static _CAPICreate(arg: object, /) DialectRegistry

Creates a DialectRegistry from a capsule wrapping MlirDialectRegistry.

class mlir.dialects.linalg.Location
property _CAPIPtr: object

Gets a capsule wrapping the MlirLocation.

static _CAPICreate(arg: object, /) Location

Creates a Location from a capsule wrapping MlirLocation.

__enter__(/) Location

Enters the location as a context manager.

__exit__(exc_type: object | None, exc_value: object | None, traceback: object | None) None

Exits the location context manager.

__eq__(arg: Location, /) bool
__eq__(arg: object, /) bool

Compares location with non-location object (always returns False).

current: Location | None = Ellipsis

Gets the Location bound to the current thread or raises ValueError.

static from_attr(attribute: Attribute, context: Context | None = None) Location

Gets a Location from a LocationAttr.

static unknown(context: Context | None = None) UnknownLoc

Alias for UnknownLoc.get().

static file(filename: str, line: int, col: int, context: Context | None = None) FileLineColLoc
static file(filename: str, start_line: int, start_col: int, end_line: int, end_col: int, context: Context | None = None) FileLineColLoc

Alias for FileLineColLoc.get() over a range.

static name(name: str, childLoc: Location | None = None, context: Context | None = None) NameLoc

Alias for NameLoc.get().

static callsite(callee: Location, frames: collections.abc.Sequence[Location], context: Context | None = None) CallSiteLoc

Alias for CallSiteLoc.get().

static fused(locations: collections.abc.Sequence[Location], metadata: Attribute | None = None, context: Context | None = None) Location

Alias for FusedLoc.get() (may collapse to a non-fused location).

property context: Context

Context that owns the Location.

property attr: Attribute

Get the underlying LocationAttr.

property typeid: TypeID

Gets the TypeID of the underlying LocationAttr.

emit_error(message: str) None

Emits an error diagnostic at this location.

Parameters:

message – The error message to emit.

__str__() str

Returns the assembly form of the Location.

__repr__() str

Returns the assembly representation of the location.

class mlir.dialects.linalg.UnknownLoc(cast_from_loc: Location)

Bases: Location

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> mlir::python::mlir::PyTypeID

__repr__() str

Returns the assembly representation of the location.

static get(context: Context | None = None) UnknownLoc

Gets a Location representing an unknown location.

class mlir.dialects.linalg.FileLineColLoc(cast_from_loc: Location)

Bases: Location

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> mlir::python::mlir::PyTypeID

__repr__() str

Returns the assembly representation of the location.

static get(filename: str, line: int, col: int, context: Context | None = None) FileLineColLoc
static get(filename: str, start_line: int, start_col: int, end_line: int, end_col: int, context: Context | None = None) FileLineColLoc

Gets a FileLineColLoc spanning a file and line/column range.

property filename: str

Gets the filename from a FileLineColLoc.

property start_line: int

Gets the start line number from a FileLineColLoc.

property start_col: int

Gets the start column number from a FileLineColLoc.

property end_line: int

Gets the end line number from a FileLineColLoc.

property end_col: int

Gets the end column number from a FileLineColLoc.

class mlir.dialects.linalg.NameLoc(cast_from_loc: Location)

Bases: Location

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> mlir::python::mlir::PyTypeID

__repr__() str

Returns the assembly representation of the location.

static get(name: str, child_loc: Location | None = None, context: Context | None = None) NameLoc

Gets a NameLoc with an optional child location.

property name_str: str

Gets the name string from a NameLoc.

property child_loc: Location

Gets the child location from a NameLoc.

class mlir.dialects.linalg.CallSiteLoc(cast_from_loc: Location)

Bases: Location

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> mlir::python::mlir::PyTypeID

__repr__() str

Returns the assembly representation of the location.

static get(callee: Location, frames: collections.abc.Sequence[Location], context: Context | None = None) CallSiteLoc

Gets a CallSiteLoc chaining a callee and one or more caller frames.

property callee: Location

Gets the callee location from a CallSiteLoc.

property caller: Location

Gets the caller location from a CallSiteLoc.

class mlir.dialects.linalg.FusedLoc(cast_from_loc: Location)

Bases: Location

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> mlir::python::mlir::PyTypeID

__repr__() str

Returns the assembly representation of the location.

static get(locations: collections.abc.Sequence[Location], metadata: Attribute | None = None, context: Context | None = None) FusedLoc

Gets a FusedLoc from an array of locations and optional metadata. Raises if the fuse would collapse to a non-fused location; use Location.fused(...) for the permissive variant.

property locations: list[object]

Gets the list of locations from a FusedLoc.

property metadata: Attribute | None

Gets the metadata attribute from a FusedLoc, or None if absent.

class mlir.dialects.linalg.Module
property _CAPIPtr: object

Gets a capsule wrapping the MlirModule.

static _CAPICreate(arg: object, /) object

Creates a Module from a MlirModule wrapped by a capsule (i.e. module._CAPIPtr).

This returns a new object BUT _clear_mlir_module(module) must be called to prevent double-frees (of the underlying mlir::Module).

_clear_mlir_module() None

Clears the internal MLIR module reference.

This is used internally to prevent double-free when ownership is transferred via the C API capsule mechanism. Not intended for normal use.

static parse(asm: str, context: Context | None = None) Module
static parse(asm: bytes, context: Context | None = None) Module
static parseFile(path: str, context: Context | None = None) Module

Parses a module’s assembly format from a string.

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

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

static create(loc: Location | None = None) Module

Creates an empty module.

property context: Context

Context that created the Module.

property operation: Operation

Accesses the module as an operation.

property body: Block

Return the block for this module.

dump() None

Dumps a debug representation of the object to stderr.

__str__() str

Gets the assembly form of the operation with default options.

If more advanced control over the assembly formatting or I/O options is needed, use the dedicated print or get_asm method, which supports keyword arguments to customize behavior.

__eq__(other: Module) bool

Compares two modules for equality.

__hash__() int

Returns the hash value of the module.

class mlir.dialects.linalg.Operation

Bases: _OperationBase

static create(name: str, results: collections.abc.Sequence[Type] | None = None, operands: collections.abc.Sequence[Value] | None = None, attributes: dict[str, Attribute] | None = None, successors: collections.abc.Sequence[Block] | None = None, regions: int = 0, loc: Location | None = None, ip: object | None = None, infer_type: bool = False) Operation

Creates a new operation.

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

  • results – Optional sequence of Type representing op result types.

  • operands – Optional operands of the operation.

  • attributes – Optional Dict of {str: Attribute}.

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

  • regions – Number of regions to create (default = 0).

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

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

  • infer_type – Whether to infer result types (default = False).

Returns:

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

static parse(source: str, *, source_name: str = '', context: Context | None = None) OpView

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

property _CAPIPtr: object

Gets a capsule wrapping the MlirOperation.

static _CAPICreate(arg: object, /) object

Creates an Operation from a capsule wrapping MlirOperation.

property operation: Operation

Returns self (the operation).

property opview: 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.

property block: Block

Returns the block containing this operation.

property successors: OpSuccessors

Returns the list of Operation successors.

replace_uses_of_with(of: Value, with_: Value) None

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

_set_invalid() None

Invalidate the operation.

class mlir.dialects.linalg.OpView(operation: Operation)
class mlir.dialects.linalg.OpView(name: str, opRegionSpec: tuple[int, bool], operandSegmentSpecObj: object | None = None, resultSegmentSpecObj: object | None = None, results: collections.abc.Sequence | None = None, operands: collections.abc.Sequence | None = None, attributes: dict[str, Attribute] | None = None, successors: collections.abc.Sequence[Block] | None = None, regions: int | None = None, loc: Location | None = None, ip: object | None = None)

Bases: _OperationBase

property operation: Operation
property opview: OpView
__str__() str

Returns the assembly form of the operation.

property successors: OpSuccessors

Returns the list of Operation successors.

_set_invalid() None

Invalidate the operation.

_ODS_REGIONS: tuple = (0, True)
_ODS_OPERAND_SEGMENTS: None = None
_ODS_RESULT_SEGMENTS: None = None
classmethod build_generic(**kwargs) Any

build_generic(cls, results: Sequence[Type] | None = None, operands: Sequence[Value] | None = None, attributes: dict[str, Attribute] | None = None, successors: Sequence[Block] | None = None, regions: int | None = None, loc: Location | None = None, ip: InsertionPoint | None = None) -> typing.Self

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

classmethod parse(**kwargs) Any

parse(cls, source: str, *, source_name: str = ‘’, context: Context | None = None) -> typing.Self

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

classmethod has_trait(**kwargs) Any

(cls: object, trait_cls: type, context: _mlir.ir.Context | None = None) -> bool

Checks if the operation has a given trait.

class mlir.dialects.linalg.OpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.linalg.OpAdaptor(operands: list[Value], opview: OpView)
property operands: list

Returns the operands of the adaptor.

property attributes: OpAttributeMap

Returns the attributes of the adaptor.

class mlir.dialects.linalg.Region
property blocks: BlockList

Returns a forward-optimized sequence of blocks.

property owner: OpView

Returns the operation owning this region.

__iter__() BlockIterator

Iterates over blocks in the region.

__eq__(arg: Region, /) bool
__eq__(arg: object, /) bool

Compares region with non-region object (always returns False).

class mlir.dialects.linalg.Block
property _CAPIPtr: object

Gets a capsule wrapping the MlirBlock.

property owner: OpView

Returns the owning operation of this block.

property region: Region

Returns the owning region of this block.

property arguments: BlockArgumentList

Returns a list of block arguments.

add_argument(type: Type, loc: Location) BlockArgument

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.

erase_argument(index: int) None

Erases the argument at the specified index.

Parameters:

index – The index of the argument to erase.

property operations: OperationList

Returns a forward-optimized sequence of operations.

static create_at_start(parent: Region, arg_types: collections.abc.Sequence[Type] = [], arg_locs: collections.abc.Sequence[Location] | None = None) Block

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

append_to(region: Region) None

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.

create_before(*arg_types, arg_locs: collections.abc.Sequence[Location] | None = None) Block

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

create_after(*arg_types, arg_locs: collections.abc.Sequence[Location] | None = None) Block

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

__iter__() OperationIterator

Iterates over operations in the block.

__eq__(arg: Block, /) bool
__eq__(arg: object, /) bool

Compares block with non-block object (always returns False).

__hash__() int

Returns the hash value of the block.

__str__() str

Returns the assembly form of the block.

append(operation: _OperationBase) None

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.

property successors: BlockSuccessors

Returns the list of Block successors.

property predecessors: BlockPredecessors

Returns the list of Block predecessors.

class mlir.dialects.linalg.InsertionPoint(block: Block)
class mlir.dialects.linalg.InsertionPoint(beforeOperation: _OperationBase)
__enter__(/) InsertionPoint

Enters the insertion point as a context manager.

__exit__(exc_type: object | None, exc_value: object | None, traceback: object | None) None

Exits the insertion point context manager.

current: InsertionPoint = Ellipsis

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

static at_block_begin(block: Block) InsertionPoint

Creates an insertion point at the beginning of a block.

Parameters:

block – The block at whose beginning operations should be inserted.

Returns:

An InsertionPoint at the block’s beginning.

static at_block_terminator(block: Block) InsertionPoint

Creates an insertion point before a block’s terminator.

Parameters:

block – The block whose terminator to insert before.

Returns:

An InsertionPoint before the terminator.

Raises:

ValueError – If the block has no terminator.

static after(operation: _OperationBase) InsertionPoint

Creates an insertion point immediately after an operation.

Parameters:

operation – The operation after which to insert.

Returns:

An InsertionPoint after the operation.

insert(operation: _OperationBase) None

Inserts an operation at this insertion point.

Parameters:

operation – The operation to insert.

property block: Block

Returns the block that this InsertionPoint points to.

property ref_operation: Operation | None

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

class mlir.dialects.linalg.Attribute(cast_from_type: Attribute)
property _CAPIPtr: object

Gets a capsule wrapping the MlirAttribute.

static _CAPICreate(arg: object, /) Attribute

Creates an Attribute from a capsule wrapping MlirAttribute.

static parse(asm: str, context: Context | None = None) Attribute

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

property context: Context

Context that owns the Attribute.

property type: Type

Returns the type of the Attribute.

get_named(arg: str, /) NamedAttribute

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.

__eq__(arg: Attribute, /) bool
__eq__(arg: object, /) bool

Compares attribute with non-attribute object (always returns False).

__hash__() int

Returns the hash value of the attribute.

dump() None

Dumps a debug representation of the object to stderr.

__str__() str

Returns the assembly form of the Attribute.

__repr__() str

Returns a string representation of the attribute.

property typeid: TypeID

Returns the TypeID of the attribute.

maybe_downcast() Attribute

Downcasts the attribute to a more specific attribute if possible.

class mlir.dialects.linalg.NamedAttribute
__repr__() str

Returns a string representation of the named attribute.

property name: str

The name of the NamedAttribute binding.

property attr: Attribute

The underlying generic attribute of the NamedAttribute binding.

class mlir.dialects.linalg.Type(cast_from_type: Type)
property _CAPIPtr: object

Gets a capsule wrapping the MlirType.

static _CAPICreate(arg: object, /) Type

Creates a Type from a capsule wrapping MlirType.

static parse(asm: str, context: Context | None = None) Type

Parses the assembly form of a type.

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

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

property context: Context

Context that owns the Type.

__eq__(arg: Type, /) bool
__eq__(other: object | None) bool

Compares type with non-type object (always returns False).

__hash__() int

Returns the hash value of the Type.

dump() None

Dumps a debug representation of the object to stderr.

__str__() str

Returns the assembly form of the Type.

__repr__() str

Returns a string representation of the Type.

maybe_downcast() Type

Downcasts the Type to a more specific Type if possible.

property typeid: TypeID

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

class mlir.dialects.linalg.TypeID
property _CAPIPtr: object

Gets a capsule wrapping the MlirTypeID.

static _CAPICreate(arg: object, /) TypeID

Creates a TypeID from a capsule wrapping MlirTypeID.

__eq__(arg: TypeID, /) bool
__eq__(arg: object, /) bool

Compares TypeID with non-TypeID object (always returns False).

__hash__() int

Returns the hash value of the TypeID.

mlir.dialects.linalg._T
class mlir.dialects.linalg.Value(value: Value)

Bases: Generic[_T]

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:

class Mapping(Generic[KT, VT]): def **getitem**(self, key: KT) -> VT: … # Etc.

This class can then be used as follows:

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default

property _CAPIPtr: object

Gets a capsule wrapping the MlirValue.

static _CAPICreate(arg: object, /) Value

Creates a Value from a capsule wrapping MlirValue.

property context: Context

Context in which the value lives.

dump() None

Dumps a debug representation of the object to stderr.

property owner: OpView | Block

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

property uses: OpOperandIterator

Returns an iterator over uses of this value.

__eq__(arg: Value, /) bool
__eq__(arg: object, /) bool

Compares value with non-value object (always returns False).

__hash__() int

Returns the hash value of the value.

__str__() str

Returns the string form of the value.

If the value is a block argument, this is the assembly form of its type and the position in the argument list. If the value is an operation result, this is equivalent to printing the operation that produced it.

get_name(use_local_scope: bool = False, use_name_loc_as_prefix: bool = False) str
get_name(state: AsmState) str

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

property type: _T

Returns the type of the value.

set_type(type: _T)

Sets the type of the value.

replace_all_uses_with(arg: Value, /) None

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

replace_all_uses_except(with_: Value, exceptions: Operation) None
replace_all_uses_except(with_: Value, exceptions: collections.abc.Sequence[Operation]) None
maybe_downcast() BlockArgument | OpResult | Value

Downcasts the Value to a more specific kind if possible.

property location: Location

Returns the source location of the value.

class mlir.dialects.linalg.BlockArgument(value: Value)

Bases: Value[_T]

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:

class Mapping(Generic[KT, VT]): def **getitem**(self, key: KT) -> VT: … # Etc.

This class can then be used as follows:

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default

maybe_downcast() BlockArgument

Downcasts the Value to a more specific kind if possible.

__str__() str

Returns the string form of the value.

If the value is a block argument, this is the assembly form of its type and the position in the argument list. If the value is an operation result, this is equivalent to printing the operation that produced it.

property owner: Block

Returns the block that owns this argument.

property arg_number: int

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

set_type(type: Type) None

Sets the type of this block argument.

set_location(loc: Location) None

Sets the location of this block argument.

class mlir.dialects.linalg.OpResult(value: Value)

Bases: Value[_T]

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:

class Mapping(Generic[KT, VT]): def **getitem**(self, key: KT) -> VT: … # Etc.

This class can then be used as follows:

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default

maybe_downcast() OpResult

Downcasts the Value to a more specific kind if possible.

__str__() str

Returns the string form of the value.

If the value is a block argument, this is the assembly form of its type and the position in the argument list. If the value is an operation result, this is equivalent to printing the operation that produced it.

property owner: OpView

Returns the operation that produces this result.

property result_number: int

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

class mlir.dialects.linalg.OpOperand
property owner: OpView

Returns the operation that owns this operand.

property operand_number: int

Returns the operand number in the owning operation.

class mlir.dialects.linalg.AsmState(value: Value, use_local_scope: bool = False)
class mlir.dialects.linalg.AsmState(op: _OperationBase, use_local_scope: bool = False)
class mlir.dialects.linalg.SymbolTable(arg: _OperationBase, /)
__getitem__(arg: str, /) OpView

Looks up a symbol by name in the symbol table.

Parameters:

name – The name of the symbol to look up.

Returns:

The operation defining the symbol.

Raises:

KeyError – If the symbol is not found.

insert(operation: _OperationBase) StringAttr

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.

erase(operation: _OperationBase) None

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.

__delitem__(arg: str, /) None

Deletes a symbol by name from the symbol table.

__contains__(arg: str, /) bool

Checks if a symbol with the given name exists in the table.

static set_symbol_name(symbol: _OperationBase, name: str) None

Sets the symbol name for a symbol operation.

static get_symbol_name(symbol: _OperationBase) StringAttr

Gets the symbol name from a symbol operation.

static get_visibility(symbol: _OperationBase) StringAttr

Gets the visibility attribute of a symbol operation.

static set_visibility(symbol: _OperationBase, visibility: str) None

Sets the visibility attribute of a symbol operation.

static replace_all_symbol_uses(old_symbol: str, new_symbol: str, from_op: _OperationBase) None

Replaces all uses of a symbol with a new symbol name within the given operation.

static walk_symbol_tables(from_op: _OperationBase, all_sym_uses_visible: bool, callback: object) None

Walks symbol tables starting from an operation with a callback function.

class mlir.dialects.linalg.BlockArgumentList

Bases: collections.abc.Sequence[BlockArgument]

All the operations on a read-only sequence.

Concrete subclasses must override new or init, getitem, and len.

__getitem__(key, /)

Return self[key].

__len__(/)

Return len(self).

__add__(arg: BlockArgumentList, /) list[BlockArgument]
property types: list[Type]

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

class mlir.dialects.linalg.BlockIterator
__iter__() BlockIterator

Returns an iterator over the blocks in the operation’s region.

__next__() Block

Returns the next block in the iteration.

class mlir.dialects.linalg.BlockList
__getitem__(arg: int, /) Block

Returns the block at the specified index.

__iter__() BlockIterator

Returns an iterator over blocks in the operation’s region.

__len__() int

Returns the number of blocks in the operation’s region.

append(*args, arg_locs: collections.abc.Sequence | None = None) Block

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

Returns:

The created block.

class mlir.dialects.linalg.BlockSuccessors

Bases: collections.abc.Sequence[Block]

All the operations on a read-only sequence.

Concrete subclasses must override new or init, getitem, and len.

__getitem__(key, /)

Return self[key].

__len__(/)

Return len(self).

__add__(arg: BlockSuccessors, /) list[Block]
class mlir.dialects.linalg.BlockPredecessors

Bases: collections.abc.Sequence[Block]

All the operations on a read-only sequence.

Concrete subclasses must override new or init, getitem, and len.

__getitem__(key, /)

Return self[key].

__len__(/)

Return len(self).

__add__(arg: BlockPredecessors, /) list[Block]
class mlir.dialects.linalg.OperationIterator
__iter__() OperationIterator

Returns an iterator over the operations in an operation’s block.

__next__() OpView

Returns the next operation in the iteration.

class mlir.dialects.linalg.OperationList
__getitem__(arg: int, /) OpView

Returns the operation at the specified index.

__iter__() OperationIterator

Returns an iterator over operations in the list.

__len__() int

Returns the number of operations in the list.

class mlir.dialects.linalg.OpAttributeMap
__contains__(name: str) bool

Checks if an attribute with the given name exists in the map.

__len__() int

Returns the number of attributes in the map.

__getitem__(name: str) Attribute
__getitem__(index: int) NamedAttribute

Gets a named attribute by index.

__setitem__(name: str, attr: Attribute) None

Sets an attribute with the given name.

__delitem__(name: str) None

Deletes an attribute with the given name.

get(key: str, default: object | None = None) Attribute | None

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

__iter__() collections.abc.Iterator[str]

Iterates over attribute names.

keys() list[str]

Returns a list of attribute names.

values() list[Attribute]

Returns a list of attribute values.

items() list[tuple[str, Attribute]]

Returns a list of (name, attribute) tuples.

class mlir.dialects.linalg.OpOperandIterator
__iter__() OpOperandIterator

Returns an iterator over operands.

__next__() OpOperand

Returns the next operand in the iteration.

class mlir.dialects.linalg.OpOperandList

Bases: collections.abc.Sequence[Value], Generic[_T]

All the operations on a read-only sequence.

Concrete subclasses must override new or init, getitem, and len.

__getitem__(key, /)

Return self[key].

__len__(/)

Return len(self).

__add__(arg: OpOperandList, /) list[Value]
__setitem__(index: int, value: Value) None

Sets the operand at the specified index to a new value.

class mlir.dialects.linalg.OpOperands

Bases: collections.abc.Sequence[OpOperand]

All the operations on a read-only sequence.

Concrete subclasses must override new or init, getitem, and len.

__getitem__(key, /)

Return self[key].

__len__(/)

Return len(self).

__add__(arg: OpOperands, /) list[OpOperand]
class mlir.dialects.linalg.OpResultList

Bases: collections.abc.Sequence[OpResult], Generic[_T]

All the operations on a read-only sequence.

Concrete subclasses must override new or init, getitem, and len.

__getitem__(key, /)

Return self[key].

__len__(/)

Return len(self).

__add__(arg: OpResultList, /) list[OpResult]
property types: list[Type]

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

property owner: OpView

Returns the operation that owns this result list.

class mlir.dialects.linalg.OpSuccessors

Bases: collections.abc.Sequence[Block]

All the operations on a read-only sequence.

Concrete subclasses must override new or init, getitem, and len.

__getitem__(key, /)

Return self[key].

__len__(/)

Return len(self).

__add__(arg: OpSuccessors, /) list[Block]
__setitem__(index: int, block: Block) None

Sets the successor block at the specified index.

class mlir.dialects.linalg.RegionSequence

Bases: collections.abc.Sequence[Region]

All the operations on a read-only sequence.

Concrete subclasses must override new or init, getitem, and len.

__getitem__(key, /)

Return self[key].

__len__(/)

Return len(self).

__add__(arg: RegionSequence, /) list[Region]
class mlir.dialects.linalg.AttrBuilder
static contains(attribute_kind: str) bool

Checks whether an attribute builder is registered for the given attribute kind.

static get(attribute_kind: str) collections.abc.Callable

Gets the registered attribute builder for the given attribute kind.

static insert(attribute_kind: str, attr_builder: collections.abc.Callable, replace: bool = False, allow_existing: bool = False) None

Register an attribute builder for building MLIR attributes from Python values.

class mlir.dialects.linalg.DynamicOpTrait
classmethod attach(**kwargs) Any

(cls: object, op_name: type | str, target: object | None = None, context: _mlir.ir.Context | None = None) -> bool

Attach the dynamic op trait subclass to the given operation name.

class mlir.dialects.linalg.IsTerminatorTrait

Bases: DynamicOpTrait

_trait_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

classmethod attach(**kwargs) Any

(cls: object, op_name: type | str, context: _mlir.ir.Context | None = None) -> bool

Attach IsTerminator trait to the given operation name.

class mlir.dialects.linalg.NoTerminatorTrait

Bases: DynamicOpTrait

_trait_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

classmethod attach(**kwargs) Any

(cls: object, op_name: type | str, context: _mlir.ir.Context | None = None) -> bool

Attach NoTerminator trait to the given operation name.

class mlir.dialects.linalg.IsIsolatedFromAboveTrait

Bases: DynamicOpTrait

_trait_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

classmethod attach(**kwargs) Any

(cls: object, op_name: type | str, context: _mlir.ir.Context | None = None) -> bool

Attach IsIsolatedFromAbove trait to the given operation name.

class mlir.dialects.linalg.RecursiveMemoryEffectsTrait

Bases: DynamicOpTrait

_trait_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

classmethod attach(**kwargs) Any

(cls: object, op_name: type | str, context: _mlir.ir.Context | None = None) -> bool

Attach RecursiveMemoryEffects trait to the given operation name.

exception mlir.dialects.linalg.MLIRError

Bases: Exception

Common base class for all non-exit exceptions.

property message: str
property error_diagnostics: list[DiagnosticInfo]
class mlir.dialects.linalg.AffineExpr
property _CAPIPtr: object
_CAPICreate() AffineExpr
__add__(arg: AffineExpr, /) AffineAddExpr
__add__(arg: int, /) AffineAddExpr
__radd__(arg: int, /) AffineAddExpr
__mul__(arg: AffineExpr, /) AffineMulExpr
__mul__(arg: int, /) AffineMulExpr
__rmul__(arg: int, /) AffineMulExpr
__mod__(arg: AffineExpr, /) AffineModExpr
__mod__(arg: int, /) AffineModExpr
__rmod__(arg: int, /) AffineModExpr
__sub__(arg: AffineExpr, /) AffineAddExpr
__sub__(arg: int, /) AffineAddExpr
__rsub__(arg: int, /) AffineAddExpr
__eq__(arg: AffineExpr, /) bool
__eq__(arg: object, /) bool
__str__() str
__repr__() str
__hash__() int
property context: Context
compose(arg: AffineMap, /) AffineExpr
maybe_downcast() AffineExpr
shift_dims(num_dims: int, shift: int, offset: int = 0) AffineExpr
shift_symbols(num_symbols: int, shift: int, offset: int = 0) AffineExpr
static simplify_affine_expr(expr: AffineExpr, num_dims: int, num_symbols: int) AffineExpr

Simplify an affine expression by flattening and some amount of simple analysis.

static get_add(arg0: AffineExpr, arg1: AffineExpr, /) AffineAddExpr
static get_add(arg0: int, arg1: AffineExpr, /) AffineAddExpr
static get_add(arg0: AffineExpr, arg1: int, /) AffineAddExpr

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

static get_mul(arg0: AffineExpr, arg1: AffineExpr, /) AffineMulExpr
static get_mul(arg0: int, arg1: AffineExpr, /) AffineMulExpr
static get_mul(arg0: AffineExpr, arg1: int, /) AffineMulExpr

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

static get_mod(arg0: AffineExpr, arg1: AffineExpr, /) AffineModExpr
static get_mod(arg0: int, arg1: AffineExpr, /) AffineModExpr
static get_mod(arg0: AffineExpr, arg1: int, /) AffineModExpr

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

static get_floor_div(arg0: AffineExpr, arg1: AffineExpr, /) AffineFloorDivExpr
static get_floor_div(arg0: int, arg1: AffineExpr, /) AffineFloorDivExpr
static get_floor_div(arg0: AffineExpr, arg1: int, /) AffineFloorDivExpr

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

static get_ceil_div(arg0: AffineExpr, arg1: AffineExpr, /) AffineCeilDivExpr
static get_ceil_div(arg0: int, arg1: AffineExpr, /) AffineCeilDivExpr
static get_ceil_div(arg0: AffineExpr, arg1: int, /) AffineCeilDivExpr

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

static get_constant(value: int, context: Context | None = None) AffineConstantExpr

Gets a constant affine expression with the given value.

static get_dim(position: int, context: Context | None = None) AffineDimExpr

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

static get_symbol(position: int, context: Context | None = None) AffineSymbolExpr

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

dump() None

Dumps a debug representation of the object to stderr.

class mlir.dialects.linalg.AffineConstantExpr(expr: AffineExpr)

Bases: AffineExpr

static get(value: int, context: Context | None = None) AffineConstantExpr
property value: int
class mlir.dialects.linalg.AffineDimExpr(expr: AffineExpr)

Bases: AffineExpr

static get(position: int, context: Context | None = None) AffineDimExpr
property position: int
class mlir.dialects.linalg.AffineSymbolExpr(expr: AffineExpr)

Bases: AffineExpr

static get(position: int, context: Context | None = None) AffineSymbolExpr
property position: int
class mlir.dialects.linalg.AffineBinaryExpr(expr: AffineExpr)

Bases: AffineExpr

property lhs: AffineExpr
property rhs: AffineExpr
class mlir.dialects.linalg.AffineAddExpr(expr: AffineExpr)

Bases: AffineBinaryExpr

static get(arg0: AffineExpr, arg1: AffineExpr, /) AffineAddExpr
class mlir.dialects.linalg.AffineMulExpr(expr: AffineExpr)

Bases: AffineBinaryExpr

static get(arg0: AffineExpr, arg1: AffineExpr, /) AffineMulExpr
class mlir.dialects.linalg.AffineModExpr(expr: AffineExpr)

Bases: AffineBinaryExpr

static get(arg0: AffineExpr, arg1: AffineExpr, /) AffineModExpr
class mlir.dialects.linalg.AffineFloorDivExpr(expr: AffineExpr)

Bases: AffineBinaryExpr

static get(arg0: AffineExpr, arg1: AffineExpr, /) AffineFloorDivExpr
class mlir.dialects.linalg.AffineCeilDivExpr(expr: AffineExpr)

Bases: AffineBinaryExpr

static get(arg0: AffineExpr, arg1: AffineExpr, /) AffineCeilDivExpr
class mlir.dialects.linalg.AffineMap
property _CAPIPtr: object
_CAPICreate() AffineMap
__eq__(arg: AffineMap, /) bool
__eq__(arg: object, /) bool
__str__() str
__repr__() str
__hash__() int
static compress_unused_symbols(arg0: collections.abc.Sequence[AffineMap], arg1: Context, /) list[AffineMap]
property context: Context

Context that owns the Affine Map

dump() None

Dumps a debug representation of the object to stderr.

static get(dim_count: int, symbol_count: int, exprs: collections.abc.Sequence[AffineExpr], context: Context | None = None) AffineMap

Gets a map with the given expressions as results.

static get_constant(value: int, context: Context | None = None) AffineMap

Gets an affine map with a single constant result

static get_empty(context: Context | None = None) AffineMap

Gets an empty affine map.

static get_identity(n_dims: int, context: Context | None = None) AffineMap

Gets an identity map with the given number of dimensions.

static get_minor_identity(n_dims: int, n_results: int, context: Context | None = None) AffineMap

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

static get_permutation(permutation: collections.abc.Sequence[int], context: Context | None = None) AffineMap

Gets an affine map that permutes its inputs.

get_submap(result_positions: collections.abc.Sequence[int]) AffineMap
get_major_submap(n_results: int) AffineMap
get_minor_submap(n_results: int) AffineMap
replace(expr: AffineExpr, replacement: AffineExpr, n_result_dims: int, n_result_syms: int) AffineMap
property is_permutation: bool
property is_projected_permutation: bool
property n_dims: int
property n_inputs: int
property n_symbols: int
property results: AffineExprList
class mlir.dialects.linalg.AffineExprList

Bases: collections.abc.Sequence[AffineExpr]

All the operations on a read-only sequence.

Concrete subclasses must override new or init, getitem, and len.

__getitem__(key, /)

Return self[key].

__len__(/)

Return len(self).

__add__(arg: AffineExprList, /) list[AffineExpr]
class mlir.dialects.linalg.IntegerSet
property _CAPIPtr: object
_CAPICreate() IntegerSet
__eq__(arg: IntegerSet, /) bool
__eq__(arg: object, /) bool
__str__() str
__repr__() str
__hash__() int
property context: Context
dump() None

Dumps a debug representation of the object to stderr.

static get(num_dims: int, num_symbols: int, exprs: collections.abc.Sequence[AffineExpr], eq_flags: collections.abc.Sequence[bool], context: Context | None = None) IntegerSet
static get_empty(num_dims: int, num_symbols: int, context: Context | None = None) IntegerSet
get_replaced(dim_exprs: collections.abc.Sequence[AffineExpr], symbol_exprs: collections.abc.Sequence[AffineExpr], num_result_dims: int, num_result_symbols: int) IntegerSet
property is_canonical_empty: bool
property n_dims: int
property n_symbols: int
property n_inputs: int
property n_equalities: int
property n_inequalities: int
property constraints: IntegerSetConstraintList
class mlir.dialects.linalg.IntegerSetConstraint
property expr: AffineExpr
property is_eq: bool
class mlir.dialects.linalg.IntegerSetConstraintList

Bases: collections.abc.Sequence[IntegerSetConstraint]

All the operations on a read-only sequence.

Concrete subclasses must override new or init, getitem, and len.

__getitem__(key, /)

Return self[key].

__len__(/)

Return len(self).

__add__(arg: IntegerSetConstraintList, /) list[IntegerSetConstraint]
class mlir.dialects.linalg.AffineMapAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

attr_name: str = Ellipsis

(arg: object, /) -> str

static get(affine_map: AffineMap) AffineMapAttr

Gets an attribute wrapping an AffineMap.

property value: AffineMap

Returns the value of the AffineMap attribute

class mlir.dialects.linalg.DenseBoolArrayAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

static get(values: collections.abc.Sequence, context: Context | None = None) DenseBoolArrayAttr

Gets a uniqued dense array attribute

__getitem__(arg: int, /) bool
__len__() int
__iter__() DenseBoolArrayIterator
__add__(arg: collections.abc.Sequence, /) DenseBoolArrayAttr
class mlir.dialects.linalg.DenseBoolArrayIterator
__iter__() DenseBoolArrayIterator
__next__() bool
class mlir.dialects.linalg.DenseI8ArrayAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

static get(values: collections.abc.Sequence[int], context: Context | None = None) DenseI8ArrayAttr

Gets a uniqued dense array attribute

__getitem__(arg: int, /) int
__len__() int
__iter__() DenseI8ArrayIterator
__add__(arg: collections.abc.Sequence, /) DenseI8ArrayAttr
class mlir.dialects.linalg.DenseI8ArrayIterator
__iter__() DenseI8ArrayIterator
__next__() int
class mlir.dialects.linalg.DenseI16ArrayAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

static get(values: collections.abc.Sequence[int], context: Context | None = None) DenseI16ArrayAttr

Gets a uniqued dense array attribute

__getitem__(arg: int, /) int
__len__() int
__iter__() DenseI16ArrayIterator
__add__(arg: collections.abc.Sequence, /) DenseI16ArrayAttr
class mlir.dialects.linalg.DenseI16ArrayIterator
__iter__() DenseI16ArrayIterator
__next__() int
class mlir.dialects.linalg.DenseI32ArrayAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

static get(values: collections.abc.Sequence[int], context: Context | None = None) DenseI32ArrayAttr

Gets a uniqued dense array attribute

__getitem__(arg: int, /) int
__len__() int
__iter__() DenseI32ArrayIterator
__add__(arg: collections.abc.Sequence, /) DenseI32ArrayAttr
class mlir.dialects.linalg.DenseI32ArrayIterator
__iter__() DenseI32ArrayIterator
__next__() int
class mlir.dialects.linalg.DenseI64ArrayAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

static get(values: collections.abc.Sequence[int], context: Context | None = None) DenseI64ArrayAttr

Gets a uniqued dense array attribute

__getitem__(arg: int, /) int
__len__() int
__iter__() DenseI64ArrayIterator
__add__(arg: collections.abc.Sequence, /) DenseI64ArrayAttr
class mlir.dialects.linalg.DenseI64ArrayIterator
__iter__() DenseI64ArrayIterator
__next__() int
class mlir.dialects.linalg.DenseF32ArrayAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

static get(values: collections.abc.Sequence[float], context: Context | None = None) DenseF32ArrayAttr

Gets a uniqued dense array attribute

__getitem__(arg: int, /) float
__len__() int
__iter__() DenseF32ArrayIterator
__add__(arg: collections.abc.Sequence, /) DenseF32ArrayAttr
class mlir.dialects.linalg.DenseF32ArrayIterator
__iter__() DenseF32ArrayIterator
__next__() float
class mlir.dialects.linalg.DenseF64ArrayAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

static get(values: collections.abc.Sequence[float], context: Context | None = None) DenseF64ArrayAttr

Gets a uniqued dense array attribute

__getitem__(arg: int, /) float
__len__() int
__iter__() DenseF64ArrayIterator
__add__(arg: collections.abc.Sequence, /) DenseF64ArrayAttr
class mlir.dialects.linalg.DenseF64ArrayIterator
__iter__() DenseF64ArrayIterator
__next__() float
class mlir.dialects.linalg.ArrayAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

attr_name: str = Ellipsis

(arg: object, /) -> str

static get(attributes: collections.abc.Sequence[Attribute], context: Context | None = None) ArrayAttr

Gets a uniqued Array attribute

__getitem__(arg: int, /) Attribute
__len__() int
__iter__() ArrayAttributeIterator
__add__(arg: collections.abc.Sequence[Attribute], /) ArrayAttr
class mlir.dialects.linalg.ArrayAttributeIterator
__iter__() ArrayAttributeIterator
__next__() Attribute
class mlir.dialects.linalg.BoolAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

static get(value: bool, context: Context | None = None) BoolAttr

Gets an uniqued bool attribute

property value: bool

Returns the value of the bool attribute

__bool__() bool

Converts the value of the bool attribute to a Python bool

class mlir.dialects.linalg.DenseElementsAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

__len__() int
static get(array: typing_extensions.Buffer, signless: bool = True, type: Type | None = None, shape: collections.abc.Sequence[int] | None = None, context: Context | None = None) DenseElementsAttr
static get(attrs: collections.abc.Sequence[Attribute], type: Type | None = None, context: Context | None = None) DenseElementsAttr

Gets a DenseElementsAttr from a Python list of attributes.

Note that it can be expensive to construct attributes individually. For a large number of elements, consider using a Python buffer or array instead.

Parameters:
  • attrs – A list of attributes.

  • type – The desired shape and type of the resulting DenseElementsAttr. If not provided, the element type is determined based on the type of the 0th attribute and the shape is [len(attrs)].

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

Returns:

DenseElementsAttr on success.

Raises:

ValueError – If the type of the attributes does not match the type specified by shaped_type.

static get_splat(shaped_type: Type, element_attr: Attribute) DenseElementsAttr

Gets a DenseElementsAttr where all values are the same

property is_splat: bool
get_splat_value() Attribute
class mlir.dialects.linalg.DenseFPElementsAttr(cast_from_attr: Attribute)

Bases: DenseElementsAttr

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

static get(array: typing_extensions.Buffer, signless: bool = True, type: Type | None = None, shape: collections.abc.Sequence[int] | None = None, context: Context | None = None) DenseFPElementsAttr
static get(attrs: collections.abc.Sequence[Attribute], type: Type | None = None, context: Context | None = None) DenseFPElementsAttr

Gets a DenseElementsAttr from a Python list of attributes.

Note that it can be expensive to construct attributes individually. For a large number of elements, consider using a Python buffer or array instead.

Parameters:
  • attrs – A list of attributes.

  • type – The desired shape and type of the resulting DenseElementsAttr. If not provided, the element type is determined based on the type of the 0th attribute and the shape is [len(attrs)].

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

Returns:

DenseElementsAttr on success.

Raises:

ValueError – If the type of the attributes does not match the type specified by shaped_type.

static get_splat(shaped_type: Type, element_attr: Attribute) DenseFPElementsAttr

Gets a DenseFPElementsAttr where all values are the same

__getitem__(arg: int, /) float
class mlir.dialects.linalg.DenseIntElementsAttr(cast_from_attr: Attribute)

Bases: DenseElementsAttr

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

static get(array: typing_extensions.Buffer, signless: bool = True, type: Type | None = None, shape: collections.abc.Sequence[int] | None = None, context: Context | None = None) DenseIntElementsAttr
static get(attrs: collections.abc.Sequence[Attribute], type: Type | None = None, context: Context | None = None) DenseIntElementsAttr

Gets a DenseElementsAttr from a Python list of attributes.

Note that it can be expensive to construct attributes individually. For a large number of elements, consider using a Python buffer or array instead.

Parameters:
  • attrs – A list of attributes.

  • type – The desired shape and type of the resulting DenseElementsAttr. If not provided, the element type is determined based on the type of the 0th attribute and the shape is [len(attrs)].

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

Returns:

DenseElementsAttr on success.

Raises:

ValueError – If the type of the attributes does not match the type specified by shaped_type.

static get_splat(shaped_type: Type, element_attr: Attribute) DenseIntElementsAttr

Gets a DenseIntElementsAttr where all values are the same

__getitem__(arg: int, /) int
class mlir.dialects.linalg.DenseResourceElementsAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

attr_name: str = Ellipsis

(arg: object, /) -> str

static get_from_buffer(array: typing_extensions.Buffer, name: str, type: Type, alignment: int | None = None, is_mutable: bool = False, context: Context | None = None) DenseResourceElementsAttr

Gets a DenseResourceElementsAttr from a Python buffer or array.

This function does minimal validation or massaging of the data, and it is up to the caller to ensure that the buffer meets the characteristics implied by the shape.

The backing buffer and any user objects will be retained for the lifetime of the resource blob. This is typically bounded to the context but the resource can have a shorter lifespan depending on how it is used in subsequent processing.

Parameters:
  • buffer – The array or buffer to convert.

  • name – Name to provide to the resource (may be changed upon collision).

  • type – The explicit ShapedType to construct the attribute with.

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

Returns:

DenseResourceElementsAttr on success.

Raises:

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

class mlir.dialects.linalg.DictAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

attr_name: str = Ellipsis

(arg: object, /) -> str

__contains__(arg: str, /) bool
__len__() int
static get(value: dict[str, Attribute] = {}, context: Context | None = None) DictAttr

Gets an uniqued dict attribute

__getitem__(arg: str, /) Attribute
__getitem__(arg: int, /) NamedAttribute
class mlir.dialects.linalg.SymbolRefAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

attr_name: str = Ellipsis

(arg: object, /) -> str

static get(symbols: collections.abc.Sequence[str], context: Context | None = None) SymbolRefAttr

Gets a uniqued SymbolRef attribute from a list of symbol names

property value: list[str]

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

class mlir.dialects.linalg.FlatSymbolRefAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

attr_name: str = Ellipsis

(arg: object, /) -> str

static get(value: str, context: Context | None = None) FlatSymbolRefAttr

Gets a uniqued FlatSymbolRef attribute

property value: str

Returns the value of the FlatSymbolRef attribute as a string

class mlir.dialects.linalg.OpaqueAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

attr_name: str = Ellipsis

(arg: object, /) -> str

static get(dialect_namespace: str, buffer: typing_extensions.Buffer, type: Type, context: Context | None = None) OpaqueAttr

Gets an Opaque attribute.

property dialect_namespace: str

Returns the dialect namespace for the Opaque attribute as a string

property data: bytes

Returns the data for the Opaqued attributes as bytes

class mlir.dialects.linalg.FloatAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

attr_name: str = Ellipsis

(arg: object, /) -> str

static get(type: Type, value: float, loc: Location | None = None) FloatAttr

Gets an uniqued float point attribute associated to a type

static get_unchecked(type: Type, value: float, context: Context | None = None) FloatAttr

Gets an uniqued float point attribute associated to a type

static get_f32(value: float, context: Context | None = None) FloatAttr

Gets an uniqued float point attribute associated to a f32 type

static get_f64(value: float, context: Context | None = None) FloatAttr

Gets an uniqued float point attribute associated to a f64 type

property value: float

Returns the value of the float attribute

__float__() float

Converts the value of the float attribute to a Python float

class mlir.dialects.linalg.IntegerAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

attr_name: str = Ellipsis

(arg: object, /) -> str

static get(type: Type, value: object) IntegerAttr

Gets an uniqued integer attribute associated to a type

property value: int

Returns the value of the integer attribute

__int__() int

Converts the value of the integer attribute to a Python int

__index__() int

Converts the value of the integer attribute to a Python int

class mlir.dialects.linalg.IntegerSetAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

attr_name: str = Ellipsis

(arg: object, /) -> str

static get(integer_set: IntegerSet) IntegerSetAttr

Gets an attribute wrapping an IntegerSet.

class mlir.dialects.linalg.StringAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

attr_name: str = Ellipsis

(arg: object, /) -> str

static get(value: str, context: Context | None = None) StringAttr
static get(value: bytes, context: Context | None = None) StringAttr
static get_typed(type: Type, value: str) StringAttr

Gets a uniqued string attribute associated to a type

property value: str

Returns the value of the string attribute

property value_bytes: bytes

Returns the value of the string attribute as bytes

class mlir.dialects.linalg.TypeAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

attr_name: str = Ellipsis

(arg: object, /) -> str

static get(value: Type, context: Context | None = None) TypeAttr

Gets a uniqued Type attribute

property value: Type
class mlir.dialects.linalg.UnitAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

attr_name: str = Ellipsis

(arg: object, /) -> str

static get(context: Context | None = None) UnitAttr

Create a Unit attribute.

class mlir.dialects.linalg.StridedLayoutAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

attr_name: str = Ellipsis

(arg: object, /) -> str

static get(offset: int, strides: collections.abc.Sequence[int], context: Context | None = None) StridedLayoutAttr

Gets a strided layout attribute.

static get_fully_dynamic(rank: int, context: Context | None = None) StridedLayoutAttr

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

property offset: int

Returns the value of the float point attribute

property strides: list[int]

Returns the value of the float point attribute

class mlir.dialects.linalg.DynamicAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

static get(full_attr_name: str, attributes: collections.abc.Sequence[Attribute], context: Context | None = None) DynamicAttr

Create a dynamic attribute.

property params: list[Attribute]

Returns the parameters of the dynamic attribute as a list of attributes.

property attr_name: str
static lookup_typeid(full_attr_name: str, context: Context | None = None) TypeID

Look up the TypeID for the given dynamic attribute name.

class mlir.dialects.linalg.Speculatability

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

NotSpeculatable = 0
Speculatable = 1
RecursivelySpeculatable = 2
class mlir.dialects.linalg.MemoryEffect

A memory effect.

__eq__(arg: MemoryEffect, /) bool

Compares two memory effects for equality.

Allocate: _mlir.ir.MemoryEffect = Ellipsis

(arg: object, /) -> _mlir.ir.MemoryEffect

Free: _mlir.ir.MemoryEffect = Ellipsis

(arg: object, /) -> _mlir.ir.MemoryEffect

Read: _mlir.ir.MemoryEffect = Ellipsis

(arg: object, /) -> _mlir.ir.MemoryEffect

Write: _mlir.ir.MemoryEffect = Ellipsis

(arg: object, /) -> _mlir.ir.MemoryEffect

class mlir.dialects.linalg.SideEffectResource

A side effect resource.

Default: _mlir.ir.SideEffectResource = Ellipsis

(arg: object, /) -> _mlir.ir.SideEffectResource

class mlir.dialects.linalg.MemoryEffectInstance(effect: MemoryEffect, target: OpOperand | OpResult | BlockArgument | SymbolRefAttr | FlatSymbolRefAttr | None = None, *, parameters: Attribute | None = None, stage: int = 0, effect_on_full_region: bool = False, resource: SideEffectResource = ...)

A concrete instance of a memory effect.

property effect: MemoryEffect

Returns the kind of memory effect.

property resource: SideEffectResource

Returns the affected side effect resource.

property stage: int

Returns the stage at which the effect occurs.

property effect_on_full_region: bool

Returns whether the effect applies to the full resource.

property parameters: Attribute | None

Returns the effect parameters, if any.

property value: OpResult | BlockArgument | None

Returns the affected value, if any.

property symbol_ref: SymbolRefAttr | FlatSymbolRefAttr | None

Returns the affected symbol reference, if any.

class mlir.dialects.linalg.ConditionallySpeculatable(object: ConditionallySpeculatable.__init__.object, context: Context | None = None)
property operation: Operation

Returns an Operation for which the interface was constructed.

property opview: OpView

Returns an OpView subclass instance for which the interface was constructed

getSpeculatability() Speculatability

Returns the speculatability of the given operation.

classmethod attach(**kwargs) Any

(cls: object, op_name: object, *, target: object | None = None, context: _mlir.ir.Context | None = None) -> None

Attach the interface subclass to the given operation name.

class mlir.dialects.linalg.InferShapedTypeOpInterface(object: InferShapedTypeOpInterface.__init__.object, context: Context | None = None)
property operation: Operation

Returns an Operation for which the interface was constructed.

property opview: OpView

Returns an OpView subclass instance for which the interface was constructed

inferReturnTypeComponents(operands: collections.abc.Sequence | None = None, attributes: Attribute | None = None, regions: typing_extensions.CapsuleType | None = None, properties: collections.abc.Sequence[Region] | None = None, context: Context | None = None, loc: Location | None = None) list[ShapedTypeComponents]

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

class mlir.dialects.linalg.InferTypeOpInterface(object: InferTypeOpInterface.__init__.object, context: Context | None = None)
property operation: Operation

Returns an Operation for which the interface was constructed.

property opview: OpView

Returns an OpView subclass instance for which the interface was constructed

inferReturnTypes(operands: collections.abc.Sequence | None = None, attributes: Attribute | None = None, properties: typing_extensions.CapsuleType | None = None, regions: collections.abc.Sequence[Region] | None = None, context: Context | None = None, loc: Location | None = None) list[Type]

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

class mlir.dialects.linalg.MemoryEffectsOpInterface(object: MemoryEffectsOpInterface.__init__.object, context: Context | None = None)
property operation: Operation

Returns an Operation for which the interface was constructed.

property opview: OpView

Returns an OpView subclass instance for which the interface was constructed

get_effects() list[MemoryEffectInstance]

Returns the memory effects of the operation.

classmethod attach(**kwargs) Any

(cls: object, op_name: object, *, target: object | None = None, context: _mlir.ir.Context | None = None) -> None

Attach the interface subclass to the given operation name.

class mlir.dialects.linalg.ShapedTypeComponents
property element_type: Type

Returns the element type of the shaped type components.

static get(element_type: Type) ShapedTypeComponents
static get(shape: list[int], element_type: Type) ShapedTypeComponents
static get(shape: list[int], element_type: Type, attribute: Attribute) ShapedTypeComponents

Create a ranked shaped type components object with attribute.

property has_rank: bool

Returns whether the given shaped type component is ranked.

property rank: int | None

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: list | None

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 mlir.dialects.linalg.IntegerType(cast_from_type: Type)

Bases: Type

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

class Signedness

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

SIGNLESS = 0
SIGNED = 1
UNSIGNED = 2
SIGNLESS: IntegerType
SIGNED: IntegerType
UNSIGNED: IntegerType
static get_signless(width: int, context: Context | None = None) IntegerType

Create a signless integer type

static get_signed(width: int, context: Context | None = None) IntegerType

Create a signed integer type

static get_unsigned(width: int, context: Context | None = None) IntegerType

Create an unsigned integer type

static get(width: int, signedness: IntegerType = IntegerType.Signedness.SIGNLESS, context: Context | None = None) IntegerType

Create an integer type

property signedness: IntegerType
property width: int

Returns the width of the integer type

property is_signless: bool

Returns whether this is a signless integer

property is_signed: bool

Returns whether this is a signed integer

property is_unsigned: bool

Returns whether this is an unsigned integer

class mlir.dialects.linalg.FloatType(cast_from_type: Type)

Bases: Type

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

property width: int

Returns the width of the floating-point type

class mlir.dialects.linalg.IndexType(cast_from_type: Type)

Bases: Type

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(context: Context | None = None) IndexType

Create a index type.

class mlir.dialects.linalg.Float4E2M1FNType(cast_from_type: Type)

Bases: FloatType

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(context: Context | None = None) Float4E2M1FNType

Create a float4_e2m1fn type.

class mlir.dialects.linalg.Float6E2M3FNType(cast_from_type: Type)

Bases: FloatType

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(context: Context | None = None) Float6E2M3FNType

Create a float6_e2m3fn type.

class mlir.dialects.linalg.Float6E3M2FNType(cast_from_type: Type)

Bases: FloatType

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(context: Context | None = None) Float6E3M2FNType

Create a float6_e3m2fn type.

class mlir.dialects.linalg.Float8E4M3FNType(cast_from_type: Type)

Bases: FloatType

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(context: Context | None = None) Float8E4M3FNType

Create a float8_e4m3fn type.

class mlir.dialects.linalg.Float8E5M2Type(cast_from_type: Type)

Bases: FloatType

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(context: Context | None = None) Float8E5M2Type

Create a float8_e5m2 type.

class mlir.dialects.linalg.Float8E4M3Type(cast_from_type: Type)

Bases: FloatType

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(context: Context | None = None) Float8E4M3Type

Create a float8_e4m3 type.

class mlir.dialects.linalg.Float8E4M3FNUZType(cast_from_type: Type)

Bases: FloatType

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(context: Context | None = None) Float8E4M3FNUZType

Create a float8_e4m3fnuz type.

class mlir.dialects.linalg.Float8E4M3B11FNUZType(cast_from_type: Type)

Bases: FloatType

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(context: Context | None = None) Float8E4M3B11FNUZType

Create a float8_e4m3b11fnuz type.

class mlir.dialects.linalg.Float8E5M2FNUZType(cast_from_type: Type)

Bases: FloatType

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(context: Context | None = None) Float8E5M2FNUZType

Create a float8_e5m2fnuz type.

class mlir.dialects.linalg.Float8E3M4Type(cast_from_type: Type)

Bases: FloatType

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(context: Context | None = None) Float8E3M4Type

Create a float8_e3m4 type.

class mlir.dialects.linalg.Float8E8M0FNUType(cast_from_type: Type)

Bases: FloatType

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(context: Context | None = None) Float8E8M0FNUType

Create a float8_e8m0fnu type.

class mlir.dialects.linalg.Float8E5M3FNUType(cast_from_type: Type)

Bases: FloatType

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

static get(context: Context | None = None) Float8E5M3FNUType

Create a float8_e5m3fnu type.

class mlir.dialects.linalg.BF16Type(cast_from_type: Type)

Bases: FloatType

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(context: Context | None = None) BF16Type

Create a bf16 type.

class mlir.dialects.linalg.F16Type(cast_from_type: Type)

Bases: FloatType

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(context: Context | None = None) F16Type

Create a f16 type.

class mlir.dialects.linalg.FloatTF32Type(cast_from_type: Type)

Bases: FloatType

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(context: Context | None = None) FloatTF32Type

Create a tf32 type.

class mlir.dialects.linalg.F32Type(cast_from_type: Type)

Bases: FloatType

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(context: Context | None = None) F32Type

Create a f32 type.

class mlir.dialects.linalg.F64Type(cast_from_type: Type)

Bases: FloatType

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(context: Context | None = None) F64Type

Create a f64 type.

class mlir.dialects.linalg.NoneType(cast_from_type: Type)

Bases: Type

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(context: Context | None = None) NoneType

Create a none type.

class mlir.dialects.linalg.ComplexType(cast_from_type: Type)

Bases: Type

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(arg: Type, /) ComplexType

Create a complex type

property element_type: Type

Returns element type.

class mlir.dialects.linalg.ShapedType(cast_from_type: Type)

Bases: Type

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

property element_type: Type

Returns the element type of the shaped type.

property has_rank: bool

Returns whether the given shaped type is ranked.

property rank: int

Returns the rank of the given ranked shaped type.

property has_static_shape: bool

Returns whether the given shaped type has a static shape.

is_dynamic_dim(dim: int) bool

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

is_static_dim(dim: int) bool

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

get_dim_size(dim: int) int

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

static is_dynamic_size(dim_size: int) bool

Returns whether the given dimension size indicates a dynamic dimension.

static is_static_size(dim_size: int) bool

Returns whether the given dimension size indicates a static dimension.

is_dynamic_stride_or_offset(dim_size: int) bool

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

is_static_stride_or_offset(dim_size: int) bool

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

property shape: list[int]

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

static get_dynamic_size() int

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

static get_dynamic_stride_or_offset() int

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

class mlir.dialects.linalg.VectorType(cast_from_type: Type)

Bases: ShapedType

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(shape: collections.abc.Sequence[int], element_type: Type, *, scalable: collections.abc.Sequence | None = None, scalable_dims: collections.abc.Sequence[int] | None = None, loc: Location | None = None) VectorType

Create a vector type

static get_unchecked(shape: collections.abc.Sequence[int], element_type: Type, *, scalable: collections.abc.Sequence | None = None, scalable_dims: collections.abc.Sequence[int] | None = None, context: Context | None = None) VectorType

Create a vector type

property scalable: bool
property scalable_dims: list[bool]
class mlir.dialects.linalg.RankedTensorType(cast_from_type: Type)

Bases: ShapedType

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(shape: collections.abc.Sequence[int], element_type: Type, encoding: Attribute | None = None, loc: Location | None = None) RankedTensorType

Create a ranked tensor type

static get_unchecked(shape: collections.abc.Sequence[int], element_type: Type, encoding: Attribute | None = None, context: Context | None = None) RankedTensorType

Create a ranked tensor type

property encoding: Attribute | None
class mlir.dialects.linalg.UnrankedTensorType(cast_from_type: Type)

Bases: ShapedType

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(element_type: Type, loc: Location | None = None) UnrankedTensorType

Create a unranked tensor type

static get_unchecked(element_type: Type, context: Context | None = None) UnrankedTensorType

Create a unranked tensor type

class mlir.dialects.linalg.MemRefType(cast_from_type: Type)

Bases: ShapedType

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(shape: collections.abc.Sequence[int], element_type: Type, layout: Attribute | None = None, memory_space: Attribute | None = None, loc: Location | None = None) MemRefType

Create a memref type

static get_unchecked(shape: collections.abc.Sequence[int], element_type: Type, layout: Attribute | None = None, memory_space: Attribute | None = None, context: Context | None = None) MemRefType

Create a memref type

property layout: Attribute

The layout of the MemRef type.

get_strides_and_offset() tuple[list[int], int]

The strides and offset of the MemRef type.

property affine_map: AffineMap

The layout of the MemRef type as an affine map.

property memory_space: Attribute | None

Returns the memory space of the given MemRef type.

class mlir.dialects.linalg.UnrankedMemRefType(cast_from_type: Type)

Bases: ShapedType

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(element_type: Type, memory_space: Attribute | None, loc: Location | None = None) UnrankedMemRefType

Create a unranked memref type

static get_unchecked(element_type: Type, memory_space: Attribute | None, context: Context | None = None) UnrankedMemRefType

Create a unranked memref type

property memory_space: Attribute | None

Returns the memory space of the given Unranked MemRef type.

class mlir.dialects.linalg.TupleType(cast_from_type: Type)

Bases: Type

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get_tuple(elements: collections.abc.Sequence[Type], context: Context | None = None) TupleType

Create a tuple type

get_type(pos: int) Type

Returns the pos-th type in the tuple type.

property num_types: int

Returns the number of types contained in a tuple.

class mlir.dialects.linalg.FunctionType(cast_from_type: Type)

Bases: Type

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(inputs: collections.abc.Sequence[Type], results: collections.abc.Sequence[Type], context: Context | None = None) FunctionType

Gets a FunctionType from a list of input and result types

property inputs: list[Type]

Returns the list of input types in the FunctionType.

property results: list[Type]

Returns the list of result types in the FunctionType.

class mlir.dialects.linalg.OpaqueType(cast_from_type: Type)

Bases: Type

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

type_name: str = Ellipsis

(arg: object, /) -> str

static get(dialect_namespace: str, buffer: str, context: Context | None = None) OpaqueType

Create an unregistered (opaque) dialect type.

property dialect_namespace: str

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

property data: str

Returns the data for the Opaque type as a string.

class mlir.dialects.linalg.DynamicType(cast_from_type: Type)

Bases: Type

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

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

__repr__() str

Returns a string representation of the Type.

static get(full_type_name: str, attributes: collections.abc.Sequence[Attribute], context: Context | None = None) DynamicType

Create a dynamic type.

property params: list[Attribute]

Returns the parameters of the dynamic type as a list of attributes.

property type_name: str
static lookup_typeid(full_type_name: str, context: Context | None = None) TypeID

Look up the TypeID for the given dynamic type name.

mlir.dialects.linalg._get_op_result_or_value(arg: mlir._mlir_libs._mlir.ir.OpView | mlir._mlir_libs._mlir.ir.Operation | mlir._mlir_libs._mlir.ir.Value | mlir._mlir_libs._mlir.ir.OpResultList) mlir._mlir_libs._mlir.ir.Value

Returns the given value or the single result of the given op.

This is useful to implement op constructors so that they can take other ops as arguments instead of requiring the caller to extract results for every op. Raises ValueError if provided with an op that doesn’t have a single result.

mlir.dialects.linalg._get_op_result_or_op_results(op: mlir._mlir_libs._mlir.ir.OpView | mlir._mlir_libs._mlir.ir.Operation) mlir._mlir_libs._mlir.ir.Operation | mlir._mlir_libs._mlir.ir.OpResult | Sequence[mlir._mlir_libs._mlir.ir.OpResult]
mlir.dialects.linalg._dispatch_mixed_values(values: MixedValues) Tuple[List[mlir.ir.Value], mlir.ir.Operation | mlir.ir.Value | mlir.ir.OpView, mlir.ir.DenseI64ArrayAttr]
mlir.dialects.linalg.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.

mlir.dialects.linalg.transpose(input: opdsl.ops.core_named_ops.Union[Operation, OpView, opdsl.ops.core_named_ops.Sequence[Value]], *, outs: opdsl.ops.core_named_ops.List[opdsl.ops.core_named_ops.Union[Operation, OpView, opdsl.ops.core_named_ops.Sequence[Value]]], permutation: opdsl.ops.core_named_ops.Union[DenseI64ArrayAttr, opdsl.ops.core_named_ops.List[int]])
mlir.dialects.linalg.broadcast(input: opdsl.ops.core_named_ops.Union[Operation, OpView, opdsl.ops.core_named_ops.Sequence[Value]], *, outs: opdsl.ops.core_named_ops.List[opdsl.ops.core_named_ops.Union[Operation, OpView, opdsl.ops.core_named_ops.Sequence[Value]]], dimensions: opdsl.ops.core_named_ops.Union[DenseI64ArrayAttr, opdsl.ops.core_named_ops.List[int]])
mlir.dialects.linalg._IteratorTypeArrayAttr(x, context)
class mlir.dialects.linalg.GenericOp_(inputs, outputs, indexing_maps, iterator_types, *, doc=None, library_call=None, loc=None, ip=None)

Bases: mlir.dialects._linalg_ops_gen.GenericOp

Generic Linalg op form where the key properties of the computation are specified as attributes. In pretty form, a linalg.generic op is written as:

linalg.generic #trait_attribute
    ins(%A, %B : memref<?x?xf32>, memref<?x?xf32>)
    outs(%C : memref<?x?xf32>)
    attrs = {other-optional-attributes}
    {region}

Where #trait_attribute is an alias of a dictionary attribute containing:

  • doc [optional]: a documentation string

  • indexing_maps: a list of AffineMapAttr, one AffineMapAttr per each input

and output view. Such AffineMapAttr specifies the mapping between the loops and the indexing within each view. * library_call [optional]: a StringAttr containing the name of an external library function that the linalg.generic operation maps to. The external library is assumed to be dynamically linked and no strong compile-time guarantees are provided. In the absence of such a library call, linalg.generic will always lower to loops. * iterator_types: an ArrayAttr specifying the type of the enclosing loops. Each element of the list represents an iterator of one of the following types: parallel, reduction

Example: Defining a #matmul_trait attribute in MLIR can be done as follows:

#matmul_accesses = [
  affine_map<(m, n, k) -> (m, k)>,
  affine_map<(m, n, k) -> (k, n)>,
  affine_map<(m, n, k) -> (m, n)>
]
#matmul_trait = {
  doc = "C(m, n) += A(m, k) * B(k, n)",
  indexing_maps = #matmul_accesses,
  library_call = "linalg_matmul",
  iterator_types = ["parallel", "parallel", "reduction"]
}

And can be reused in multiple places as:

linalg.generic #matmul_trait
  ins(%A, %B : memref<?x?xf32>, memref<?x?xf32>)
  outs(%C : memref<?x?xf32>)
  attrs = {other-optional-attributes} {
  ^bb0(%a: f32, %b: f32, %c: f32) :
    %d = arith.mulf %a, %b: f32
    %e = arith.addf %c, %d: f32
    linalg.yield %e : f32
}

This may lower to either:

call @linalg_matmul(%A, %B, %C) :
  (memref<?x?xf32, strided<[?, ?], offset: ?>>,
   memref<?x?xf32, strided<[?, ?], offset: ?>>,
   memref<?x?xf32, strided<[?, ?], offset: ?>>)
  -> ()

or IR resembling:

scf.for %m = %c0 to %M step %c1 {
  scf.for %n = %c0 to %N step %c1 {
    scf.for %k = %c0 to %K step %c1 {
      %a = memref.load %A[%m, %k] : memref<?x?xf32>
      %b = memref.load %B[%k, %n] : memref<?x?xf32>
      %c = memref.load %C[%m, %n] : memref<?x?xf32>
      %d = arith.mulf %a, %b: f32
      %e = arith.addf %c, %d: f32
      memref.store %e, %C[%m, %n] : memref<?x?xf32>
    }
  }
}
mlir.dialects.linalg.generic
mlir.dialects.linalg._create_matmul_like_op(op_type, *ins: opdsl.ops.core_named_ops.Union[Operation, OpView, Value], outs: opdsl.ops.core_named_ops.Sequence[opdsl.ops.core_named_ops.Union[Operation, OpView, Value]], indexing_maps: opdsl.ops.core_named_ops.Optional[opdsl.ops.core_named_ops.Sequence[AffineMapAttr]] = None, cast: opdsl.ops.core_named_ops.Optional[opdsl.ops.core_named_ops.Union[opdsl.ops.core_named_ops.TypeFn, Attribute]] = None)
mlir.dialects.linalg.matmul(*ins: opdsl.ops.core_named_ops.Union[Operation, OpView, Value], outs: opdsl.ops.core_named_ops.Sequence[opdsl.ops.core_named_ops.Union[Operation, OpView, Value]], indexing_maps: opdsl.ops.core_named_ops.Optional[opdsl.ops.core_named_ops.Sequence[AffineMapAttr]] = None, cast: opdsl.ops.core_named_ops.Optional[opdsl.ops.core_named_ops.Union[opdsl.ops.core_named_ops.TypeFn, Attribute]] = None)
mlir.dialects.linalg.batch_matmul(*ins: opdsl.ops.core_named_ops.Union[Operation, OpView, Value], outs: opdsl.ops.core_named_ops.Sequence[opdsl.ops.core_named_ops.Union[Operation, OpView, Value]], indexing_maps: opdsl.ops.core_named_ops.Optional[opdsl.ops.core_named_ops.Sequence[AffineMapAttr]] = None, cast: opdsl.ops.core_named_ops.Optional[opdsl.ops.core_named_ops.Union[opdsl.ops.core_named_ops.TypeFn, Attribute]] = None)
mlir.dialects.linalg.batch_reduce_matmul(*ins: opdsl.ops.core_named_ops.Union[Operation, OpView, Value], outs: opdsl.ops.core_named_ops.Sequence[opdsl.ops.core_named_ops.Union[Operation, OpView, Value]], indexing_maps: opdsl.ops.core_named_ops.Optional[opdsl.ops.core_named_ops.Sequence[AffineMapAttr]] = None, cast: opdsl.ops.core_named_ops.Optional[opdsl.ops.core_named_ops.Union[opdsl.ops.core_named_ops.TypeFn, Attribute]] = None)
mlir.dialects.linalg.contract(*ins: opdsl.ops.core_named_ops.Union[Operation, OpView, Value], outs: opdsl.ops.core_named_ops.Sequence[opdsl.ops.core_named_ops.Union[Operation, OpView, Value]], indexing_maps: opdsl.ops.core_named_ops.Sequence[AffineMapAttr], cast: opdsl.ops.core_named_ops.Optional[opdsl.ops.core_named_ops.Union[opdsl.ops.core_named_ops.TypeFn, Attribute]] = None)
class mlir.dialects.linalg.ElementwiseOp_(result_tensors, inputs, outputs, kind, *, indexing_maps=None, loc=None, ip=None)

Bases: mlir.dialects._linalg_ops_gen.ElementwiseOp

The attribute kind describes arithmetic operation to perform. The operation kind can be unary (e.g. max), binary (e.g. add) or ternary (e.g. select).

By default, all indexing maps are identities. In the case of default indexing map, all input and output shapes must match. The number of dims in each of the identity maps is equal to the rank of the output type.

Affine-maps for operands and result are required to be provided by the user when a transpose and/or broadcast is needed on any operand. When a map is not provided, default identity maps are inferred for each operand.

Iterator-types are always all parallel. Iterator-types are needed for constructing the underlying structured op.

The number of dims of the iterator-types are inferred from the rank of the result type.

Example:

Defining a unary linalg.elementwise with default indexing-map:

%exp = linalg.elementwise
    kind=#linalg.elementwise_kind<exp>
    ins(%x : tensor<4x16x8xf32>)
    outs(%y: tensor<4x16x8xf32>) -> tensor<4x16x8xf32>

Defining a binary linalg.elementwise with user-defined indexing-map:

%add = linalg.elementwise
    kind=#linalg.elementwise_kind<add>
    indexing_maps = [#transpose, #broadcast, #identity]
    ins(%exp, %arg1 : tensor<4x16x8xf32>, tensor<4x16xf32>)
    outs(%arg2: tensor<4x8x16xf32>) -> tensor<4x8x16xf32>
mlir.dialects.linalg.ElementwiseOp
mlir.dialects.linalg.elementwise(*ins: opdsl.ops.core_named_ops.Union[Operation, OpView, Value], outs: opdsl.ops.core_named_ops.Sequence[opdsl.ops.core_named_ops.Union[Operation, OpView, Value]], kind: opdsl.ops.core_named_ops.Union[mlir.dialects._linalg_enum_gen.ElementwiseKind, Attribute], indexing_maps: opdsl.ops.core_named_ops.Optional[opdsl.ops.core_named_ops.Sequence[AffineMapAttr]] = None)
mlir.dialects.linalg.pack(source, dest, inner_dims_pos, inner_tiles, *, padding_value=None, outer_dims_perm=None, loc=None, ip=None) opdsl.ops.core_named_ops.ir.Value
mlir.dialects.linalg.unpack(source, dest, inner_dims_pos, inner_tiles, *, outer_dims_perm=None, loc=None, ip=None) opdsl.ops.core_named_ops.ir.Value
mlir.dialects.linalg.reduce
mlir.dialects.linalg.map