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

#include <MemoryManager.h>

Collaboration diagram for onert::backend::train::TrainableMemoryManager:

Public Member Functions

 TrainableMemoryManager (uint32_t optimizer_vars_count)
 
virtual ~TrainableMemoryManager ()=default
 
void allocate (void)
 
uint8_t * getOptVarBuffer (const ir::OperandIndex &ind, uint32_t pos_var) const
 
- Public Member Functions inherited from onert::backend::basic::MemoryManager
 MemoryManager ()
 
 MemoryManager (const std::string)
 
virtual ~MemoryManager ()=default
 
void allocate (void)
 
uint8_t * getBuffer (const ir::OperandIndex &ind) const
 
void deallocate (void)
 
void claimPlan (const ir::OperandIndex &ind, uint32_t size)
 
void releasePlan (const ir::OperandIndex &ind)
 

Additional Inherited Members

- Protected Attributes inherited from onert::backend::basic::MemoryManager
std::unordered_map< ir::OperandIndex, Block_tensor_mem_map
 
std::shared_ptr< IMemoryPlanner< ir::OperandIndex > > _mem_planner
 
std::shared_ptr< Allocator_mem_alloc
 

Detailed Description

Definition at line 34 of file MemoryManager.h.

Constructor & Destructor Documentation

◆ TrainableMemoryManager()

onert::backend::train::TrainableMemoryManager::TrainableMemoryManager ( uint32_t  optimizer_vars_count)

Definition at line 32 of file MemoryManager.cc.

33 : _optim_vars_count{optim_vars_count}
34{
35 // DO NOTHING
36}

◆ ~TrainableMemoryManager()

virtual onert::backend::train::TrainableMemoryManager::~TrainableMemoryManager ( )
virtualdefault

Member Function Documentation

◆ allocate()

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

Definition at line 38 of file MemoryManager.cc.

39{
40 _mem_alloc = std::make_shared<basic::Allocator>(_mem_planner->capacity());
41 assert(_mem_alloc->base());
42
43 const auto vars_capacity = _mem_planner->capacity() * _optim_vars_count;
44 _var_mem_alloc = std::make_shared<basic::Allocator>(vars_capacity);
45}
std::shared_ptr< Allocator > _mem_alloc
std::shared_ptr< IMemoryPlanner< ir::OperandIndex > > _mem_planner

References onert::backend::basic::MemoryManager::_mem_alloc, and onert::backend::basic::MemoryManager::_mem_planner.

◆ getOptVarBuffer()

uint8_t * onert::backend::train::TrainableMemoryManager::getOptVarBuffer ( const ir::OperandIndex ind,
uint32_t  pos_var 
) const

Definition at line 47 of file MemoryManager.cc.

49{
50 assert(_mem_planner->memory_plans().find(ind) != _mem_planner->memory_plans().end());
51 const auto var_offset = pos_var * _mem_planner->capacity();
52 const auto &mem_blk = _mem_planner->memory_plans().at(ind);
53 return _var_mem_alloc->base() + var_offset + mem_blk.offset;
54}

References onert::backend::basic::MemoryManager::_mem_planner.


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