tvm
|
The 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... | |
String | AsText () const |
Print the instructions as text format. More... | |
String | AsPython () const |
Print the instructions as python program. More... | |
void | SaveToBinary (dmlc::Stream *stream) final |
Write the Executable to the binary stream in serialized form. More... | |
void | SaveToFile (const String &file_name, const String &format) final |
Write the Executable to the provided path as a file containing its serialized content. More... | |
Module | VMLoadExecutable () const |
Create a Relax virtual machine and load this as the executable. More... | |
Module | VMProfilerLoadExecutable () const |
Create a Relax virtual machine with profiler and load this as the executable. More... | |
bool | HasFunction (const String &name) const |
Check if the Executable contains a specific function. More... | |
virtual | ~Executable () |
TVM_MODULE_VTABLE_BEGIN ("relax.Executable") | |
TVM_MODULE_VTABLE_ENTRY ("stats", &Executable::Stats) | |
TVM_MODULE_VTABLE_ENTRY ("as_text", &Executable::AsText) | |
TVM_MODULE_VTABLE_ENTRY ("as_python", &Executable::AsPython) | |
TVM_MODULE_VTABLE_ENTRY ("vm_load_executable", &Executable::VMLoadExecutable) | |
TVM_MODULE_VTABLE_ENTRY ("vm_profiler_load_executable", &Executable::VMProfilerLoadExecutable) | |
TVM_MODULE_VTABLE_ENTRY ("has_function", &Executable::HasFunction) | |
TVM_MODULE_VTABLE_END () | |
Public Member Functions inherited from tvm::runtime::ModuleNode | |
virtual | ~ModuleNode ()=default |
virtual destructor More... | |
virtual const char * | type_key () const =0 |
virtual PackedFunc | GetFunction (const String &name, const ObjectPtr< Object > &sptr_to_self)=0 |
Get a PackedFunc from module. More... | |
virtual String | GetSource (const String &format="") |
Get the source code of module, when available. More... | |
virtual String | GetFormat () |
Get the format of the module, when available. More... | |
PackedFunc | GetFunction (const String &name, bool query_imports=false) |
Get packed function from current module by name. More... | |
void | Import (Module other) |
Import another module into this module. More... | |
const PackedFunc * | GetFuncFromEnv (const String &name) |
Get a function from current environment The environment includes all the imports as well as Global functions. More... | |
void | ClearImports () |
Clear all imports of the module. More... | |
const std::vector< Module > & | imports () const |
bool | IsDSOExportable () const |
Returns true if this module is 'DSO exportable'. More... | |
bool | IsBinarySerializable () const |
Returns true if this module is 'Binary Serializable'. More... | |
virtual bool | ImplementsFunction (const String &name, bool query_imports=false) |
Returns true if this module has a definition for a function of name . If query_imports is true, also search in any imported modules. More... | |
TVM_DECLARE_FINAL_OBJECT_INFO (ModuleNode, Object) | |
Public Member Functions inherited from tvm::runtime::Object | |
uint32_t | type_index () const |
std::string | GetTypeKey () const |
size_t | GetTypeKeyHash () const |
template<typename TargetType > | |
bool | IsInstance () const |
bool | unique () const |
Object () | |
Object (const Object &other) | |
Object (Object &&other) | |
Object & | operator= (const Object &other) |
Object & | operator= (Object &&other) |
Static Public Member Functions | |
static Module | LoadFromBinary (void *stream) |
Load Executable from the binary stream in serialized form. More... | |
static Module | LoadFromFile (const String &file_name) |
Load Executable from the file. More... | |
Static Public Member Functions inherited from tvm::runtime::Object | |
static std::string | TypeIndex2Key (uint32_t tindex) |
Get the type key of the corresponding index from runtime. More... | |
static size_t | TypeIndex2KeyHash (uint32_t tindex) |
Get the type key hash of the corresponding index from runtime. More... | |
static uint32_t | TypeKey2Index (const std::string &key) |
Get the type index of the corresponding key from runtime. More... | |
static uint32_t | _GetOrAllocRuntimeTypeIndex () |
static uint32_t | RuntimeTypeIndex () |
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< TVMRetValue > | 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... | |
Additional Inherited Members | |
Public Types inherited from tvm::runtime::Object | |
typedef void(* | FDeleter) (Object *self) |
Object deleter. More... | |
using | RefCounterType = std::atomic< int32_t > |
Static Public Attributes inherited from tvm::runtime::ModuleNode | |
static constexpr const uint32_t | _type_index = TypeIndex::kRuntimeModule |
static constexpr const char * | _type_key = "runtime.Module" |
Static Public Attributes inherited from tvm::runtime::Object | |
static constexpr const char * | _type_key = "runtime.Object" |
static constexpr bool | _type_final = false |
static constexpr uint32_t | _type_child_slots = 0 |
static constexpr bool | _type_child_slots_can_overflow = true |
static constexpr bool | _type_has_method_visit_attrs = true |
static constexpr bool | _type_has_method_sequal_reduce = false |
static constexpr bool | _type_has_method_shash_reduce = false |
static constexpr uint32_t | _type_index = TypeIndex::kDynamic |
Protected Member Functions inherited from tvm::runtime::Object | |
void | IncRef () |
developer function, increases reference counter. More... | |
void | DecRef () |
developer function, decrease reference counter. More... | |
Static Protected Member Functions inherited from tvm::runtime::Object | |
static uint32_t | GetOrAllocRuntimeTypeIndex (const std::string &key, uint32_t static_tindex, uint32_t parent_tindex, uint32_t type_child_slots, bool type_child_slots_can_overflow) |
Get the type index using type key. More... | |
Protected Attributes inherited from tvm::runtime::ModuleNode | |
std::vector< Module > | imports_ |
The modules this module depend on. More... | |
Protected Attributes inherited from tvm::runtime::Object | |
uint32_t | type_index_ {0} |
Type index(tag) that indicates the type of the object. More... | |
RefCounterType | ref_counter_ {0} |
The internal reference counter. More... | |
FDeleter | deleter_ = nullptr |
deleter of this object to enable customized allocation. If the deleter is nullptr, no deletion will be performed. The creator of the object must always set the deleter field properly. More... | |
The executable emitted by the VM compiler.
The executable contains information (e.g. data in different memory regions) to run in a virtual machine.
|
inlinevirtual |
String tvm::runtime::relax_vm::Executable::AsPython | ( | ) | const |
Print the instructions as python program.
String tvm::runtime::relax_vm::Executable::AsText | ( | ) | const |
Print the instructions as text format.
Instruction tvm::runtime::relax_vm::Executable::GetInstruction | ( | Index | i | ) | const |
Get the i-th instruction from the executable.
i | The index of the instruction to be fetched. |
|
inlinefinalvirtual |
Get the property of the runtime module .
Reimplemented from tvm::runtime::ModuleNode.
bool tvm::runtime::relax_vm::Executable::HasFunction | ( | const String & | name | ) | const |
Check if the Executable contains a specific function.
|
static |
Load Executable from the binary stream in serialized form.
stream | The binary stream that load the executable from. |
runtime::Module
. Load Executable from the file.
file_name | The path of the file that load the executable from. |
runtime::Module
.
|
finalvirtual |
Write the Executable to the binary stream in serialized form.
stream | The binary stream to save the executable to. |
Reimplemented from tvm::runtime::ModuleNode.
|
finalvirtual |
Write the Executable 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. |
Reimplemented from tvm::runtime::ModuleNode.
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::relax_vm::Executable::Stats | ( | ) | const |
Print the detailed statistics of the given code, i.e. number of globals and constants, etc.
tvm::runtime::relax_vm::Executable::TVM_MODULE_VTABLE_BEGIN | ( | "relax.Executable" | ) |
tvm::runtime::relax_vm::Executable::TVM_MODULE_VTABLE_END | ( | ) |
tvm::runtime::relax_vm::Executable::TVM_MODULE_VTABLE_ENTRY | ( | "as_python" | , |
&Executable::AsPython | |||
) |
tvm::runtime::relax_vm::Executable::TVM_MODULE_VTABLE_ENTRY | ( | "as_text" | , |
&Executable::AsText | |||
) |
tvm::runtime::relax_vm::Executable::TVM_MODULE_VTABLE_ENTRY | ( | "has_function" | , |
&Executable::HasFunction | |||
) |
tvm::runtime::relax_vm::Executable::TVM_MODULE_VTABLE_ENTRY | ( | "stats" | , |
&Executable::Stats | |||
) |
tvm::runtime::relax_vm::Executable::TVM_MODULE_VTABLE_ENTRY | ( | "vm_load_executable" | , |
&Executable::VMLoadExecutable | |||
) |
tvm::runtime::relax_vm::Executable::TVM_MODULE_VTABLE_ENTRY | ( | "vm_profiler_load_executable" | , |
&Executable::VMProfilerLoadExecutable | |||
) |
Module tvm::runtime::relax_vm::Executable::VMLoadExecutable | ( | ) | const |
Create a Relax virtual machine and load this
as the executable.
Module tvm::runtime::relax_vm::Executable::VMProfilerLoadExecutable | ( | ) | const |
Create a Relax virtual machine with profiler and load this
as the executable.
std::vector<TVMRetValue> tvm::runtime::relax_vm::Executable::constants |
The global constant pool.
std::unordered_map<std::string, Index> tvm::runtime::relax_vm::Executable::func_map |
A map from globals (as strings) to their index in the function map.
std::vector<VMFuncInfo> tvm::runtime::relax_vm::Executable::func_table |
The virtual machine's function table.
std::vector<ExecWord> tvm::runtime::relax_vm::Executable::instr_data |
The byte data of instruction.
std::vector<Index> tvm::runtime::relax_vm::Executable::instr_offset |
The offset of instruction.