19 void*
allocate(
size_t size,
size_t alignment = 0)
override 22 cl_mem buf{ clCreateBuffer(arm_compute::CLScheduler::get().context().
get(),
23 CL_MEM_ALLOC_HOST_PTR | CL_MEM_READ_WRITE,
27 return static_cast<void *
>(buf);
30 void free(
void* ptr)
override 32 ARM_COMPUTE_ERROR_ON(ptr ==
nullptr);
33 clReleaseMemObject(static_cast<cl_mem>(ptr));
44 return static_cast<char*
>(buffer) + offset;
Custom Allocator interface.
Default Memory Allocator class returned from IBackendInternal::GetDefaultAllocator(MemorySource) ...
void free(void *ptr) override
Interface to be implemented by the child class to free the allocated bytes.
armnn::MemorySource GetMemorySourceType() override
Used to specify what type of memory is being allocated by this allocator.
void * allocate(size_t size, size_t alignment=0) override
Interface to be implemented by the child class to allocate bytes.
Copyright (c) 2021 ARM Limited and Contributors.
void IgnoreUnused(Ts &&...)
void * GetMemoryRegionAtOffset(void *buffer, size_t offset, size_t alignment=0) override
Interface that may be implemented to allow retrieval of Memory Region from allocated buffer at a cert...
ClBackendDefaultAllocator()=default
MemorySource
Define the Memory Source to reduce copies.