|
tvm
|
The virtual machine executable emitted by the VM compiler. More...
#include <executable.h>
Public Member Functions | |
| int | GetPropertyMask () const final |
| Get the property of the runtime module . More... | |
| std::string | Stats () const |
| Print the detailed statistics of the given code, i.e. number of globals and constants, etc. More... | |
| Instruction | GetInstruction (Index i) const |
| Get the i-th instruction from the executable. More... | |
| void | SetInstructionData (Index i, Index j, ExecWord val) |
| Set j-th byte data of i-th instruction to val. More... | |
| ffi::String | AsText () const |
| Print the instructions as text format. More... | |
| ffi::String | AsPython () const |
| Print the instructions as python program. More... | |
| ffi::Bytes | SaveToBytes () const final |
| Write the VMExecutable to the binary stream in serialized form. More... | |
| void | WriteToFile (const ffi::String &file_name, const ffi::String &format) const final |
| Write the VMExecutable to the provided path as a file containing its serialized content. More... | |
| ffi::Module | VMLoadExecutable () const |
Create a Relax virtual machine and load this as the executable. More... | |
| ffi::Module | VMProfilerLoadExecutable () const |
Create a Relax virtual machine with profiler and load this as the executable. More... | |
| bool | HasFunction (const ffi::String &name) const |
| Check if the VMExecutable contains a specific function. More... | |
| virtual | ~VMExecutable () |
| TVM_MODULE_VTABLE_BEGIN ("relax.VMExecutable") | |
| TVM_MODULE_VTABLE_ENTRY ("stats", &VMExecutable::Stats) | |
| TVM_MODULE_VTABLE_ENTRY ("as_text", &VMExecutable::AsText) | |
| TVM_MODULE_VTABLE_ENTRY ("as_python", &VMExecutable::AsPython) | |
| TVM_MODULE_VTABLE_ENTRY ("vm_load_executable", &VMExecutable::VMLoadExecutable) | |
| TVM_MODULE_VTABLE_ENTRY ("vm_profiler_load_executable", &VMExecutable::VMProfilerLoadExecutable) | |
| TVM_MODULE_VTABLE_ENTRY ("has_function", &VMExecutable::HasFunction) | |
| TVM_MODULE_VTABLE_END () | |
Static Public Member Functions | |
| static ffi::Module | LoadFromBytes (const ffi::Bytes &bytes) |
| Load VMExecutable from the binary stream in serialized form. More... | |
| static ffi::Module | LoadFromFile (const ffi::String &file_name) |
| Load VMExecutable from the file. More... | |
Public Attributes | |
| std::vector< VMFuncInfo > | func_table |
| The virtual machine's function table. More... | |
| std::unordered_map< std::string, Index > | func_map |
| A map from globals (as strings) to their index in the function map. More... | |
| std::vector< ffi::Any > | constants |
| The global constant pool. More... | |
| std::vector< Index > | instr_offset |
| The offset of instruction. More... | |
| std::vector< ExecWord > | instr_data |
| The byte data of instruction. More... | |
The virtual machine executable emitted by the VM compiler.
The executable contains information (e.g. data in different memory regions) to run in a virtual machine.
|
inlinevirtual |
| ffi::String tvm::runtime::vm::VMExecutable::AsPython | ( | ) | const |
Print the instructions as python program.
| ffi::String tvm::runtime::vm::VMExecutable::AsText | ( | ) | const |
Print the instructions as text format.
| Instruction tvm::runtime::vm::VMExecutable::GetInstruction | ( | Index | i | ) | const |
Get the i-th instruction from the executable.
| i | The index of the instruction to be fetched. |
|
inlinefinal |
Get the property of the runtime module .
| bool tvm::runtime::vm::VMExecutable::HasFunction | ( | const ffi::String & | name | ) | const |
Check if the VMExecutable contains a specific function.
|
static |
Load VMExecutable from the binary stream in serialized form.
| bytes | The binary bytes that load the executable from. |
runtime::Module.
|
static |
Load VMExecutable from the file.
| file_name | The path of the file that load the executable from. |
runtime::Module.
|
final |
Write the VMExecutable to the binary stream in serialized form.
Set j-th byte data of i-th instruction to val.
| i | The index of the instruction to be updated. |
| j | The index of the byte data of the instruction to be updated. |
| val | The value to be set |
| std::string tvm::runtime::vm::VMExecutable::Stats | ( | ) | const |
Print the detailed statistics of the given code, i.e. number of globals and constants, etc.
| tvm::runtime::vm::VMExecutable::TVM_MODULE_VTABLE_BEGIN | ( | "relax.VMExecutable" | ) |
| tvm::runtime::vm::VMExecutable::TVM_MODULE_VTABLE_END | ( | ) |
| tvm::runtime::vm::VMExecutable::TVM_MODULE_VTABLE_ENTRY | ( | "as_python" | , |
| &VMExecutable::AsPython | |||
| ) |
| tvm::runtime::vm::VMExecutable::TVM_MODULE_VTABLE_ENTRY | ( | "as_text" | , |
| &VMExecutable::AsText | |||
| ) |
| tvm::runtime::vm::VMExecutable::TVM_MODULE_VTABLE_ENTRY | ( | "has_function" | , |
| &VMExecutable::HasFunction | |||
| ) |
| tvm::runtime::vm::VMExecutable::TVM_MODULE_VTABLE_ENTRY | ( | "stats" | , |
| &VMExecutable::Stats | |||
| ) |
| tvm::runtime::vm::VMExecutable::TVM_MODULE_VTABLE_ENTRY | ( | "vm_load_executable" | , |
| &VMExecutable::VMLoadExecutable | |||
| ) |
| tvm::runtime::vm::VMExecutable::TVM_MODULE_VTABLE_ENTRY | ( | "vm_profiler_load_executable" | , |
| &VMExecutable::VMProfilerLoadExecutable | |||
| ) |
| ffi::Module tvm::runtime::vm::VMExecutable::VMLoadExecutable | ( | ) | const |
Create a Relax virtual machine and load this as the executable.
| ffi::Module tvm::runtime::vm::VMExecutable::VMProfilerLoadExecutable | ( | ) | const |
Create a Relax virtual machine with profiler and load this as the executable.
|
final |
Write the VMExecutable to the provided path as a file containing its serialized content.
| file_name | The name of the file to write the serialized data to. |
| format | The target format of the saved file. |
| std::vector<ffi::Any> tvm::runtime::vm::VMExecutable::constants |
The global constant pool.
| std::unordered_map<std::string, Index> tvm::runtime::vm::VMExecutable::func_map |
A map from globals (as strings) to their index in the function map.
| std::vector<VMFuncInfo> tvm::runtime::vm::VMExecutable::func_table |
The virtual machine's function table.
| std::vector<ExecWord> tvm::runtime::vm::VMExecutable::instr_data |
The byte data of instruction.
| std::vector<Index> tvm::runtime::vm::VMExecutable::instr_offset |
The offset of instruction.