Skip to content

'vmvx' Dialectlink

Vector extensions to the IREE VM.

This is a reference dialect representing a simple IREE VM-based linear algebra module that is used as a library at runtime. The ops in this dialect map (roughly) 1:1 with the exported functions in the runtime module.

See vmvx.imports.mlir for the full list of exported functions.

Operationslink

ABI opslink

vmvx.binary (VMVX::BinaryOp)link

Performs a strided elementwise operation on two same-rank buffers

Syntax:

operation ::= `vmvx.binary` `op` `` `(` $opcode `:` $element_type `)`
              `lhs` `` `(` $lhs_buffer `offset` $lhs_offset `strides` `[` $lhs_strides `]` `:` type($lhs_buffer) `)`
              `rhs` `` `(` $rhs_buffer `offset` $rhs_offset `strides` `[` $rhs_strides `]` `:` type($rhs_buffer) `)`
              `out` `` `(` $out_buffer `offset` $out_offset `strides` `[` $out_strides `]` `:` type($out_buffer) `)`
              `sizes` `` `(` $sizes `)`
              attr-dict

Performs the operation in-place as if:

  OUT = OP(LHS, RHS)

Where OP is a concrete operation name as defined in ukernel/elementwise.h

Traits: SameVariadicOperandSize

Attributes:link
AttributeMLIR TypeDescription
opcode::mlir::StringAttrstring attribute
element_type::mlir::TypeAttrtype attribute of 8-bit signless integer or 16-bit signless integer or 32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float
Operands:link
Operand Description
lhs_buffer a reference counted byte buffer
lhs_offset index
lhs_strides variadic of index
rhs_buffer a reference counted byte buffer
rhs_offset index
rhs_strides variadic of index
out_buffer a reference counted byte buffer
out_offset index
out_strides variadic of index
sizes variadic of index

vmvx.copy (VMVX::CopyOp)link

Copy from one buffer to another

Syntax:

operation ::= `vmvx.copy` `in` `` `(` $in_buffer `offset` $in_offset `strides` `[` $in_strides `]` `:` type($in_buffer) `)`
              `out` `` `(` $out_buffer `offset` $out_offset `strides` `[` $out_strides `]` `:` type($out_buffer) `)`
              `sizes` `` `(` $sizes `)`
              `:` $element_type
              attr-dict

Traits: SameVariadicOperandSize

Attributes:link
AttributeMLIR TypeDescription
element_type::mlir::TypeAttrtype attribute of 8-bit signless integer or 16-bit signless integer or 32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float
Operands:link
Operand Description
in_buffer a reference counted byte buffer
in_offset index
in_strides variadic of index
out_buffer a reference counted byte buffer
out_offset index
out_strides variadic of index
sizes variadic of index

vmvx.fill2d (VMVX::Fill2DOp)link

Fill a tile with a scalar

Syntax:

operation ::= `vmvx.fill2d` `scalar` `` `(` $scalar `:` type($scalar) `)`
              `out` `` `(` $out_buffer `offset` $out_offset `row_stride` $out_row_stride `:` type($out_buffer) `)`
              `sizes` `` `(` $m `,` $n `)`
              attr-dict

Fills a tile with dimensions [m, n] with a scalar.

Operands:link
Operand Description
scalar 8-bit signless integer or 16-bit signless integer or 32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float
out_buffer a reference counted byte buffer
out_offset index
out_row_stride index
m index
n index

vmvx.unary (VMVX::UnaryOp)link

Performs a strided elementwise unary operation

Syntax:

operation ::= `vmvx.unary` `op` `` `(` $opcode `:` $element_type `)`
              `in` `` `(` $in_buffer `offset` $in_offset `strides` `[` $in_strides `]` `:` type($in_buffer) `)`
              `out` `` `(` $out_buffer `offset` $out_offset `strides` `[` $out_strides `]` `:` type($out_buffer) `)`
              `sizes` `` `(` $sizes `)`
              attr-dict

Performs the operation in-place as if:

  OUT = OP(IN)

Where OP is a concrete operation name as defined in ukernel/elementwise.h

Traits: SameVariadicOperandSize

Attributes:link
AttributeMLIR TypeDescription
opcode::mlir::StringAttrstring attribute
element_type::mlir::TypeAttrtype attribute of 8-bit signless integer or 16-bit signless integer or 32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float
Operands:link
Operand Description
in_buffer a reference counted byte buffer
in_offset index
in_strides variadic of index
out_buffer a reference counted byte buffer
out_offset index
out_strides variadic of index
sizes variadic of index

Utility opslink

vmvx.get_buffer_descriptor (VMVX::GetBufferDescriptorOp)link

Late binds a base buffer/offset/strides

Syntax:

operation ::= `vmvx.get_buffer_descriptor` $source `:` type($source) `->` type(results) attr-dict

Queries a base buffer, offset and strides. This op is late bound to its source (alloca, binding, etc), allowing additional layers of transformations to be added as lowering progresses (or for buffers to be combined).

This op has canonicalization rules which will bubble it up through the view stack. A final reconciliation pass is used explicitly to bind it to concrete sources.

Traits: AlwaysSpeculatableImplTrait, SameVariadicResultSize

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:link
Operand Description
source memref of any type values
Results:link
Result Description
base_buffer a reference counted byte buffer
offset index
sizes variadic of index
strides variadic of index

vmvx.get_raw_interface_binding_buffer (VMVX::GetRawInterfaceBindingBufferOp)link

Gets the raw buffer associated with a binding

Syntax:

operation ::= `vmvx.get_raw_interface_binding_buffer` `set` `(` $set `)` `binding` `(` $binding `)` attr-dict

Normally, a slice of a binding buffer is returned via hal.interface.binding.subspan. However, the normal VMVX lowering flow for this presumes that the result is a memref, and upon final conversion, it will offset the memref automatically to make it consistent.

This op is used in situations where earlier in a lowering, we have fully resolved the binding to a buffer and would just like the raw backing buffer as passed to the interface.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:link
AttributeMLIR TypeDescription
set::mlir::IntegerAttrindex attribute
binding::mlir::IntegerAttrindex attribute
Results:link
Result Description
buffer a reference counted byte buffer