ArmNN
 21.11
MemoryManager Class Reference

#include <MemoryManager.hpp>

Public Member Functions

void StoreMemToAllocate (std::vector< BufferStorage > bufferStorageVector, std::shared_ptr< ICustomAllocator > customAllocator, size_t typeAlignment=0)
 Initialization method to store in all information needed. More...
 
void Allocate ()
 Allocate the amount of memory indicated by , and point each to each correspondent Tensor so that they are bytes separated. More...
 
void Deallocate ()
 Deallocate memory. More...
 

Detailed Description

Definition at line 39 of file MemoryManager.hpp.

Member Function Documentation

◆ Allocate()

void Allocate ( )

Allocate the amount of memory indicated by , and point each to each correspondent Tensor so that they are bytes separated.

Definition at line 23 of file MemoryManager.cpp.

Referenced by armnn::TEST_SUITE().

24 {
25  for (auto& m_AllocatorBufferStoragePair : m_AllocatorBufferStoragePairVector)
26  {
27  auto& allocator = m_AllocatorBufferStoragePair.first;
28  for (auto&& bufferStorage : m_AllocatorBufferStoragePair.second)
29  {
30  bufferStorage.m_Buffer = allocator.m_CustomAllocator->allocate(bufferStorage.m_BufferSize, 0);
31 
32  for (auto tensorMemory : bufferStorage.m_TensorMemoryVector)
33  {
34  tensorMemory->m_Data = allocator.m_CustomAllocator->GetMemoryRegionAtOffset(bufferStorage.m_Buffer,
35  tensorMemory->m_Offset);
36  }
37  }
38  }
39 }

◆ Deallocate()

void Deallocate ( )

Deallocate memory.

Definition at line 41 of file MemoryManager.cpp.

Referenced by armnn::TEST_SUITE().

42 {
43  for (auto& m_AllocatorBufferStoragePair : m_AllocatorBufferStoragePairVector)
44  {
45  auto& allocator = m_AllocatorBufferStoragePair.first;
46  for (auto&& bufferStorage : m_AllocatorBufferStoragePair.second)
47  {
48  allocator.m_CustomAllocator->free(bufferStorage.m_Buffer);
49  }
50  }
51 }

◆ StoreMemToAllocate()

void StoreMemToAllocate ( std::vector< BufferStorage bufferStorageVector,
std::shared_ptr< ICustomAllocator customAllocator,
size_t  typeAlignment = 0 
)

Initialization method to store in all information needed.

Parameters
[in]bufferStorageVector- Vector of .
[in]customAllocator- Pointer to .
[in]typeAlignment- Optional parameter. Value of which the size of each value has to be multiple of.

Definition at line 13 of file MemoryManager.cpp.

References armnn::IgnoreUnused().

Referenced by armnn::TEST_SUITE().

16 {
17  IgnoreUnused(typeAlignment);
18  m_AllocatorBufferStoragePairVector.emplace_back(std::make_pair<Allocator, std::vector<BufferStorage>>(
19  Allocator{customAllocator},
20  std::move(bufferStorageVector)));
21 }
void IgnoreUnused(Ts &&...)

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