ArmNN
 24.05
GpuFsaBackend::GpuFsaBackendCustomAllocatorWrapper Class Reference

#include <GpuFsaBackend.hpp>

Inheritance diagram for GpuFsaBackend::GpuFsaBackendCustomAllocatorWrapper:
[legend]
Collaboration diagram for GpuFsaBackend::GpuFsaBackendCustomAllocatorWrapper:
[legend]

Public Member Functions

 GpuFsaBackendCustomAllocatorWrapper (std::shared_ptr< ICustomAllocator > alloc)
 
void * allocate (size_t size, size_t alignment) override
 
void free (void *ptr) override
 
std::unique_ptr< arm_compute::IMemoryRegion > make_region (size_t size, size_t alignment) override
 

Detailed Description

Definition at line 117 of file GpuFsaBackend.hpp.

Constructor & Destructor Documentation

◆ GpuFsaBackendCustomAllocatorWrapper()

GpuFsaBackendCustomAllocatorWrapper ( std::shared_ptr< ICustomAllocator alloc)
inline

Definition at line 120 of file GpuFsaBackend.hpp.

120  : m_CustomAllocator(alloc)
121  {}

Member Function Documentation

◆ allocate()

void* allocate ( size_t  size,
size_t  alignment 
)
inlineoverride

Definition at line 123 of file GpuFsaBackend.hpp.

124  {
125  auto alloc = m_CustomAllocator->allocate(size, alignment);
126  return MapAllocatedMemory(alloc, size, m_CustomAllocator->GetMemorySourceType());
127  }

◆ free()

void free ( void *  ptr)
inlineoverride

Definition at line 128 of file GpuFsaBackend.hpp.

129  {
130  auto hostMemPtr = m_AllocatedBufferMappings[ptr];
131  clReleaseMemObject(static_cast<cl_mem>(ptr));
132  m_CustomAllocator->free(hostMemPtr);
133  }

◆ make_region()

std::unique_ptr<arm_compute::IMemoryRegion> make_region ( size_t  size,
size_t  alignment 
)
inlineoverride

Definition at line 134 of file GpuFsaBackend.hpp.

135  {
136  auto hostMemPtr = m_CustomAllocator->allocate(size, alignment);
137  cl_mem buffer = MapAllocatedMemory(hostMemPtr, size, m_CustomAllocator->GetMemorySourceType());
138 
139  return std::make_unique<ClBackendCustomAllocatorMemoryRegion>(cl::Buffer(buffer),
140  hostMemPtr,
141  m_CustomAllocator->GetMemorySourceType());
142  }

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