ArmNN
 25.11
Loading...
Searching...
No Matches
ICustomAllocator Class Referenceabstract

Custom Allocator interface. More...

#include <ICustomAllocator.hpp>

Inheritance diagram for ICustomAllocator:
[legend]

Public Member Functions

virtual ~ICustomAllocator ()=default
 Default virtual destructor.
virtual void * allocate (size_t size, size_t alignment)=0
 Interface to be implemented by the child class to allocate bytes.
virtual void free (void *ptr)=0
 Interface to be implemented by the child class to free the allocated bytes.
virtual armnn::MemorySource GetMemorySourceType ()=0
 Used to specify what type of memory is being allocated by this allocator.
virtual void * GetMemoryRegionAtOffset (void *buffer, size_t offset, size_t alignment=0)
 Interface that may be implemented to allow retrieval of Memory Region from allocated buffer at a certain offset.

Detailed Description

Custom Allocator interface.

Examples
CustomMemoryAllocatorSample.cpp.

Definition at line 16 of file ICustomAllocator.hpp.

Constructor & Destructor Documentation

◆ ~ICustomAllocator()

virtual ~ICustomAllocator ( )
virtualdefault

Default virtual destructor.

Member Function Documentation

◆ allocate()

virtual void * allocate ( size_t size,
size_t alignment )
pure virtual

Interface to be implemented by the child class to allocate bytes.

Parameters
[in]sizeSize to allocate
[in]alignmentAlignment that the returned pointer should comply with
Returns
A pointer to the allocated memory The returned pointer must be host write accessible

Implemented in ClBackendDefaultAllocator, and DefaultAllocator.

Examples
CustomMemoryAllocatorSample.cpp.

◆ free()

virtual void free ( void * ptr)
pure virtual

Interface to be implemented by the child class to free the allocated bytes.

Implemented in ClBackendDefaultAllocator, and DefaultAllocator.

Examples
CustomMemoryAllocatorSample.cpp.

◆ GetMemoryRegionAtOffset()

virtual void * GetMemoryRegionAtOffset ( void * buffer,
size_t offset,
size_t alignment = 0 )
inlinevirtual

Interface that may be implemented to allow retrieval of Memory Region from allocated buffer at a certain offset.

Reimplemented in ClBackendDefaultAllocator, and DefaultAllocator.

Definition at line 46 of file ICustomAllocator.hpp.

47 {
48 IgnoreUnused(offset);
49 IgnoreUnused(alignment);
50 IgnoreUnused(buffer);
51 throw armnn::Exception(
52 "ICustomerAllocator::GetMemoryRegionAtOffset(): This function should be overridden in subclass.");
53 }
void IgnoreUnused(Ts &&...)

References armnn::IgnoreUnused().

◆ GetMemorySourceType()

virtual armnn::MemorySource GetMemorySourceType ( )
pure virtual

Used to specify what type of memory is being allocated by this allocator.

Supported types are: MemorySource::Malloc MemorySource::DmaBuf MemorySource::DmaBufProtected

Implemented in ClBackendDefaultAllocator, and DefaultAllocator.

Examples
CustomMemoryAllocatorSample.cpp.

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