tvm
|
Namespaces | |
contrib | |
memory | |
metadata | |
micro_rpc | |
profiling | |
symbol | |
namespace for constant symbols | |
threading | |
vm | |
Classes | |
struct | PackedFuncValueConverter< PrimExpr > |
struct | PackedFuncValueConverter< tvm::Integer > |
struct | PackedFuncValueConverter< tvm::Bool > |
class | ADTObj |
An object representing a structure or enumeration. More... | |
class | ADT |
reference to algebraic data type objects. More... | |
class | ArrayNode |
array node content in array More... | |
struct | is_valid_iterator |
Helper struct for type-checking. More... | |
struct | is_valid_iterator< Optional< T >, IterType > |
class | Array |
Array, container representing a contiguous sequence of ObjectRefs. More... | |
struct | ObjectHash |
String-aware ObjectRef equal functor. More... | |
struct | ObjectEqual |
String-aware ObjectRef hash functor. More... | |
class | InplaceArrayBase |
Base template for classes with array like memory layout. More... | |
class | IterAdapter |
iterator adapter that adapts TIter to return another type. More... | |
class | ReverseIterAdapter |
iterator adapter that adapts TIter to return another type. More... | |
class | ClosureObj |
An object representing a closure. This object is used by both the Relay VM and interpreter. More... | |
class | Closure |
reference to closure. More... | |
class | MapNode |
Shared content of all specializations of hash map. More... | |
class | SmallMapNode |
A specialization of small-sized hash map. More... | |
class | DenseMapNode |
A specialization of hash map that implements the idea of array-based hash map. Another reference implementation can be found [1]. More... | |
class | Map |
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. More... | |
struct | NullOptType |
Helper to represent nullptr for optional. More... | |
class | Optional |
Optional container that to represent to a Nullable variant of T. More... | |
class | ShapeTupleObj |
An object representing a shape tuple. More... | |
class | ShapeTuple |
Reference to shape tuple objects. More... | |
class | StringObj |
An object representing string. It's POD type. More... | |
class | String |
Reference to string objects. More... | |
class | Variant |
class | DataType |
Runtime primitive data type. More... | |
class | DeviceAPI |
TVM Runtime Device API, abstracts the device specific interface for memory management. More... | |
class | ObjAllocatorBase |
Base class of object allocators that implements make. Use curiously recurring template pattern. More... | |
class | SimpleObjAllocator |
class | Module |
Module container of TVM. More... | |
class | ModuleNode |
Base container of module. More... | |
class | NDArray |
Managed NDArray. The array is backed by reference counted blocks. More... | |
struct | TypeIndex |
Namespace for the list of type index. More... | |
class | Object |
base class of all object containers. More... | |
class | ObjectPtr |
A custom smart pointer for Object. More... | |
class | ObjectRef |
Base class of all object reference. More... | |
struct | ObjectPtrHash |
ObjectRef hash functor. More... | |
struct | ObjectPtrEqual |
ObjectRef equal functor. More... | |
class | TypedPackedFunc |
Please refer to TypedPackedFunc<R(Args..)>. More... | |
struct | SignaturePrinter |
class | PackedFuncObj |
Object container class that backs PackedFunc. More... | |
class | PackedFuncSubObj |
Derived object class for constructing PackedFuncObj. More... | |
class | PackedFunc |
Packed function is a type-erased function. The arguments are passed by packed format. More... | |
class | TypedPackedFunc< R(Args...)> |
A PackedFunc wrapper to provide typed function signature. It is backed by a PackedFunc internally. More... | |
class | TVMArgs |
Arguments into TVM functions. More... | |
struct | ObjectTypeChecker |
Type traits for runtime type check during FFI conversion. More... | |
struct | ObjectTypeChecker< Array< T > > |
struct | ObjectTypeChecker< Map< K, V > > |
class | TVMPODValue_ |
Internal base class to handle conversion to POD values. More... | |
class | TVMArgValue |
A single argument value to PackedFunc. Containing both type_code and TVMValue. More... | |
class | TVMMovableArgValue_ |
Internal auxiliary struct for TypedPackedFunc to indicate a movable argument. More... | |
class | TVMMovableArgValueWithContext_ |
Internal auxiliary struct for TypedPackedFunc to indicate a movable argument with additional context information (function name and argument index) for better error reporting. More... | |
class | TVMRetValue |
Return Value container, Unlike TVMArgValue, which only holds reference and do not delete the underlying container during destruction. More... | |
struct | PackedFuncValueConverter |
Type trait to specify special value conversion rules from TVMArgValue and TVMRetValue. More... | |
class | TVMArgsSetter |
struct | TVMArgsSetterApply |
struct | PackedFuncValueConverter<::tvm::runtime::String > |
struct | PackedFuncValueConverter< Optional< T > > |
struct | PackedFuncValueConverter< Variant< VariantTypes... > > |
class | TimerNode |
Base class for all implementations. More... | |
class | Timer |
Timer for a specific device. More... | |
class | WrappedPythonObject |
A class that wraps a Python object and preserves its ownership. More... | |
class | Registry |
Registry for global function. More... | |
Typedefs | |
using | FSig = std::string() |
Using static function to output TypedPackedFunc signature. More... | |
Enumerations | |
enum | DeviceAttrKind : int { kExist = 0 , kMaxThreadsPerBlock = 1 , kWarpSize = 2 , kMaxSharedMemoryPerBlock = 3 , kComputeVersion = 4 , kDeviceName = 5 , kMaxClockRate = 6 , kMultiProcessorCount = 7 , kMaxThreadDimensions = 8 , kMaxRegistersPerBlock = 9 , kGcnArch = 10 , kApiVersion = 11 , kDriverVersion = 12 , kL2CacheSizeBytes = 13 } |
the query type into GetAttr More... | |
enum | ModulePropertyMask : int { kBinarySerializable = 0b001 , kRunnable = 0b010 , kDSOExportable = 0b100 } |
Property of runtime module We classify the property of runtime module into the following categories. More... | |
Functions | |
std::ostream & | operator<< (std::ostream &os, const ObjectRef &n) |
std::string | AsLegacyRepr (const ObjectRef &n) |
template<typename T , typename = typename std::enable_if<std::is_base_of<ObjectRef, T>::value>::type> | |
Array< T > | Concat (Array< T > lhs, const Array< T > &rhs) |
Concat two Arrays. More... | |
template<> | |
ObjectPtr< ArrayNode > | make_object () |
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type> | |
Map< K, V > | Merge (Map< K, V > lhs, const Map< K, V > &rhs) |
Merge two Maps. More... | |
String | operator+ (const String &lhs, const String &rhs) |
String | operator+ (const String &lhs, const std::string &rhs) |
String | operator+ (const std::string &lhs, const String &rhs) |
String | operator+ (const char *lhs, const String &rhs) |
String | operator+ (const String &lhs, const char *rhs) |
bool | operator< (const String &lhs, const std::string &rhs) |
bool | operator< (const std::string &lhs, const String &rhs) |
bool | operator< (const String &lhs, const String &rhs) |
bool | operator< (const String &lhs, const char *rhs) |
bool | operator< (const char *lhs, const String &rhs) |
bool | operator> (const String &lhs, const std::string &rhs) |
bool | operator> (const std::string &lhs, const String &rhs) |
bool | operator> (const String &lhs, const String &rhs) |
bool | operator> (const String &lhs, const char *rhs) |
bool | operator> (const char *lhs, const String &rhs) |
bool | operator<= (const String &lhs, const std::string &rhs) |
bool | operator<= (const std::string &lhs, const String &rhs) |
bool | operator<= (const String &lhs, const String &rhs) |
bool | operator<= (const String &lhs, const char *rhs) |
bool | operator<= (const char *lhs, const String &rhs) |
bool | operator>= (const String &lhs, const std::string &rhs) |
bool | operator>= (const std::string &lhs, const String &rhs) |
bool | operator>= (const String &lhs, const String &rhs) |
bool | operator>= (const String &lhs, const char *rhs) |
bool | operator>= (const char *lhs, const String &rhs) |
bool | operator== (const String &lhs, const std::string &rhs) |
bool | operator== (const std::string &lhs, const String &rhs) |
bool | operator== (const String &lhs, const String &rhs) |
bool | operator== (const String &lhs, const char *rhs) |
bool | operator== (const char *lhs, const String &rhs) |
bool | operator!= (const String &lhs, const std::string &rhs) |
bool | operator!= (const std::string &lhs, const String &rhs) |
bool | operator!= (const String &lhs, const String &rhs) |
bool | operator!= (const String &lhs, const char *rhs) |
bool | operator!= (const char *lhs, const String &rhs) |
std::ostream & | operator<< (std::ostream &out, const String &input) |
int | GetVectorBytes (DataType dtype) |
Get the number of bytes needed in a vector. More... | |
bool | TypeMatch (DLDataType t, int code, int bits, int lanes=1) |
Check whether type matches the given spec. More... | |
bool | TypeEqual (DLDataType lhs, DLDataType rhs) |
Check whether two types are equal . More... | |
std::string | GetCustomTypeName (uint8_t type_code) |
Runtime utility for getting custom type name from code. More... | |
bool | GetCustomTypeRegistered (uint8_t type_code) |
Runtime utility for checking whether custom type is registered. More... | |
uint8_t | ParseCustomDatatype (const std::string &s, const char **scan) |
Runtime utility for parsing string of the form "custom[<typename>]". More... | |
const char * | DLDataTypeCode2Str (DLDataTypeCode type_code) |
Convert type code to its name. More... | |
DLDataType | String2DLDataType (std::string s) |
convert a string to TVM type. More... | |
std::string | DLDataType2String (DLDataType t) |
convert a TVM type to string. More... | |
std::ostream & | operator<< (std::ostream &os, DLDataType t) |
std::ostream & | operator<< (std::ostream &os, const DataType &dtype) |
void | AppendNDArray (std::ostream &os, const NDArray &nd_array, const DLDevice &host_device, bool show_content=true) |
Helpers to describe runtime objects in human-friendly form. For nd_arrays we show their shapes and dtypes, but also their contents if 'small' and on the host_device (mostly so that we can see dynamic shapes as they are computed). For adts we show the ADT fields. For objects we dispatch to one of the above as appropriate. More... | |
void | AppendADT (std::ostream &os, const ADT &adt, const DLDevice &host_device, bool show_content=true) |
void | AppendRuntimeObject (std::ostream &os, const ObjectRef &object, const DLDevice &host_device, bool show_content=true) |
std::string | RuntimeObject2String (const ObjectRef &object, const DLDevice &host_device, bool show_content=true) |
bool | IsRPCSessionDevice (Device dev) |
Return true if a Device is owned by an RPC session. More... | |
int | GetRPCSessionIndex (Device dev) |
Return the RPCSessTable index of the RPC Session that owns this device. More... | |
Device | RemoveRPCSessionMask (Device dev) |
Remove the RPC session mask from a Device. RPC clients typically do this when encoding a Device for transmission to an RPC remote. On the wire, RPCdevice are expected to be valid on the server without interpretation. More... | |
std::ostream & | operator<< (std::ostream &os, DLDevice dev) |
Device | AddRPCSessionMask (Device dev, int session_table_index) |
Add a RPC session mask to a Device. RPC clients typically do this when decoding a Device received from a RPC remote. More... | |
template<typename T , typename... Args> | |
ObjectPtr< T > | make_object (Args &&... args) |
Allocate an object using default allocator. More... | |
template<typename ArrayType , typename ElemType , typename... Args> | |
ObjectPtr< ArrayType > | make_inplace_array_object (size_t num_elems, Args &&... args) |
bool | RuntimeEnabled (const String &target) |
Check if runtime module is enabled for target. More... | |
std::ostream & | operator<< (std::ostream &out, const Module &module) |
std::string | SanitizeName (const std::string &name) |
Sanitize name for output into compiler artifacts. More... | |
bool | SaveDLTensor (dmlc::Stream *strm, const DLTensor *tensor) |
Save a DLTensor to stream. More... | |
size_t | GetDataSize (const DLTensor &arr) |
return the size of data the DLTensor hold, in term of number of bytes More... | |
Object * | TVMArrayHandleToObjectHandle (TVMArrayHandle handle) |
template<typename RelayRefType , typename ObjectType > | |
RelayRefType | GetRef (const ObjectType *ptr) |
Get a reference type from a raw object ptr type. More... | |
template<typename SubRef , typename BaseRef > | |
SubRef | Downcast (BaseRef ref) |
Downcast a base reference type to a more specific type. More... | |
template<typename BaseType , typename ObjectType > | |
ObjectPtr< BaseType > | GetObjectPtr (ObjectType *ptr) |
Get an object ptr type from a raw object ptr. More... | |
template<typename RefType , typename ObjType > | |
RefType | GetRef (const ObjType *ptr) |
template<typename BaseType , typename ObjType > | |
ObjectPtr< BaseType > | GetObjectPtr (ObjType *ptr) |
const char * | ArgTypeCode2Str (int type_code) |
Convert argument type code to string. More... | |
const char * | DLDeviceType2Str (int type) |
The name of DLDeviceType. More... | |
template<typename... Args> | |
void TVM_ALWAYS_INLINE | PackArgs (TVMValue *values, int *type_codes, Args &&... args) |
Timer | DefaultTimer (Device dev) |
Default timer if one does not exist for the device. More... | |
void | EnvCheckSignals () |
Check if signals have been sent to the process and if so invoke the registered signal handler in the frontend environment. More... | |
template<typename T > | |
void | parallel_for_with_threading_backend (T flambda, int64_t begin, int64_t end) |
Variables | |
template<typename T , typename IterType > | |
constexpr bool | is_valid_iterator_v = is_valid_iterator<T, IterType>::value |
template<typename T > | |
constexpr bool | is_tvm_array = false |
template<typename T > | |
constexpr bool | is_tvm_array< Array< T > > = true |
constexpr int | kAllocAlignment = 64 |
Number of bytes each allocation must align to. More... | |
constexpr int | kTempAllocaAlignment = 64 |
Number of bytes each allocation must align to in temporary allocation. More... | |
constexpr int | kMaxStackAlloca = 1024 |
Maximum size that can be allocated on stack. More... | |
constexpr int | kDefaultWorkspaceAlignment = 1 |
Number of bytes each allocation must align to by default in the workspace buffer to service intermediate tensors. More... | |
constexpr int | kRPCSessMask = 128 |
The device type bigger than this is RPC device. More... | |
constexpr uint64_t | kTVMNDArrayMagic = 0xDD5E40F096B4A13F |
Magic number for NDArray file. More... | |
using tvm::runtime::FSig = typedef std::string() |
Using static function to output TypedPackedFunc signature.
enum tvm::runtime::DeviceAttrKind : int |
enum tvm::runtime::ModulePropertyMask : int |
Property of runtime module We classify the property of runtime module into the following categories.
Add a RPC session mask to a Device. RPC clients typically do this when decoding a Device received from a RPC remote.
dev | A Device without any RPC Session mask, valid on the RPC server. |
session_table_index | Numeric index of the RPC session in the session table. |
void tvm::runtime::AppendADT | ( | std::ostream & | os, |
const ADT & | adt, | ||
const DLDevice & | host_device, | ||
bool | show_content = true |
||
) |
void tvm::runtime::AppendNDArray | ( | std::ostream & | os, |
const NDArray & | nd_array, | ||
const DLDevice & | host_device, | ||
bool | show_content = true |
||
) |
Helpers to describe runtime objects in human-friendly form. For nd_arrays
we show their shapes and dtypes, but also their contents if 'small' and on the host_device
(mostly so that we can see dynamic shapes as they are computed). For adts
we show the ADT fields. For objects
we dispatch to one of the above as appropriate.
void tvm::runtime::AppendRuntimeObject | ( | std::ostream & | os, |
const ObjectRef & | object, | ||
const DLDevice & | host_device, | ||
bool | show_content = true |
||
) |
|
inline |
Convert argument type code to string.
type_code | The input type code. |
|
inline |
Default timer if one does not exist for the device.
dev | The device to time on. |
Note that this timer performs synchronization between the device and CPU, which can lead to overhead in the reported results.
|
inline |
convert a TVM type to string.
t | The type to be converted. |
|
inline |
Convert type code to its name.
type_code | The type code . |
|
inline |
The name of DLDeviceType.
type | The device type. |
|
inline |
Downcast a base reference type to a more specific type.
ref | The input reference |
SubRef | The target specific reference type. |
BaseRef | the current reference type. |
void tvm::runtime::EnvCheckSignals | ( | ) |
Check if signals have been sent to the process and if so invoke the registered signal handler in the frontend environment.
When running TVM in another language (Python), the signal handler may not be immediately executed, but instead the signal is marked in the interpreter state (to ensure non-blocking of the signal handler).
This function can be explicitly invoked to check the cached signal and run the related processing if a signal is marked.
On Linux, when siginterrupt() is set, invoke this function whenever a syscall returns EINTR. When it is not set, invoke it between long-running syscalls when you will not immediately return to the frontend. On Windows, the same rules apply, but due to differences in signal processing, these are likely to only make a difference when used with Ctrl+C and socket calls.
Not inserting this function will not cause any correctness issue, but will delay invoking the Python-side signal handler until the function returns to the Python side. This means that the effect of e.g. pressing Ctrl+C or sending signals the process will be delayed until function return. When a C function is blocked on a syscall such as accept(), it needs to be called when EINTR is received. So this function is not needed in most API functions, which can finish quickly in a reasonable, deterministic amount of time.
This | function throws an exception when the frontend signal handler indicate an error happens, otherwise it returns normally. |
std::string tvm::runtime::GetCustomTypeName | ( | uint8_t | type_code | ) |
Runtime utility for getting custom type name from code.
type_code | Custom type code |
bool tvm::runtime::GetCustomTypeRegistered | ( | uint8_t | type_code | ) |
Runtime utility for checking whether custom type is registered.
type_code | Custom type code |
|
inline |
return the size of data the DLTensor hold, in term of number of bytes
arr | the input DLTensor |
|
inline |
Get an object ptr type from a raw object ptr.
ptr | The object pointer |
BaseType | The reference type |
ObjectType | The object type |
|
inline |
|
inline |
Get a reference type from a raw object ptr type.
It is always important to get a reference type if we want to return a value as reference or keep the object alive beyond the scope of the function.
ptr | The object pointer |
RefType | The reference type |
ObjectType | The object type |
|
inline |
|
inline |
Return the RPCSessTable index of the RPC Session that owns this device.
|
inline |
Get the number of bytes needed in a vector.
dtype | The data type. |
|
inline |
Return true if a Device is owned by an RPC session.
|
inline |
|
inline |
Allocate an object using default allocator.
args | arguments to the constructor. |
T | the node type. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void TVM_ALWAYS_INLINE tvm::runtime::PackArgs | ( | TVMValue * | values, |
int * | type_codes, | ||
Args &&... | args | ||
) |
|
inline |
uint8_t tvm::runtime::ParseCustomDatatype | ( | const std::string & | s, |
const char ** | scan | ||
) |
Runtime utility for parsing string of the form "custom[<typename>]".
s | String to parse |
scan | pointer to parsing pointer, which is scanning across s |
Remove the RPC session mask from a Device. RPC clients typically do this when encoding a Device for transmission to an RPC remote. On the wire, RPCdevice are expected to be valid on the server without interpretation.
dev | A Device with non-zero RPC Session mask, valid on the RPC client. |
bool tvm::runtime::RuntimeEnabled | ( | const String & | target | ) |
Check if runtime module is enabled for target.
target | The target module name. |
std::string tvm::runtime::RuntimeObject2String | ( | const ObjectRef & | object, |
const DLDevice & | host_device, | ||
bool | show_content = true |
||
) |
std::string tvm::runtime::SanitizeName | ( | const std::string & | name | ) |
Sanitize name for output into compiler artifacts.
name | Original name |
|
inline |
Save a DLTensor to stream.
strm | The output stream |
tensor | The tensor to be saved. |
|
inline |
convert a string to TVM type.
s | The string to be converted. |
|
inline |
|
inline |
Check whether two types are equal .
lhs | The left operand. |
rhs | The right operand. |
|
inline |
Check whether type matches the given spec.
t | The type |
code | The type code. |
bits | The number of bits to be matched. |
lanes | The number of lanes in the type. |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
constexpr |
Number of bytes each allocation must align to.
|
constexpr |
Number of bytes each allocation must align to by default in the workspace buffer to service intermediate tensors.
|
constexpr |
Maximum size that can be allocated on stack.
|
constexpr |
The device type bigger than this is RPC device.
|
constexpr |
Number of bytes each allocation must align to in temporary allocation.
|
constexpr |
Magic number for NDArray file.