blob: 05a6ec0f87a4b2c6ae30481408a8111be2071415 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
//
// Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
#include <armnn/backends/IMemoryManager.hpp>
#include <forward_list>
#include <vector>
namespace armnn
{
// An implementation of IMemoryManager to be used with RefTensorHandle
class TosaRefMemoryManager : public IMemoryManager
{
public:
TosaRefMemoryManager();
virtual ~TosaRefMemoryManager();
class Pool;
Pool* Manage(unsigned int numBytes);
void Allocate(Pool *pool);
void* GetPointer(Pool *pool);
void Acquire() override;
void Release() override;
class Pool
{
public:
Pool(unsigned int numBytes);
~Pool();
void Acquire();
void Release();
void* GetPointer();
void Reserve(unsigned int numBytes);
private:
unsigned int m_Size;
void* m_Pointer;
};
private:
TosaRefMemoryManager(const TosaRefMemoryManager&) = delete; // Noncopyable
TosaRefMemoryManager& operator=(const TosaRefMemoryManager&) = delete; // Noncopyable
std::forward_list<Pool> m_Pools;
std::vector<Pool*> m_FreePools;
};
}
|