ONE - On-device Neural Engine
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
onert::backend::basic::BumpPlanner Class Reference

Class to plan memory by bump way. More...

#include <MemoryPlanner.h>

Collaboration diagram for onert::backend::basic::BumpPlanner:

Public Member Functions

void claim (const ir::OperandIndex &, size_t) override
 Claim memory for operand by bump way.
 
void release (const ir::OperandIndex &) override
 Release memory for operand by bump way.
 
uint32_t capacity () override
 Get capacity for memory planning.
 
MemoryPlansmemory_plans () override
 Get MemoryPlans.
 
- Public Member Functions inherited from onert::backend::basic::IMemoryPlanner< ir::OperandIndex >
virtual ~IMemoryPlanner ()=default
 

Additional Inherited Members

- Public Types inherited from onert::backend::basic::IMemoryPlanner< ir::OperandIndex >
using MemoryPlans = std::unordered_map< ir::OperandIndex, Block >
 

Detailed Description

Class to plan memory by bump way.

Definition at line 40 of file MemoryPlanner.h.

Member Function Documentation

◆ capacity()

uint32_t onert::backend::basic::BumpPlanner::capacity ( )
inlineoverridevirtual

Get capacity for memory planning.

Returns
The value of capacity

Implements onert::backend::basic::IMemoryPlanner< ir::OperandIndex >.

Definition at line 58 of file MemoryPlanner.h.

58{ return _capacity; }

◆ claim()

void onert::backend::basic::BumpPlanner::claim ( const ir::OperandIndex ind,
size_t  size 
)
overridevirtual

Claim memory for operand by bump way.

Parameters
[in]indexThe operand index
[in]sizeThe size of the memory

Implements onert::backend::basic::IMemoryPlanner< ir::OperandIndex >.

Definition at line 24 of file MemoryPlanner.cc.

25{
26 Block blk{_capacity, size};
27 _mem_plans[ind] = blk;
28 _capacity += size;
29
30 VERBOSE(BP_PLANNER) << "CLAIM(" << ind << "): " << blk.offset << ", " << blk.size << std::endl;
31}
#define VERBOSE(name, lv)
Definition Log.h:71
int32_t size[5]
Definition Slice.cpp:35

References size, and VERBOSE.

◆ memory_plans()

MemoryPlans & onert::backend::basic::BumpPlanner::memory_plans ( )
inlineoverridevirtual

Get MemoryPlans.

Returns
MemoryPlans

Implements onert::backend::basic::IMemoryPlanner< ir::OperandIndex >.

Definition at line 63 of file MemoryPlanner.h.

63{ return _mem_plans; }

◆ release()

void onert::backend::basic::BumpPlanner::release ( const ir::OperandIndex ind)
overridevirtual

Release memory for operand by bump way.

Parameters
[in]indexThe operand index

Implements onert::backend::basic::IMemoryPlanner< ir::OperandIndex >.

Definition at line 33 of file MemoryPlanner.cc.

34{
35 VERBOSE(BP_PLANNER) << "RELEASE(" << ind << "): "
36 << "NOTHING does" << std::endl;
37}

References VERBOSE.


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