Loading...
Searching...
No Matches
memory_pool.h
Go to the documentation of this file.
1// SPDX-License-Identifier: AGPL-3.0-only
2// Copyright (C) 2026 Artificial Intelligence Techniques, S.L. and Roberto López González
3
4#pragma once
5
7
8namespace opennn
9{
10
21
22constexpr Index backward_step(Index layers_number, Index layer) noexcept
23{
24 return 2 * layers_number - 1 - layer;
25}
26
28{
29 Index bytes = 0;
30 Index first_step = 0;
31 Index last_step = 0;
32};
33
35{
36 vector<Index> byte_offsets;
37 Index peak_bytes = 0;
39
40 Index fragmentation_bytes() const noexcept
41 {
43 }
44};
45
47 const vector<MemoryPoolEntry>&,
49
50MemoryPoolPlan plan_memory_pool_best(const vector<MemoryPoolEntry>&);
51
53 const vector<MemoryPoolEntry>&,
54 const MemoryPoolPlan&,
55 Index bytes,
56 Index first_step,
57 Index second_step);
58
59}
Definition configuration.h:10
constexpr Index backward_step(Index layers_number, Index layer) noexcept
Definition memory_pool.h:22
Index find_memory_pool_overlay(const vector< MemoryPoolEntry > &, const MemoryPoolPlan &, Index bytes, Index first_step, Index second_step)
MemoryPoolPlan plan_memory_pool_best(const vector< MemoryPoolEntry > &)
MemoryPoolPlan plan_memory_pool(const vector< MemoryPoolEntry > &, MemoryPoolStrategy=MemoryPoolStrategy::Chronological)
MemoryPoolStrategy
Definition memory_pool.h:12
@ ShortestLifetimeFirst
Definition memory_pool.h:19
@ EarliestEndFirst
Definition memory_pool.h:16
@ Compact
Definition memory_pool.h:14
@ Chronological
Definition memory_pool.h:13
@ ChronologicalLargestFirst
Definition memory_pool.h:15
@ LongestLifetimeFirst
Definition memory_pool.h:18
@ LatestEndFirst
Definition memory_pool.h:17
Definition memory_pool.h:28
Index bytes
Definition memory_pool.h:29
Index last_step
Definition memory_pool.h:31
Index first_step
Definition memory_pool.h:30
Definition memory_pool.h:35
vector< Index > byte_offsets
Definition memory_pool.h:36
Index peak_bytes
Definition memory_pool.h:37
Index fragmentation_bytes() const noexcept
Definition memory_pool.h:40
Index lower_bound_live_bytes
Definition memory_pool.h:38