ONE - On-device Neural Engine
Loading...
Searching...
No Matches
onert::backend::train::DisposableMemoryManager Class Reference

#include <MemoryManager.h>

Public Member Functions

 DisposableMemoryManager ()
 
void allocate (void)
 
uint8_t * getBuffer (const DisposableTensorIndex &ind) const
 
void deallocate (void)
 
void claimPlan (const DisposableTensorIndex &ind, uint32_t size)
 
void releasePlan (const DisposableTensorIndex &ind)
 
std::shared_ptr< basic::AllocatorgetMemAlloc ()
 

Detailed Description

Definition at line 48 of file MemoryManager.h.

Constructor & Destructor Documentation

◆ DisposableMemoryManager()

onert::backend::train::DisposableMemoryManager::DisposableMemoryManager ( )

Definition at line 56 of file MemoryManager.cc.

56 : _mem_planner{createMemoryPlanner()}
57{
58 // DO NOTHING
59}

Member Function Documentation

◆ allocate()

void onert::backend::train::DisposableMemoryManager::allocate ( void  )

Definition at line 83 of file MemoryManager.cc.

84{
85 _mem_alloc = std::make_shared<basic::Allocator>(_mem_planner->capacity());
86 assert(_mem_alloc->base());
87}

◆ claimPlan()

void onert::backend::train::DisposableMemoryManager::claimPlan ( const DisposableTensorIndex ind,
uint32_t  size 
)

Definition at line 73 of file MemoryManager.cc.

74{
75 _mem_planner->claim(ind, size);
76}
int32_t size[5]
Definition Slice.cpp:35

References size.

◆ deallocate()

void onert::backend::train::DisposableMemoryManager::deallocate ( void  )
inline

Definition at line 55 of file MemoryManager.h.

55{ _mem_alloc->release(); }

◆ getBuffer()

uint8_t * onert::backend::train::DisposableMemoryManager::getBuffer ( const DisposableTensorIndex ind) const

Definition at line 89 of file MemoryManager.cc.

90{
91 assert(_mem_planner->memory_plans().find(ind) != _mem_planner->memory_plans().end());
92 const auto &mem_blk = _mem_planner->memory_plans().at(ind);
93 return _mem_alloc->base() + mem_blk.offset;
94}

◆ getMemAlloc()

std::shared_ptr< basic::Allocator > onert::backend::train::DisposableMemoryManager::getMemAlloc ( )
inline

Definition at line 60 of file MemoryManager.h.

60{ return _mem_alloc; }

◆ releasePlan()

void onert::backend::train::DisposableMemoryManager::releasePlan ( const DisposableTensorIndex ind)

Definition at line 78 of file MemoryManager.cc.

79{
80 _mem_planner->release(ind);
81}

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