‘emitasc’ Dialect

C++ emission support dialect

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:

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:

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