24 #ifndef TVM_RUNTIME_VM_EXECUTABLE_H_ 25 #define TVM_RUNTIME_VM_EXECUTABLE_H_ 36 #include <unordered_map> 80 void SaveToBinary(dmlc::Stream* stream)
final;
91 void SaveToFile(
const std::string& path,
const std::string& format)
final;
125 void MoveLateBoundConstantsToStream(dmlc::Stream* stream,
size_t byte_limit);
130 void MoveLateBoundConstantsToFile(
const std::string& path,
size_t byte_limit);
143 void LoadLateBoundConstantsFromStream(dmlc::Stream* stream);
156 void LoadLateBoundConstantsFromFile(
const std::string& path);
190 std::string GetBytecode()
const;
196 std::string GetConstants()
const;
202 std::string GetVirtualDevices()
const;
209 std::string GetPrimitives()
const;
215 std::string Stats()
const;
242 const VMFunction& GetVMFunctionWithName(
const std::string& func_name)
const;
249 int GetFunctionArity(std::string func)
const;
257 std::string GetFunctionParameterName(std::string func, uint32_t index)
const;
261 const char*
type_key() const final {
return "VMExecutable"; }
272 int host_device_index = -1;
305 void SaveVirtualDevicesSection(dmlc::Stream* strm);
312 void SaveGlobalSection(dmlc::Stream* strm);
319 void SaveConstantSection(dmlc::Stream* stream);
326 void LoadConstantSection(dmlc::Stream* stream);
333 void SavePrimitiveOpNames(dmlc::Stream* strm);
340 void SaveCodeSection(dmlc::Stream* strm);
347 void LoadVirtualDevicesSection(dmlc::Stream* strm);
354 void LoadGlobalSection(dmlc::Stream* strm);
361 void LoadPrimitiveOpNames(dmlc::Stream* strm);
368 void LoadCodeSection(dmlc::Stream* strm);
378 #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:293
The executable emitted by the VM compiler.
Definition: executable.h:57
A custom smart pointer for Object.
Definition: object.h:358
std::vector< VMFunction > functions
The virtual machine's function table.
Definition: executable.h:295
Runtime String container types.
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
kBinarySerializable we can serialize the module to the stream of bytes. CUDA/OpenCL/JSON runtime are ...
Definition: module.h:56
std::vector< ObjectRef > constants
The global constant array.
Definition: executable.h:279
Byte array type used to pass in byte array When kTVMBytes is used as data type.
Definition: c_runtime_api.h:221
int GetPropertyMask() const final
Get the property of the runtime module .
Definition: executable.h:70
std::vector< Index > const_device_indexes
The index of the device holding each constant.
Definition: executable.h:297
std::unordered_map< std::string, Index > primitive_map
A mapping from the packed function's global name (as string) to the index that corresponds to the pos...
Definition: executable.h:291
const char * type_key() const final
Definition: executable.h:261
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 Relay function map.
Definition: executable.h:287
std::vector< String > late_bound_constant_names
For each constant index the name of the late-bound constant, or null if constant is immediate...
Definition: executable.h:284
A representation of a Relay function in the VM.
Definition: vm.h:77
Base container of module.
Definition: module.h:142
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:79
Map container of NodeRef->NodeRef in DSL graph. Map implements copy on write semantics, which means map is mutable but copy will happen when array is referenced in more than two places.
Definition: map.h:1271
std::vector< Device > virtual_devices
The (compile-time, virtual) devices corresponding to each device index. Currently we only support at ...
Definition: executable.h:267
Runtime Map container types.
Packed function is a type-erased function. The arguments are passed by packed format.
Definition: packed_func.h:138
Type-erased function used across TVM API.
virtual ~Executable()
Definition: executable.h:259