33 : _optim_vars_count{optim_vars_count}
43 const auto vars_capacity =
_mem_planner->capacity() * _optim_vars_count;
44 _var_mem_alloc = std::make_shared<basic::Allocator>(vars_capacity);
48 uint32_t pos_var)
const
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;
68DisposableMemoryManager::createMemoryPlanner(
const std::string planner_id)
75 _mem_planner->claim(ind,
size);
80 _mem_planner->release(ind);
85 _mem_alloc = std::make_shared<basic::Allocator>(_mem_planner->capacity());
86 assert(_mem_alloc->base());
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;
109 _mem_alloc = std::make_shared<basic::Allocator>(_mem_planner->capacity());
110 assert(_mem_alloc->base());
115 assert(_mem_planner->memory_plans().find(ind) != _mem_planner->memory_plans().end());
116 const auto &mem_blk = _mem_planner->memory_plans().at(ind);
117 return _mem_alloc->base() + mem_blk.offset;
124 _mem_planner->claim(ind,
size);
129 _mem_planner->release(ind);
std::shared_ptr< Allocator > _mem_alloc
std::shared_ptr< IMemoryPlanner< ir::OperandIndex > > _mem_planner
DisposableMemoryManager()
void releasePlan(const DisposableTensorIndex &ind)
uint8_t * getBuffer(const DisposableTensorIndex &ind) const
void claimPlan(const DisposableTensorIndex &ind, uint32_t size)
Class that is index of DisposableTensor.
void claimPlan(const LayerScopeTensorIndex &ind, uint32_t size)
uint8_t * getBuffer(const LayerScopeTensorIndex &ind) const
LayerScopeMemoryManager()
void releasePlan(const LayerScopeTensorIndex &ind)
static MemoryPlannerFactory< Index > & get()
TrainableMemoryManager(uint32_t optimizer_vars_count)
uint8_t * getOptVarBuffer(const ir::OperandIndex &ind, uint32_t pos_var) const
std::string getConfigString(const std::string &key)
Interface to plan memory.