mlir.dialects.linalg.opdsl.ops.core_named_ops

Attributes

Classes

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.

Functions

bind_op_def(op_def)

current_op_def(...)

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, ...)

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.

Module Contents

mlir.dialects.linalg.opdsl.ops.core_named_ops.StructuredOpOuts
mlir.dialects.linalg.opdsl.ops.core_named_ops.bind_op_def(op_def: mlir.dialects.linalg.opdsl.lang.emitter.LinalgOpDef)
mlir.dialects.linalg.opdsl.ops.core_named_ops.current_op_def() mlir.dialects.linalg.opdsl.lang.emitter.LinalgOpDef
class mlir.dialects.linalg.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.linalg_structured_op(dsl_func=None, *, op_name=None, op_class_name=None) DefinedOpCallable
mlir.dialects.linalg.opdsl.ops.core_named_ops.domain(*dimensions: mlir.dialects.linalg.opdsl.lang.emitter.DimDef)
mlir.dialects.linalg.opdsl.ops.core_named_ops.implements(*interfaces: mlir.dialects.linalg.opdsl.lang.emitter.OpInterfaceDef)
mlir.dialects.linalg.opdsl.ops.core_named_ops.defines(*definitions: mlir.dialects.linalg.opdsl.lang.emitter.OpDefinitionDef)
class mlir.dialects.linalg.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.UnaryFn

Unary function namespace.

exp
log
abs
ceil
floor
negf
reciprocal
round
sqrt
rsqrt
square
tanh
erf
class mlir.dialects.linalg.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.TernaryFn

Ternary function namespace.

select
class mlir.dialects.linalg.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.ReduceFn
add
mul
max_signed
min_signed
max_unsigned
min_unsigned
class mlir.dialects.linalg.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.OpInterfaceDef(cpp_name: str)

An interface that an op implements.

cpp_name
mlir.dialects.linalg.opdsl.ops.core_named_ops.ContractionOpInterface
mlir.dialects.linalg.opdsl.ops.core_named_ops.ConvolutionOpInterface
mlir.dialects.linalg.opdsl.ops.core_named_ops.FillOpInterface
class mlir.dialects.linalg.opdsl.ops.core_named_ops.OpDefinitionDef(def_name: str)

A method that an op implements.

def_name
mlir.dialects.linalg.opdsl.ops.core_named_ops.Canonicalizer
class mlir.dialects.linalg.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.D
class mlir.dialects.linalg.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.S
class mlir.dialects.linalg.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.ScalarArg(arg: str)

A type of ScalarExpression that references a named argument.

arg
expr() ScalarExpression
__repr__()
class mlir.dialects.linalg.opdsl.ops.core_named_ops.ScalarConst(value: str)

A type of ScalarExpression representing a constant.

value
expr() ScalarExpression
__repr__()
class mlir.dialects.linalg.opdsl.ops.core_named_ops.ScalarIndex(dim: int)

A type of ScalarExpression accessing an iteration index.

dim
expr() ScalarExpression
__repr__()
class mlir.dialects.linalg.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.TV
mlir.dialects.linalg.opdsl.ops.core_named_ops.I32
mlir.dialects.linalg.opdsl.ops.core_named_ops.I64
mlir.dialects.linalg.opdsl.ops.core_named_ops.F32
mlir.dialects.linalg.opdsl.ops.core_named_ops.F64
mlir.dialects.linalg.opdsl.ops.core_named_ops.T
mlir.dialects.linalg.opdsl.ops.core_named_ops.U
mlir.dialects.linalg.opdsl.ops.core_named_ops.V
mlir.dialects.linalg.opdsl.ops.core_named_ops.yaml_dump(data, sort_keys=False, **kwargs)
mlir.dialects.linalg.opdsl.ops.core_named_ops.yaml_dump_all(data, sort_keys=False, explicit_start=True, **kwargs)
class mlir.dialects.linalg.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.ValueList
mlir.dialects.linalg.opdsl.ops.core_named_ops.T1
mlir.dialects.linalg.opdsl.ops.core_named_ops.T2
mlir.dialects.linalg.opdsl.ops.core_named_ops.Batch
mlir.dialects.linalg.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.opdsl.ops.core_named_ops.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.