Compute Library
 22.08
OffsetLifetimeManager Class Reference

Concrete class that tracks the lifetime of registered tensors and calculates the systems memory requirements in terms of a single blob and a list of offsets. More...

#include <OffsetLifetimeManager.h>

Collaboration diagram for OffsetLifetimeManager:
[legend]

Public Types

using info_type = BlobInfo
 

Public Member Functions

 OffsetLifetimeManager ()
 Constructor. More...
 
 OffsetLifetimeManager (const OffsetLifetimeManager &)=delete
 Prevent instances of this class to be copy constructed. More...
 
OffsetLifetimeManageroperator= (const OffsetLifetimeManager &)=delete
 Prevent instances of this class to be copied. More...
 
 OffsetLifetimeManager (OffsetLifetimeManager &&)=default
 Allow instances of this class to be move constructed. More...
 
OffsetLifetimeManageroperator= (OffsetLifetimeManager &&)=default
 Allow instances of this class to be moved. More...
 
const info_typeinfo () const
 Accessor to the pool internal configuration meta-data. More...
 
std::unique_ptr< IMemoryPoolcreate_pool (IAllocator *allocator) override
 Creates a memory pool depending on the memory requirements. More...
 
MappingType mapping_type () const override
 Returns the type of mappings that the lifetime manager returns. More...
 
- Public Member Functions inherited from ISimpleLifetimeManager
 ISimpleLifetimeManager ()
 Constructor. More...
 
 ISimpleLifetimeManager (const ISimpleLifetimeManager &)=delete
 Prevent instances of this class to be copy constructed. More...
 
ISimpleLifetimeManageroperator= (const ISimpleLifetimeManager &)=delete
 Prevent instances of this class to be copied. More...
 
 ISimpleLifetimeManager (ISimpleLifetimeManager &&)=default
 Allow instances of this class to be move constructed. More...
 
ISimpleLifetimeManageroperator= (ISimpleLifetimeManager &&)=default
 Allow instances of this class to be moved. More...
 
void register_group (IMemoryGroup *group) override
 Registers a group to the lifetime manager and assigns a group id. More...
 
bool release_group (IMemoryGroup *group) override
 Unbound and release elements associated with a group. More...
 
void start_lifetime (void *obj) override
 Registers and starts lifetime of an object. More...
 
void end_lifetime (void *obj, IMemory &obj_memory, size_t size, size_t alignment) override
 Ends lifetime of an object. More...
 
bool are_all_finalized () const override
 Checks if the lifetime of the registered object is complete. More...
 
- Public Member Functions inherited from ILifetimeManager
virtual ~ILifetimeManager ()=default
 Virtual Destructor. More...
 

Detailed Description

Concrete class that tracks the lifetime of registered tensors and calculates the systems memory requirements in terms of a single blob and a list of offsets.

Definition at line 41 of file OffsetLifetimeManager.h.

Member Typedef Documentation

◆ info_type

Definition at line 44 of file OffsetLifetimeManager.h.

Constructor & Destructor Documentation

◆ OffsetLifetimeManager() [1/3]

Constructor.

Definition at line 46 of file OffsetLifetimeManager.cpp.

47  : _blob(0)
48 {
49 }

◆ OffsetLifetimeManager() [2/3]

Prevent instances of this class to be copy constructed.

◆ OffsetLifetimeManager() [3/3]

Allow instances of this class to be move constructed.

Member Function Documentation

◆ create_pool()

std::unique_ptr< IMemoryPool > create_pool ( IAllocator allocator)
overridevirtual

Creates a memory pool depending on the memory requirements.

Parameters
allocatorAllocator to use
Returns
A memory pool

Implements ILifetimeManager.

Definition at line 56 of file OffsetLifetimeManager.cpp.

References arm_compute::test::validation::allocator(), and ARM_COMPUTE_ERROR_ON.

57 {
58  ARM_COMPUTE_ERROR_ON(allocator == nullptr);
59  return std::make_unique<OffsetMemoryPool>(allocator, _blob);
60 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
input allocator() -> allocate()

◆ info()

const OffsetLifetimeManager::info_type & info ( ) const

Accessor to the pool internal configuration meta-data.

Returns
Lifetime manager internal configuration meta-data

Definition at line 51 of file OffsetLifetimeManager.cpp.

52 {
53  return _blob;
54 }

◆ mapping_type()

MappingType mapping_type ( ) const
overridevirtual

Returns the type of mappings that the lifetime manager returns.

Returns
Mapping type of the lifetime manager

Implements ILifetimeManager.

Definition at line 62 of file OffsetLifetimeManager.cpp.

References BlobInfo::alignment, ISimpleLifetimeManager::are_all_finalized(), ARM_COMPUTE_ERROR_ON, arm_compute::test::validation::b, arm_compute::mlgo::parser::end(), arm_compute::utility::for_each(), offset(), arm_compute::OFFSETS, BlobInfo::owners, and BlobInfo::size.

63 {
64  return MappingType::OFFSETS;
65 }
Mappings are in offset granularity in the same blob.

◆ operator=() [1/2]

OffsetLifetimeManager& operator= ( const OffsetLifetimeManager )
delete

Prevent instances of this class to be copied.

◆ operator=() [2/2]

OffsetLifetimeManager& operator= ( OffsetLifetimeManager &&  )
default

Allow instances of this class to be moved.


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