tvm
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | List of all members
tvm::runtime::vm::Allocator Class Referenceabstract

#include <memory_manager.h>

Collaboration diagram for tvm::runtime::vm::Allocator:

Public Member Functions

 Allocator (AllocatorType type)
 
virtual ~Allocator ()=default
 
NDArray Empty (std::vector< int64_t > shape, DLDataType dtype, Device dev)
 Allocate an empty NDArray using from the allocator. More...
 
AllocatorType type () const
 Return the allocator type. More...
 
virtual Buffer Alloc (size_t nbytes, size_t alignment, DLDataType type_hint)=0
 Allocate a buffer given a size, alignment and type. More...
 
virtual void Free (const Buffer &buffer)=0
 Free a buffer allocated by the allocator. More...
 
virtual size_t UsedMemory () const =0
 The amount of memory currently allocated. More...
 

Constructor & Destructor Documentation

◆ Allocator()

tvm::runtime::vm::Allocator::Allocator ( AllocatorType  type)
inlineexplicit

◆ ~Allocator()

virtual tvm::runtime::vm::Allocator::~Allocator ( )
virtualdefault

Member Function Documentation

◆ Alloc()

virtual Buffer tvm::runtime::vm::Allocator::Alloc ( size_t  nbytes,
size_t  alignment,
DLDataType  type_hint 
)
pure virtual

Allocate a buffer given a size, alignment and type.

Parameters
nbytesThe size of the buffer.
alignmentThe alignment of the buffer.
type_hintA type hint to the allocator.
Returns
A sized allocation in the form of a buffer.

◆ Empty()

NDArray tvm::runtime::vm::Allocator::Empty ( std::vector< int64_t >  shape,
DLDataType  dtype,
Device  dev 
)

Allocate an empty NDArray using from the allocator.

Parameters
shapeThe shape of the NDArray.
dtypeThe datatype of the NDArray.
devThe device where the array is allocated.
Returns
The empty NDArray.

◆ Free()

virtual void tvm::runtime::vm::Allocator::Free ( const Buffer buffer)
pure virtual

Free a buffer allocated by the allocator.

Parameters
bufferThe buffer to free.

◆ type()

AllocatorType tvm::runtime::vm::Allocator::type ( ) const
inline

Return the allocator type.

◆ UsedMemory()

virtual size_t tvm::runtime::vm::Allocator::UsedMemory ( ) const
pure virtual

The amount of memory currently allocated.

Returns
The amount of memory currently allocated.

The documentation for this class was generated from the following file: