mlir.dialects.linalg.opdsl.lang.scalar_expr

Models DAGs of scalar math expressions.

Used for generating region bodies at the “math” level where they are still type polymorphic. This is modeled to be polymorphic by attribute name for interop with serialization schemes that are just plain-old-dicts.

These classes are typically not user accessed and are created as a by-product of interpreting a comprehension DSL and model the operations to perform in the op body. The class hierarchy is laid out to map well to a form of YAML that can be easily consumed from the C++ side, not necessarily for ergonomics.

Classes

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.

ScalarAssign

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

Module Contents

class mlir.dialects.linalg.opdsl.lang.scalar_expr.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.lang.scalar_expr.ScalarArg(arg: str)

A type of ScalarExpression that references a named argument.

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

A type of ScalarExpression representing a constant.

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

A type of ScalarExpression accessing an iteration index.

dim
expr() ScalarExpression
__repr__()
class mlir.dialects.linalg.opdsl.lang.scalar_expr.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.lang.scalar_expr.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__()