‘symbol’ Dialect

Symbol dialect to represent and expresses dynamic shape’s relationship.

Operations

symbol.bind_symbolic_shape (symbol::BindSymbolicShapeOp)

Binds shape expressions to tensors using an affine map indexed by shape symbols

The symbol.bind_symbolic_shape operation binds shape expressions useful to compute the dynamic dimensions of a tensor. It takes a variadic of SSA symbols that map 1:1 to the local symbols declared in the affine map. The affine map contains a list of affine shape expressions for each dim where the terminals are from the declared symbols.

Example:

symbol.bind_symbolic_shape %arg0, [%0, %1], affine_map<()[s0, s1] -> (s0, s1, 3)> : tensor<?x?x3xf32>
symbol.bind_symbolic_shape %out0, [%0, %1, %2], affine_map<()[s0, s1, s2] -> (s0, s1 * 2 + s2, 3)> : tensor<?x?x3xf32>

Attributes

Attribute

MLIR Type

Description

shape_expressions

::mlir::AffineMapAttr

An Attribute containing an AffineMap object

Syntax:
affine-map-attribute ::= affine_map<affine-map>

Examples:
affine_map<(d0) -> (d0)>
affine_map<(d0, d1, d2) -> (d0, d1)>

Operands

Operand

Description

operand

shaped of any type values

shape_symbols

variadic of index

symbol.symbolic_int (symbol::SymbolicIntOp)

Represents a symbolic integer with a constrained range

The “symbolic_int” operation represents a symbolic integer value by name (via a symbol attribute) and returns it as an index-typed value. It includes range constraints through min_val and max_val attributes that specify the inclusive bounds for the symbolic value.

This operation is typically used to represent dynamic dimensions or other symbolic integer values that have known constraints.

Example:

%0 = symbol.symbolic_int @s0 {min_val = 5, max_val = 10} : index
%1 = symbol.symbolic_int @s1 {min_val = 2, max_val = 20} : index
%2 = symbol.symbolic_int @s2 [%0, %1], affine_map<()[s1, s2] -> (s1 * s2)> {min_val = 2, max_val = 20} : index

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), OpAsmOpInterface

Effects: MemoryEffects::Effect{}

Attributes

Attribute

MLIR Type

Description

symbol_name

::mlir::FlatSymbolRefAttr

flat symbol reference attribute

min_val

::mlir::IntegerAttr

64-bit signless integer attribute

max_val

::mlir::IntegerAttr

64-bit signless integer attribute

int_expressions

::mlir::AffineMapAttr

An Attribute containing an AffineMap object

Syntax:
affine-map-attribute ::= affine_map<affine-map>

Examples:
affine_map<(d0) -> (d0)>
affine_map<(d0, d1, d2) -> (d0, d1)>

Operands

Operand

Description

int_symbols

variadic of index

Results

Result

Description

result

index