# 'emitasc' Dialect C++ emission support dialect * [Operations](#operations) * [`emitasc.call_opaque` (emitasc::CallOpaqueOp)](#emitasc-call-opaque-emitasc-callopaqueop) * [`emitasc.copy_struct` (emitasc::CopyStructOp)](#emitasc-copy-struct-emitasc-copystructop) * [`emitasc.declare_py_struct` (emitasc::DeclarePyStructOp)](#emitasc-declare-py-struct-emitasc-declarepystructop) * [`emitasc.dereference` (emitasc::DereferenceOp)](#emitasc-dereference-emitasc-dereferenceop) * [`emitasc.mask` (emitasc::MaskOp)](#emitasc-mask-emitasc-maskop) * [`emitasc.member` (emitasc::MemberOp)](#emitasc-member-emitasc-memberop) * [`emitasc.member_ptr` (emitasc::MemberPtrOp)](#emitasc-member-ptr-emitasc-memberptrop) * [`emitasc.member_ref` (emitasc::MemberRefOp)](#emitasc-member-ref-emitasc-memberrefop) * [`emitasc.ptr_offset` (emitasc::PtrOffsetOp)](#emitasc-ptr-offset-emitasc-ptroffsetop) * [`emitasc.reinterpret_cast` (emitasc::ReinterpretCastOp)](#emitasc-reinterpret-cast-emitasc-reinterpretcastop) * [`emitasc.set_member` (emitasc::SetMemberOp)](#emitasc-set-member-emitasc-setmemberop) * [`emitasc.variable` (emitasc::VariableOp)](#emitasc-variable-emitasc-variableop) * [`emitasc.verbatim` (emitasc::VerbatimOp)](#emitasc-verbatim-emitasc-verbatimop) * [Attributes](#attributes) * [KernelArgumentAttr](#kernelargumentattr) * [Types](#types) * [MaskType](#masktype) * [PyStructType](#pystructtype) * [Enums](#enums) * [KernelArgument](#kernelargument) ## Operations ### `emitasc.call_opaque` (emitasc::CallOpaqueOp) _Call C++ function by its name_ Syntax: ``` operation ::= `emitasc.call_opaque` $callee `(` $callee_operands `)` attr-dict `:` functional-type($callee_operands, $result) ``` Callee name must be demangled. It may include namespaces and template arguments. Constructor should be represented as its parent class name. #### Attributes:
AttributeMLIR TypeDescription
callee::mlir::StringAttrstring attribute
#### Operands: | Operand | Description | | :-----: | ----------- | | `callee_operands` | variadic of any type #### Results: | Result | Description | | :----: | ----------- | | `result` | any type ### `emitasc.copy_struct` (emitasc::CopyStructOp) _Create local structure and perform memcpy from another one_ Syntax: ``` operation ::= `emitasc.copy_struct` $base attr-dict `:` type($base) `,` type($result) ``` #### Operands: | Operand | Description | | :-----: | ----------- | | `base` | memref of any type values #### Results: | Result | Description | | :----: | ----------- | | `result` | any type ### `emitasc.declare_py_struct` (emitasc::DeclarePyStructOp) _Declare custom structure_ Syntax: ``` operation ::= `emitasc.declare_py_struct` $pystruct attr-dict ``` Traits: `AlwaysSpeculatableImplTrait` Interfaces: `ConditionallySpeculatable`, `NoMemoryEffect (MemoryEffectOpInterface)` Effects: `MemoryEffects::Effect{}` #### Attributes:
AttributeMLIR TypeDescription
pystruct::mlir::TypeAttrany type attribute
### `emitasc.dereference` (emitasc::DereferenceOp) _Dereference pointer to underlying object (unary `operator*`)_ Syntax: ``` operation ::= `emitasc.dereference` $base attr-dict `:` type($base) `,` type($result) ``` Traits: `AlwaysSpeculatableImplTrait` Interfaces: `ConditionallySpeculatable`, `NoMemoryEffect (MemoryEffectOpInterface)` Effects: `MemoryEffects::Effect{}` #### Operands: | Operand | Description | | :-----: | ----------- | | `base` | memref of any type values #### Results: | Result | Description | | :----: | ----------- | | `result` | any type ### `emitasc.mask` (emitasc::MaskOp) _Creates a mask in bit-by-bit mode (pair of 64-bit integers)_ Syntax: ``` operation ::= `emitasc.mask` $maskH `,` $maskL attr-dict ``` Traits: `AlwaysSpeculatableImplTrait` Interfaces: `ConditionallySpeculatable`, `NoMemoryEffect (MemoryEffectOpInterface)` Effects: `MemoryEffects::Effect{}` #### Operands: | Operand | Description | | :-----: | ----------- | | `maskH` | 64-bit signless integer | `maskL` | 64-bit signless integer #### Results: | Result | Description | | :----: | ----------- | | `mask` | ### `emitasc.member` (emitasc::MemberOp) Syntax: ``` operation ::= `emitasc.member` $base $field attr-dict `:` type($base) `,` type($result) ``` #### Attributes:
AttributeMLIR TypeDescription
field::mlir::StringAttrstring attribute
#### Operands: | Operand | Description | | :-----: | ----------- | | `base` | any type #### Results: | Result | Description | | :----: | ----------- | | `result` | any type ### `emitasc.member_ptr` (emitasc::MemberPtrOp) _Access pointer-to-struct member (`operator->`)_ Syntax: ``` operation ::= `emitasc.member_ptr` $base `[` $index `]` ($field^)? attr-dict `:` type($base) `,` type($result) ``` This operation represents getting an address of a struct member at the given pointer, and it should be emitted as the following: ```cpp auto *result = (ResultT *)&base->member; ``` Traits: `AlwaysSpeculatableImplTrait` Interfaces: `ConditionallySpeculatable`, `NoMemoryEffect (MemoryEffectOpInterface)` Effects: `MemoryEffects::Effect{}` #### Attributes:
AttributeMLIR TypeDescription
index::mlir::IntegerAttrindex attribute
field::mlir::StringAttrstring attribute
#### Operands: | Operand | Description | | :-----: | ----------- | | `base` | memref of any type values #### Results: | Result | Description | | :----: | ----------- | | `result` | memref of any type values ### `emitasc.member_ref` (emitasc::MemberRefOp) _Access pointer-to-struct member (emit result as reference)_ Syntax: ``` operation ::= `emitasc.member_ref` $base `[` $index `]` ($field^)? attr-dict `:` type($base) `,` type($result) ``` This operation represents obtaining a struct member at the given pointer as a reference, and it should be emitted as the following: ```cpp ResultT &result = base->member; ``` Traits: `AlwaysSpeculatableImplTrait` Interfaces: `ConditionallySpeculatable`, `NoMemoryEffect (MemoryEffectOpInterface)` Effects: `MemoryEffects::Effect{}` #### Attributes:
AttributeMLIR TypeDescription
index::mlir::IntegerAttrindex attribute
field::mlir::StringAttrstring attribute
#### Operands: | Operand | Description | | :-----: | ----------- | | `base` | memref of any type values #### Results: | Result | Description | | :----: | ----------- | | `result` | any type ### `emitasc.ptr_offset` (emitasc::PtrOffsetOp) _Apply `operator+` between pointer and offset_ Syntax: ``` operation ::= `emitasc.ptr_offset` $base `[` ($dynamicOffset^):($staticOffset ` `)? `]` attr-dict `:` type($base) `,` type($result) ``` Traits: `AlwaysSpeculatableImplTrait` Interfaces: `ConditionallySpeculatable`, `NoMemoryEffect (MemoryEffectOpInterface)`, `ViewLikeOpInterface` Effects: `MemoryEffects::Effect{}` #### Attributes:
AttributeMLIR TypeDescription
staticOffset::mlir::IntegerAttrindex attribute
#### Operands: | Operand | Description | | :-----: | ----------- | | `base` | memref of any type values | `dynamicOffset` | index #### Results: | Result | Description | | :----: | ----------- | | `result` | memref of any type values ### `emitasc.reinterpret_cast` (emitasc::ReinterpretCastOp) _Convert between types by reinterpreting the underlying data_ Syntax: ``` operation ::= `emitasc.reinterpret_cast` $source attr-dict `:` type($source) `to` type($result) ``` Traits: `AlwaysSpeculatableImplTrait` Interfaces: `CastOpInterface`, `ConditionallySpeculatable`, `NoMemoryEffect (MemoryEffectOpInterface)` Effects: `MemoryEffects::Effect{}` #### Operands: | Operand | Description | | :-----: | ----------- | | `source` | any type #### Results: | Result | Description | | :----: | ----------- | | `result` | any type ### `emitasc.set_member` (emitasc::SetMemberOp) Syntax: ``` operation ::= `emitasc.set_member` $base $field `,` $value attr-dict `:` type($base) `,` type($value) ``` #### Attributes:
AttributeMLIR TypeDescription
field::mlir::StringAttrstring attribute
#### Operands: | Operand | Description | | :-----: | ----------- | | `base` | any type | `value` | any type ### `emitasc.variable` (emitasc::VariableOp) _Define a mutable variable_ Syntax: ``` operation ::= `emitasc.variable` attr-dict ($dynamicInit^ `:` type($dynamicInit)):($staticInit)? `,` type($result) ``` This operation combines an allocation and storing a value to `memref<1x...>`. Its element type must be the same as _init_ type (either static or dynamic). Traits: `AlwaysSpeculatableImplTrait` Interfaces: `ConditionallySpeculatable`, `NoMemoryEffect (MemoryEffectOpInterface)` Effects: `MemoryEffects::Effect{}` #### Attributes:
AttributeMLIR TypeDescription
staticInit::mlir::TypedAttr
TypedAttr instance{{% markdown %}} This interface is used for attributes that have a type. The type of an attribute is understood to represent the type of the data contained in the attribute and is often used as the type of a value with this data. {{% /markdown %}}
#### Operands: | Operand | Description | | :-----: | ----------- | | `dynamicInit` | any type #### Results: | Result | Description | | :----: | ----------- | | `result` | non-0-ranked.memref of any type values ### `emitasc.verbatim` (emitasc::VerbatimOp) Syntax: ``` operation ::= `emitasc.verbatim` $value ($args^ `:` type($args))? attr-dict ``` #### Attributes:
AttributeMLIR TypeDescription
value::mlir::StringAttrstring attribute
#### Operands: | Operand | Description | | :-----: | ----------- | | `args` | variadic of any type ## Attributes ### KernelArgumentAttr kind of kernel argument for the launcher Syntax: ``` #emitasc.kernel_arg< ::mlir::emitasc::KernelArgument # value > ``` Describes kind of kernel argument: explicit argument, target specific argument (workspace, ffts address, etc.) #### Parameters: | Parameter | C++ type | Description | | :-------: | :-------: | ----------- | | value | `::mlir::emitasc::KernelArgument` | an enum of type KernelArgument | ## Types ### MaskType Syntax: `!emitasc.mask` Represents 2-element array with high and low mask ### PyStructType Syntax: ``` !emitasc.py_struct< StringAttr, # nameAttr ArrayAttr, # typesAttr ArrayAttr # namesAttr > ``` #### Parameters: | Parameter | C++ type | Description | | :-------: | :-------: | ----------- | | nameAttr | `StringAttr` | | | typesAttr | `ArrayAttr` | | | namesAttr | `ArrayAttr` | | ## Enums ### KernelArgument kernel argument #### Cases: | Symbol | Value | String | | :----: | :---: | ------ | | Explicit | `0` | explicit | | FftsAddr | `1` | ffts_addr |