forked from larryliu0820/executorch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
base_mem_manager.h
34 lines (27 loc) · 948 Bytes
/
base_mem_manager.h
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
#pragma once
#include <core/Tensor.h>
namespace torch {
namespace executor {
// The base memory manager for the executor.
// In a typical embedded system, there can be one or more memory pools
// to store data. This manager has the sizes and base addresses of those
// memory pools.
// In the case of static memory planning, where all the data allocation
// (memory pool id and offset) can be determined offline, this manager simply
// privides the base addresses, and is only used in initialization stage.
class BaseMemManager {
public:
BaseMemManager(int n_mems, int* sizes, uint8_t** base_addresses)
: n_mems_(n_mems),
sizes_(sizes),
base_addresses_(base_addresses) {}
// The manager holds n_mems_ memory pools.
int n_mems_;
// Sizes of the pools
int* sizes_;
// The array of base addresses for each memory pool
uint8_t** base_addresses_;
virtual ~BaseMemManager() {}
};
} // namespace executor
} // namespace torch