emitpy.assign
(tt::emitpy::AssignOp)
Assign operation.
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:
// Custom form defining a call to `foo()`.
%2 = emitpy.call_opaque "ttnn.add"(%0, %1) {args = [0 : index, 1 : index]} : (!emitpy.opaque<"ttnn.Tensor">, !emitpy.opaque<"ttnn.Tensor">) -> !emitpy.opaque<"ttnn.Tensor">
Attributes:
Attribute | MLIR Type | Description |
---|---|---|
callee | ::mlir::StringAttr | string attribute |
args | ::mlir::ArrayAttr | 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.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)
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<"list<ttnn.Tensor>">, index) -> !emitpy.opaque<"ttnn.Tensor">
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 |