tvm
|
A managed object in the TVM runtime. More...
#include <tvm/runtime/c_runtime_api.h>
#include <tvm/runtime/logging.h>
#include <string>
#include <type_traits>
#include <utility>
#include <atomic>
Go to the source code of this file.
Classes | |
struct | tvm::runtime::TypeIndex |
Namespace for the list of type index. More... | |
class | tvm::runtime::Object |
base class of all object containers. More... | |
class | tvm::runtime::ObjectPtr< T > |
A custom smart pointer for Object. More... | |
class | tvm::runtime::ObjectRef |
Base class of all object reference. More... | |
struct | tvm::runtime::ObjectPtrHash |
ObjectRef hash functor. More... | |
struct | tvm::runtime::ObjectPtrEqual |
ObjectRef equal functor. More... | |
Namespaces | |
tvm | |
runtime implementation for LibTorch/TorchScript. | |
tvm::runtime | |
Macros | |
#define | TVM_OBJECT_ATOMIC_REF_COUNTER 1 |
Whether or not use atomic reference counter. If the reference counter is not atomic, an object cannot be owned by multiple threads. We can, however, move an object across threads. More... | |
#define | TVM_DECLARE_BASE_OBJECT_INFO(TypeName, ParentType) |
helper macro to declare a base object type that can be inherited. More... | |
#define | TVM_DECLARE_FINAL_OBJECT_INFO(TypeName, ParentType) |
helper macro to declare type information in a final class. More... | |
#define | TVM_ATTRIBUTE_UNUSED |
helper macro to suppress unused warning More... | |
#define | TVM_STR_CONCAT_(__x, __y) __x##__y |
#define | TVM_STR_CONCAT(__x, __y) TVM_STR_CONCAT_(__x, __y) |
#define | TVM_OBJECT_REG_VAR_DEF static TVM_ATTRIBUTE_UNUSED uint32_t __make_Object_tid |
#define | TVM_REGISTER_OBJECT_TYPE(TypeName) TVM_STR_CONCAT(TVM_OBJECT_REG_VAR_DEF, __COUNTER__) = TypeName::_GetOrAllocRuntimeTypeIndex() |
Helper macro to register the object type to runtime. Makes sure that the runtime type table is correctly populated. More... | |
#define | TVM_DEFINE_DEFAULT_COPY_MOVE_AND_ASSIGN(TypeName) |
#define | TVM_DEFINE_OBJECT_REF_METHODS_WITHOUT_DEFAULT_CONSTRUCTOR(TypeName, ParentType, ObjectName) |
#define | TVM_DEFINE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName) |
#define | TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName) |
#define | TVM_DEFINE_MUTABLE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName) |
#define | TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName) |
#define | TVM_DEFINE_OBJECT_REF_COW_METHOD(ObjectName) |
Define CopyOnWrite function in an ObjectRef. More... | |
Functions | |
template<typename RelayRefType , typename ObjectType > | |
RelayRefType | tvm::runtime::GetRef (const ObjectType *ptr) |
Get a reference type from a raw object ptr type. More... | |
template<typename SubRef , typename BaseRef > | |
SubRef | tvm::runtime::Downcast (BaseRef ref) |
Downcast a base reference type to a more specific type. More... | |
template<typename BaseType , typename ObjectType > | |
ObjectPtr< BaseType > | tvm::runtime::GetObjectPtr (ObjectType *ptr) |
Get an object ptr type from a raw object ptr. More... | |
template<typename RefType , typename ObjType > | |
RefType | tvm::runtime::GetRef (const ObjType *ptr) |
template<typename BaseType , typename ObjType > | |
ObjectPtr< BaseType > | tvm::runtime::GetObjectPtr (ObjType *ptr) |
A managed object in the TVM runtime.
#define TVM_ATTRIBUTE_UNUSED |
helper macro to suppress unused warning
#define TVM_DECLARE_BASE_OBJECT_INFO | ( | TypeName, | |
ParentType | |||
) |
helper macro to declare a base object type that can be inherited.
TypeName | The name of the current type. |
ParentType | The name of the ParentType |
#define TVM_DECLARE_FINAL_OBJECT_INFO | ( | TypeName, | |
ParentType | |||
) |
helper macro to declare type information in a final class.
TypeName | The name of the current type. |
ParentType | The name of the ParentType |
#define TVM_DEFINE_DEFAULT_COPY_MOVE_AND_ASSIGN | ( | TypeName | ) |
#define TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS | ( | TypeName, | |
ParentType, | |||
ObjectName | |||
) |
#define TVM_DEFINE_MUTABLE_OBJECT_REF_METHODS | ( | TypeName, | |
ParentType, | |||
ObjectName | |||
) |
#define TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS | ( | TypeName, | |
ParentType, | |||
ObjectName | |||
) |
#define TVM_DEFINE_OBJECT_REF_COW_METHOD | ( | ObjectName | ) |
Define CopyOnWrite function in an ObjectRef.
ObjectName | The Type of the Node. |
CopyOnWrite will generate a unique copy of the internal node. The node will be copied if it is referenced by multiple places. The function returns the raw pointer to the node to allow modification of the content.
#define TVM_DEFINE_OBJECT_REF_METHODS | ( | TypeName, | |
ParentType, | |||
ObjectName | |||
) |
#define TVM_DEFINE_OBJECT_REF_METHODS_WITHOUT_DEFAULT_CONSTRUCTOR | ( | TypeName, | |
ParentType, | |||
ObjectName | |||
) |
#define TVM_OBJECT_ATOMIC_REF_COUNTER 1 |
Whether or not use atomic reference counter. If the reference counter is not atomic, an object cannot be owned by multiple threads. We can, however, move an object across threads.
#define TVM_OBJECT_REG_VAR_DEF static TVM_ATTRIBUTE_UNUSED uint32_t __make_Object_tid |
#define TVM_REGISTER_OBJECT_TYPE | ( | TypeName | ) | TVM_STR_CONCAT(TVM_OBJECT_REG_VAR_DEF, __COUNTER__) = TypeName::_GetOrAllocRuntimeTypeIndex() |
Helper macro to register the object type to runtime. Makes sure that the runtime type table is correctly populated.
Use this macro in the cc file for each terminal class.
#define TVM_STR_CONCAT | ( | __x, | |
__y | |||
) | TVM_STR_CONCAT_(__x, __y) |
#define TVM_STR_CONCAT_ | ( | __x, | |
__y | |||
) | __x##__y |