ArmNN
 24.02
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 115 of file GpuFsaBackend.hpp.

Constructor & Destructor Documentation

◆ GpuFsaBackendCustomAllocatorWrapper()

GpuFsaBackendCustomAllocatorWrapper ( std::shared_ptr< ICustomAllocator alloc)
inline

Definition at line 118 of file GpuFsaBackend.hpp.

118  : m_CustomAllocator(alloc)
119  {}

Member Function Documentation

◆ allocate()

void* allocate ( size_t  size,
size_t  alignment 
)
inlineoverride

Definition at line 121 of file GpuFsaBackend.hpp.

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

◆ free()

void free ( void *  ptr)
inlineoverride

Definition at line 126 of file GpuFsaBackend.hpp.

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

◆ make_region()

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

Definition at line 132 of file GpuFsaBackend.hpp.

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

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