24 #ifndef TVM_RUNTIME_VM_EXECUTABLE_H_ 25 #define TVM_RUNTIME_VM_EXECUTABLE_H_ 36 #include <unordered_map> 80 void SaveToFile(
const std::string& path,
const std::string& format)
final;
145 std::string
Stats()
const;
184 const char*
type_key() const final {
return "VMExecutable"; }
207 void SaveGlobalSection(dmlc::Stream* strm);
214 void SaveConstantSection(dmlc::Stream* strm);
221 void SavePrimitiveOpNames(dmlc::Stream* strm);
228 void SaveCodeSection(dmlc::Stream* strm);
235 void LoadGlobalSection(dmlc::Stream* strm);
242 void LoadConstantSection(dmlc::Stream* strm);
249 void LoadPrimitiveOpNames(dmlc::Stream* strm);
256 void LoadCodeSection(dmlc::Stream* strm);
266 #endif // TVM_RUNTIME_VM_EXECUTABLE_H_ std::map< Index, Map< String, ObjectRef > > op_attrs
The structural hashes of the operators in this function.
Definition: executable.h:195
The executable emitted by the VM compiler.
Definition: executable.h:57
A custom smart pointer for Object.
Definition: object.h:356
std::vector< VMFunction > functions
The virtual machine's function table.
Definition: executable.h:197
Runtime String container types.
std::string GetFunctionParameterName(std::string func, uint32_t index) const
Get the parameter name given the function name and parameter index.
Performance counters for profiling via the PAPI library.
Definition: analyzer.h:36
std::string GetBytecode() const
Get the serialized form of the functions. This is essentially bytecode serialization.
std::vector< Index > const_device_type
The device type for each constant.
Definition: executable.h:199
void SetLib(const runtime::Module &lib)
Set the lib module in an executable.
std::vector< ObjectRef > constants
The global constant pool.
Definition: executable.h:187
Byte array type used to pass in byte array When kTVMBytes is used as data type.
Definition: c_runtime_api.h:157
TVMByteArray Save()
Serialize the executable into global section, constant section, and code section. ...
std::unordered_map< std::string, Index > primitive_map
A mapping from the packed function (as string) to the index that corresponds to the position of the p...
Definition: executable.h:193
const char * type_key() const final
Definition: executable.h:184
void SaveToBinary(dmlc::Stream *stream) final
Write the Executable to the binary stream in serialized form.
The bytecode for Relay virtual machine.
std::unordered_map< std::string, Index > global_map
A map from globals (as strings) to their index in the function map.
Definition: executable.h:189
std::string Stats() const
Print the detailed statistics of the given code, i.e. number of globls and constants, etc.
int GetFunctionArity(std::string func) const
Get the arity of the VMFunction.
Base container of module.
Definition: module.h:111
A managed object in the TVM runtime.
Runtime container of the functions generated by TVM, This is used to support dynamically link...
Module container of TVM.
Definition: module.h:48
Runtime Map container types.
PackedFunc GetFunction(const std::string &name, const ObjectPtr< Object > &sptr_to_self) final
Get a PackedFunc from an executable module.
Packed function is a type-erased function. The arguments are passed by packed format.
Definition: packed_func.h:68
static runtime::Module Load(const std::string &code, const runtime::Module lib)
Load the saved VM executable.
void SaveToFile(const std::string &path, const std::string &format) final
Write the Executable to the provided path as a file contianing its serialized content.
runtime::Module GetLib() const
Get the lib module in an executable. Users have the flexibility to call export_library from the front...
std::string GetConstants() const
Returns a description of all the contants in the executable in human-readable format. Not intended to be machine readable, but rather to help with debugging and diffing generated code.
Type-erased function used across TVM API.
virtual ~Executable()
Definition: executable.h:182