From 549b9600a6eaf0727fa084465a75f173edf8f381 Mon Sep 17 00:00:00 2001 From: Nikhil Raj Date: Tue, 24 May 2022 11:32:07 +0100 Subject: Update 22.05 Doxygen Docs after updates to main Readme Signed-off-by: Nikhil Raj Change-Id: I56711772406a41ff81fa136a5fb6c59c9b9cf504 --- ..._cl_backend_default_allocator_8hpp_source.xhtml | 126 +++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 22.05/_cl_backend_default_allocator_8hpp_source.xhtml (limited to '22.05/_cl_backend_default_allocator_8hpp_source.xhtml') diff --git a/22.05/_cl_backend_default_allocator_8hpp_source.xhtml b/22.05/_cl_backend_default_allocator_8hpp_source.xhtml new file mode 100644 index 0000000000..609bb95f9c --- /dev/null +++ b/22.05/_cl_backend_default_allocator_8hpp_source.xhtml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + +ArmNN: src/backends/cl/ClBackendDefaultAllocator.hpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  22.05 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
ClBackendDefaultAllocator.hpp
+
+
+Go to the documentation of this file.
1 //
2 // Copyright © 2021 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 #include <cstddef>
7 #include <memory>
10 
11 namespace armnn
12 {
13 /** Default Memory Allocator class returned from IBackendInternal::GetDefaultAllocator(MemorySource) */
15 {
16 public:
17  ClBackendDefaultAllocator() = default;
18 
19  void* allocate(size_t size, size_t alignment = 0) override
20  {
21  IgnoreUnused(alignment);
22  cl_mem buf{ clCreateBuffer(arm_compute::CLScheduler::get().context().get(),
23  CL_MEM_ALLOC_HOST_PTR | CL_MEM_READ_WRITE,
24  size,
25  nullptr,
26  nullptr)};
27  return static_cast<void *>(buf);
28  }
29 
30  void free(void* ptr) override
31  {
32  ARM_COMPUTE_ERROR_ON(ptr == nullptr);
33  clReleaseMemObject(static_cast<cl_mem>(ptr));
34  }
35 
37  {
39  }
40 
41  void* GetMemoryRegionAtOffset(void* buffer, size_t offset, size_t alignment = 0) override
42  {
43  IgnoreUnused(alignment);
44  return static_cast<char*>(buffer) + offset;
45  }
46 };
47 } // namespace armnn
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...
+ + + +
MemorySource
Define the Memory Source to reduce copies.
Definition: Types.hpp:230
+
+
+ + + + -- cgit v1.2.1