ArmNN
 24.08
GpuFsaMemoryManager.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2022-2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
8 
9 #include <forward_list>
10 #include <vector>
11 
12 namespace armnn
13 {
14 
15 // A dummy MemoryManager which will be deleted once the GpuFsa Backend is integrated with ClMemoryManager
17 {
18 public:
20  virtual ~GpuFsaMemoryManager();
21 
22  class Pool;
23 
24  Pool* Manage(unsigned int numBytes);
25 
26  void Allocate(Pool *pool);
27 
28  void* GetPointer(Pool *pool);
29 
30  void Acquire() override;
31  void Release() override;
32 
33  class Pool
34  {
35  public:
36  Pool(unsigned int numBytes);
37  ~Pool();
38 
39  void Acquire();
40  void Release();
41 
42  void* GetPointer();
43 
44  void Reserve(unsigned int numBytes);
45 
46  private:
47  unsigned int m_Size;
48  void* m_Pointer;
49  };
50 
51 private:
52  GpuFsaMemoryManager(const GpuFsaMemoryManager&) = delete; // Noncopyable
53  GpuFsaMemoryManager& operator=(const GpuFsaMemoryManager&) = delete; // Noncopyable
54 
55  std::forward_list<Pool> m_Pools;
56  std::vector<Pool*> m_FreePools;
57 };
58 
59 }
armnn::GpuFsaMemoryManager::Acquire
void Acquire() override
Definition: GpuFsaMemoryManager.cpp:50
armnn::GpuFsaMemoryManager::Manage
Pool * Manage(unsigned int numBytes)
Definition: GpuFsaMemoryManager.cpp:19
armnn::GpuFsaMemoryManager::~GpuFsaMemoryManager
virtual ~GpuFsaMemoryManager()
Definition: GpuFsaMemoryManager.cpp:16
armnn::GpuFsaMemoryManager::Pool::Release
void Release()
Definition: GpuFsaMemoryManager.cpp:109
armnn::GpuFsaMemoryManager::Pool
Definition: GpuFsaMemoryManager.hpp:33
armnn::GpuFsaMemoryManager::GetPointer
void * GetPointer(Pool *pool)
Definition: GpuFsaMemoryManager.cpp:45
armnn::IMemoryManager
Definition: IMemoryManager.hpp:12
armnn::GpuFsaMemoryManager::GpuFsaMemoryManager
GpuFsaMemoryManager()
Definition: GpuFsaMemoryManager.cpp:13
armnn::GpuFsaMemoryManager::Pool::~Pool
~Pool()
Definition: GpuFsaMemoryManager.cpp:71
armnn::GpuFsaMemoryManager::Allocate
void Allocate(Pool *pool)
Definition: GpuFsaMemoryManager.cpp:35
armnn::GpuFsaMemoryManager::Pool::Reserve
void Reserve(unsigned int numBytes)
Definition: GpuFsaMemoryManager.cpp:89
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::GpuFsaMemoryManager::Pool::Pool
Pool(unsigned int numBytes)
Definition: GpuFsaMemoryManager.cpp:66
armnn::GpuFsaMemoryManager::Pool::GetPointer
void * GetPointer()
Definition: GpuFsaMemoryManager.cpp:79
armnn::GpuFsaMemoryManager
Definition: GpuFsaMemoryManager.hpp:16
armnn::GpuFsaMemoryManager::Release
void Release() override
Definition: GpuFsaMemoryManager.cpp:58
armnn::GpuFsaMemoryManager::Pool::Acquire
void Acquire()
Definition: GpuFsaMemoryManager.cpp:99
IMemoryManager.hpp