#include <allocator.h>
|
static bool | CalcMemSizeForArray (size_t nmemb, size_t size, size_t *out) noexcept |
|
static bool | CalcMemSizeForArrayWithAlignment (size_t nmemb, size_t size, size_t alignment, size_t *out) noexcept |
|
template<size_t alignment> |
static bool | CalcMemSizeForArrayWithAlignment (size_t nmemb, size_t size, size_t *out) noexcept |
|
template<typename T > |
static IAllocatorUniquePtr< T > | MakeUniquePtr (std::shared_ptr< IAllocator > allocator, size_t count_or_bytes, bool use_reserve=false, Stream *stream=nullptr, WaitNotificationFn wait_fn=nullptr) |
|
template<typename T > |
static IAllocatorUniquePtr< T > | MakeUniquePtrFromOrtAllocator (OrtAllocator *ort_allocator, size_t count_or_bytes) |
|
Definition at line 68 of file allocator.h.
onnxruntime::IAllocator::IAllocator |
( |
const OrtMemoryInfo & |
info | ) |
|
|
inline |
virtual onnxruntime::IAllocator::~IAllocator |
( |
| ) |
|
|
virtualdefault |
virtual void* onnxruntime::IAllocator::Alloc |
( |
size_t |
size | ) |
|
|
pure virtual |
Allocate memory of the specified size. If size is 0, nullptr is returned. If allocation fails, an exception is thrown.
Implemented in onnxruntime::CPUAllocator.
void* onnxruntime::IAllocator::AllocArray |
( |
size_t |
nmemb, |
|
|
size_t |
size |
|
) |
| |
|
inline |
allocate memory for an array which has nmemb items of data, each size bytes long
Definition at line 128 of file allocator.h.
template<size_t alignment>
void* onnxruntime::IAllocator::AllocArrayWithAlignment |
( |
size_t |
nmemb, |
|
|
size_t |
size |
|
) |
| |
|
inline |
allocate memory for an array which has nmemb items of data, each size bytes long
Definition at line 141 of file allocator.h.
static bool onnxruntime::IAllocator::CalcMemSizeForArray |
( |
size_t |
nmemb, |
|
|
size_t |
size, |
|
|
size_t * |
out |
|
) |
| |
|
inlinestaticnoexcept |
static bool onnxruntime::IAllocator::CalcMemSizeForArrayWithAlignment |
( |
size_t |
nmemb, |
|
|
size_t |
size, |
|
|
size_t |
alignment, |
|
|
size_t * |
out |
|
) |
| |
|
staticnoexcept |
Calculate the memory size for an array. The size is bounds checked using SafeInt.
- Template Parameters
-
alignment | must be power of 2 |
- Parameters
-
nmemb | Number of members or elements in the array |
size | Size of each element |
out | Total size required after any alignment is applied |
- Returns
- true, successful. false, overflow
template<size_t alignment>
bool onnxruntime::IAllocator::CalcMemSizeForArrayWithAlignment |
( |
size_t |
nmemb, |
|
|
size_t |
size, |
|
|
size_t * |
out |
|
) |
| |
|
staticnoexcept |
virtual void onnxruntime::IAllocator::Free |
( |
void * |
p | ) |
|
|
pure virtual |
virtual void onnxruntime::IAllocator::GetStats |
( |
AllocatorStats * |
| ) |
|
|
inlinevirtual |
Create a std::unique_ptr that is allocated and freed by the provided IAllocator.
- Parameters
-
allocator | The allocator. |
count_or_bytes | The exact bytes to allocate if T is void, otherwise the number of elements to allocate. |
use_reserve | If true, call Reserve() instead of Alloc() to allocate memory. |
stream | Which stream instance allocated chunk will be used with. |
wait_fn | If the allocator want to dynamic reuse a chunk from another stream, use this wait_fn to sync on the target stream to make the reuse safe. |
- Returns
- std::unique_ptr with allocated memory and deleter. Throws if it cannot allocate memory.
Definition at line 161 of file allocator.h.
template<typename T >
static IAllocatorUniquePtr<T> onnxruntime::IAllocator::MakeUniquePtrFromOrtAllocator |
( |
OrtAllocator * |
ort_allocator, |
|
|
size_t |
count_or_bytes |
|
) |
| |
|
inlinestatic |
Create a std::unique_ptr that is allocated and freed by the provided OrtAllocator.
- Parameters
-
ort_allocator | The allocator. |
count_or_bytes | The exact bytes to allocate if T is void, otherwise the number of elements to allocate. |
- Returns
- std::unique_ptr with allocated memory and deleter. Throws if it cannot allocate memory.
Definition at line 197 of file allocator.h.
virtual void* onnxruntime::IAllocator::Reserve |
( |
size_t |
size | ) |
|
|
inlinevirtual |
The documentation for this class was generated from the following file: