emitpy.assign_global (tt::emitpy::AssignGlobalOp)
Assign a value to a global variable
The emitpy.assign_global assignes the value to an existing named global variable.
Example:
emitpy.assign_global @value = %arg0 : !emitpy.opaque<"[ttnn.Tensor]">
Interfaces: SymbolUserOpInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
name | ::mlir::FlatSymbolRefAttr | flat symbol reference attribute |
Operands:
| Operand | Description |
|---|---|
value | any type |
emitpy.assign (tt::emitpy::AssignOp)
Assign operation
Syntax:
operation ::= `emitpy.assign` $value attr-dict `:` functional-type(operands, results)
The emitpy.assign operation represents a Python variable assignment.
This models new_var = old_var or var = constant.
Example:
%2 = emitpy.assign %1 : <!emitpy.opaque<"ttnn.Tensor">>
// Code emitted for the operation above.
v2 = v1;
Operands:
| Operand | Description |
|---|---|
value | EmitPy opaque type |
Results:
| Result | Description |
|---|---|
result | any type |
emitpy.call_opaque (tt::emitpy::CallOpaqueOp)
Opaque call operation
Syntax:
operation ::= `emitpy.call_opaque` $callee `(` $operands `)` attr-dict `:` functional-type($operands, results)
The emitpy.call_opaque operation represents a Python function call. The callee
can be an arbitrary non-empty string.
Example:
%2 = emitpy.call_opaque "ttnn.add"(%0, %1) {args = [0 : index, 1 : index, #emitpy.opaque<"ttnn.DataType.BFLOAT16">, #emitpy.opaque<"ttnn.MemoryConfig(ttnn.TensorMemoryLayout.INTERLEAVED, ttnn.BufferType.DRAM, None)">], keyword_args = ["", "", "dtype", "memory_config"]} : (!emitpy.opaque<"ttnn.Tensor">, !emitpy.opaque<"ttnn.Tensor">) -> !emitpy.opaque<"ttnn.Tensor">
Interfaces: PyExpressionInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
callee | ::mlir::StringAttr | string attribute |
args | ::mlir::ArrayAttr | array attribute |
keyword_args | ::mlir::ArrayAttr | string array attribute |
Operands:
| Operand | Description |
|---|---|
operands | variadic of any type |
Results:
| Result | Description |
|---|---|
| «unnamed» | variadic of any type |
emitpy.constant (tt::emitpy::ConstantOp)
Constant operation
The emitpy.constant operation produces an SSA value equal to some constant
specified by an attribute. This can be used to form simple integer and
floating point constants, as well as more exotic things like tensor
constants.
Traits: ConstantLike
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
value | ::mlir::Attribute | An opaque attribute or TypedAttr instance |
Results:
| Result | Description |
|---|---|
result | any type |
emitpy.get_global (tt::emitpy::GetGlobalOp)
Obtain access to a global variable
Syntax:
operation ::= `emitpy.get_global` $name `:` type($result) attr-dict
The emitpy.get_global operation retrieves the value of a named global variable.
Example:
%1 = emitpy.get_global @x : !emitpy.opaque<"[ttnn.Tensor]">
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), SymbolUserOpInterface
Effects: MemoryEffects::Effect{}
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
name | ::mlir::FlatSymbolRefAttr | flat symbol reference attribute |
Results:
| Result | Description |
|---|---|
result | any type |
emitpy.global (tt::emitpy::GlobalOp)
A global variable
Syntax:
operation ::= `emitpy.global` $sym_name custom<EmitPyGlobalOpInitialValue>($initial_value) attr-dict
The emitpy.global operation defines a named global variable.
Example:
emitpy.global @x : #emitpy.opaque<"[]">
Interfaces: Symbol
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
sym_name | ::mlir::StringAttr | string attribute |
initial_value | ::mlir::Attribute | An opaque attribute or TypedAttr instance |
emitpy.global_statement (tt::emitpy::GlobalStatementOp)
Marks a variable as global for the current function scope
Syntax:
operation ::= `emitpy.global_statement` $name `:` type($result) attr-dict
The emitpy.global_statement operation represents a Python global
statement.
It marks an identifier, specified by its symbol @name, as
referring to a variable in the global (module) scope, rather
than a new local variable.
Example:
%0 = emitpy.global_statement @x : !emitpy.opaque<"[ttnn.Tensor]">
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), SymbolUserOpInterface
Effects: MemoryEffects::Effect{}
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
name | ::mlir::FlatSymbolRefAttr | flat symbol reference attribute |
Results:
| Result | Description |
|---|---|
result | any type |
emitpy.import (tt::emitpy::ImportOp)
Import operation
The emitpy.import operation allows to define a Python module import
via various forms of the import statement.
Example:
emitpy.import import "ttnn"
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
module_name | ::mlir::StringAttr | string attribute |
module_alias | ::mlir::StringAttr | string attribute |
members_to_import | ::mlir::ArrayAttr | string array attribute |
member_aliases | ::mlir::ArrayAttr | string array attribute |
import_all | ::mlir::UnitAttr | unit attribute |
emitpy.literal (tt::emitpy::LiteralOp)
Literal operation
Syntax:
operation ::= `emitpy.literal` $value attr-dict `:` type($result)
The emitpy.literal operation produces an SSA value equal to some constant
specified by an attribute.
Example:
%0 = emitpy.literal "0" : index
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), PyExpressionInterface
Effects: MemoryEffects::Effect{}
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
value | ::mlir::StringAttr | string attribute |
Results:
| Result | Description |
|---|---|
result | index |
emitpy.subscript (tt::emitpy::SubscriptOp)
Subscript operation
Syntax:
operation ::= `emitpy.subscript` $value `[` $index `]` attr-dict `:` functional-type(operands, results)
With the emitpy.subscript operation the subscript operator [] can be applied
to variables or arguments of opaque type.
Example:
%0 = emitpy.literal "0" : index
%1 = emitpy.subscript %arg0[%0] : (!emitpy.opaque<"[ttnn.Tensor]">, index) -> !emitpy.opaque<"ttnn.Tensor">
Interfaces: PyExpressionInterface
Operands:
| Operand | Description |
|---|---|
value | EmitPy opaque type |
index | index |
Results:
| Result | Description |
|---|---|
result | EmitPy opaque type |
emitpy.verbatim (tt::emitpy::VerbatimOp)
Verbatim operation
Syntax:
operation ::= `emitpy.verbatim` $value (`args` $fmtArgs^ `:` type($fmtArgs))? attr-dict
The emitpy.verbatim operation produces no results and the value is emitted as is
followed by a line break ('\n' character) during translation.
This operation can be used in situations where a more suitable operation is not yet implemented in the dialect.
Note: Use with caution. This operation can have arbitrary effects on the semantics of the emitted code. Use semantically more meaningful operations whenever possible. Additionally this op is NOT intended to be used to inject large snippets of code.
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
value | ::mlir::StringAttr | string attribute |
Operands:
| Operand | Description |
|---|---|
fmtArgs | variadic of any type |