#include <memory_manager.h>
|
| Allocator (AllocatorType type) |
|
virtual | ~Allocator ()=default |
|
NDArray | Empty (ShapeTuple shape, DLDataType dtype, Device dev, Optional< String > mem_scope=NullOpt) |
| Allocate an empty NDArray using from the allocator. More...
|
|
AllocatorType | type () const |
| Return the allocator type. More...
|
|
virtual Buffer | Alloc (Device dev, size_t nbytes, size_t alignment, DLDataType type_hint)=0 |
| Allocate a buffer given a size, alignment and type. More...
|
|
virtual Buffer | Alloc (Device dev, ShapeTuple shape, DLDataType type_hint, const std::string &mem_scope="")=0 |
| Allocate a buffer given a shape and type. More...
|
|
virtual void | Free (const Buffer &buffer)=0 |
| Free a buffer allocated by the allocator. More...
|
|
virtual void | Clear () |
| Clear the allocated memory. More...
|
|
virtual size_t | UsedMemory () const =0 |
| The amount of memory currently allocated. More...
|
|
|
virtual bool | AllowMemoryScope (const std::string &mem_scope) const |
| Check if the given memory scope is allowed to allocate by the allocator. More...
|
|
◆ Allocator()
◆ ~Allocator()
virtual tvm::runtime::memory::Allocator::~Allocator |
( |
| ) |
|
|
virtualdefault |
◆ Alloc() [1/2]
virtual Buffer tvm::runtime::memory::Allocator::Alloc |
( |
Device |
dev, |
|
|
ShapeTuple |
shape, |
|
|
DLDataType |
type_hint, |
|
|
const std::string & |
mem_scope = "" |
|
) |
| |
|
pure virtual |
Allocate a buffer given a shape and type.
- Parameters
-
dev | The device where the array is allocated. |
shape | The shape of the tensor. |
type_hint | A type hint to the allocator. |
mem_scope | A memory scope of the buffer. |
- Returns
- A sized allocation in the form of a buffer.
◆ Alloc() [2/2]
virtual Buffer tvm::runtime::memory::Allocator::Alloc |
( |
Device |
dev, |
|
|
size_t |
nbytes, |
|
|
size_t |
alignment, |
|
|
DLDataType |
type_hint |
|
) |
| |
|
pure virtual |
Allocate a buffer given a size, alignment and type.
- Parameters
-
dev | The device where the array is allocated. |
nbytes | The size of the buffer. |
alignment | The alignment of the buffer. |
type_hint | A type hint to the allocator. |
- Returns
- A sized allocation in the form of a buffer.
◆ AllowMemoryScope()
virtual bool tvm::runtime::memory::Allocator::AllowMemoryScope |
( |
const std::string & |
mem_scope | ) |
const |
|
protectedvirtual |
Check if the given memory scope is allowed to allocate by the allocator.
◆ Clear()
virtual void tvm::runtime::memory::Allocator::Clear |
( |
| ) |
|
|
virtual |
Clear the allocated memory.
◆ Empty()
Allocate an empty NDArray using from the allocator.
- Parameters
-
shape | The shape of the NDArray. |
dtype | The datatype of the NDArray. |
dev | The device where the array is allocated. |
mem_scope | The device memory scope hint. |
- Returns
- The empty NDArray.
◆ Free()
virtual void tvm::runtime::memory::Allocator::Free |
( |
const Buffer & |
buffer | ) |
|
|
pure virtual |
Free a buffer allocated by the allocator.
- Parameters
-
buffer | The buffer to free. |
◆ type()
Return the allocator type.
◆ UsedMemory()
virtual size_t tvm::runtime::memory::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: