tvm
Classes | Typedefs | Enumerations
tvm::runtime::relax_vm Namespace Reference

Classes

struct  Instruction
 A single virtual machine instruction. More...
 
struct  VMFuncInfo
 Information entry in executable function table. More...
 
class  Executable
 The executable emitted by the VM compiler. More...
 
struct  NDArrayCacheMetadata
 Metadata for NDArray cache, which by default, is named as "ndarray-cache.json". More...
 
class  VMClosureObj
 An object representing a vm closure. More...
 
class  VMClosure
 reference to closure. More...
 
class  VMExtensionNode
 Represent a VM extension. A VM extension allows the user to extend the VM with target specific functionalities. The VM holds the reference of the extensions to ensure the extensions have the same lifetime as the VM. More...
 
class  VMExtension
 Managed reference to VM extension. More...
 
class  VirtualMachine
 The virtual machine. More...
 

Typedefs

using ExecWord = int64_t
 The storage type for the bytecode in the VM. More...
 
using RegName = ExecWord
 A register name. More...
 
using Index = ExecWord
 An alias for the integer type used ubiquitously in the VM. More...
 

Enumerations

enum class  MatchShapeCode : int { kAssertEqualToImm = 0 , kStoreToHeap = 1 , kNoOp = 2 , kAssertEqualToLoad = 3 }
 Op code used in built-in match-shape function. More...
 
enum class  MakeShapeCode : int { kUseImm = 0 , kLoadShape = 1 }
 Op code used in builtin function MakeShape. More...
 
enum class  Opcode { Call = 1U , Ret = 2U , Goto = 3U , If = 4U }
 An enumeration of Relax's opcodes. More...
 
enum class  VMInstrumentReturnKind : int { kNoOp = 0 , kSkipRun = 1 }
 Possible instrument actions. More...
 

Typedef Documentation

◆ ExecWord

using tvm::runtime::relax_vm::ExecWord = typedef int64_t

The storage type for the bytecode in the VM.

◆ Index

An alias for the integer type used ubiquitously in the VM.

◆ RegName

A register name.

Enumeration Type Documentation

◆ MakeShapeCode

Op code used in builtin function MakeShape.

MakeShape(shape_heap, n, c[0], r[0], c[1], r[1], ... c[n], r[n]).

Note
It is OK to pass nullptr to shape_heap if all code are UseImm.
Enumerator
kUseImm 

Use the following r[i] as immediate shape value.

kLoadShape 

Load shape value from the shape_heap[[r[i]].

◆ MatchShapeCode

Op code used in built-in match-shape function.

The function takes the following signature:

MatchShape(input_shape, shape_heap, n, c[0], r[0], c[1], r[1], ... c[n], r[n], err_ctx)

This function provides runtime shape population and checking support for match-cast. When a shape variable appears in the first time, we should load the shape and populate the variable. When a shape variable already appears, we should assert that it already equals an existing shape value.

NOTE: It is OK to pass nullptr shape_heap if all code are AssertEqualToImm.

Enumerator
kAssertEqualToImm 

Perform an assertion that shape equals immediate.

assert input_shape[i] == r[i]

kStoreToHeap 

This is the first time we see a symbolic shape variable, store to heap.

shape_heap[r[i]] = input_shape[i]

kNoOp 

skip and do not do anything.

kAssertEqualToLoad 

Peform an assertion that the shape equals a loaded value.

assert input_shape[i] == shape_heap[r[i]]

◆ Opcode

An enumeration of Relax's opcodes.

The opcode is used to implement instruction as a tagged union.

Enumerator
Call 
Ret 
Goto 
If 

◆ VMInstrumentReturnKind

Possible instrument actions.

Enumerator
kNoOp 

Running as normal.

kSkipRun 

Skip the following run, only valid in before.