24.08
SingleAxisPriorityList.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
7
#include <
armnn/Types.hpp
>
8
#include <
armnn/backends/IMemoryOptimizerStrategy.hpp
>
9
#include <tuple>
10
#include <utility>
11
#include <algorithm>
12
13
#include <list>
14
15
namespace
armnn
16
{
17
18
/// SingleAxisPriorityList sorts the MemBlocks according to some priority,
19
/// then trys to place them into as few bins as possible
20
class
SingleAxisPriorityList
:
public
IMemoryOptimizerStrategy
21
{
22
public
:
23
SingleAxisPriorityList
()
24
: m_Name(
std
::string(
"SingleAxisPriorityList"
))
25
, m_MemBlockStrategyType(
MemBlockStrategyType
::
SingleAxisPacking
) {}
26
27
std::string
GetName
()
const override
;
28
29
MemBlockStrategyType
GetMemBlockStrategyType
()
const override
;
30
31
std::vector<MemBin>
Optimize
(std::vector<MemBlock>& memBlocks)
override
;
32
33
private
:
34
35
// Tracks all memBlocks and their positions in a bin as well as their maximum memSize
36
struct
BinTracker;
37
38
// PlaceBlocks takes a list of MemBlock* and fits them into n bins.
39
// A block can only fit into an existing bin if it's lifetime does not overlap with the lifetime of the
40
// blocks already in a bin.
41
// If no appropriate bin is available a new one is created.
42
void
PlaceBlocks(
const
std::list<MemBlock*>& priorityList,
43
std::vector<BinTracker>& placedBlocks,
44
const
unsigned
int
maxLifetime);
45
46
std::string m_Name;
47
MemBlockStrategyType
m_MemBlockStrategyType;
48
};
49
50
}
// namespace armnn
IMemoryOptimizerStrategy.hpp
armnn::SingleAxisPriorityList::GetMemBlockStrategyType
MemBlockStrategyType GetMemBlockStrategyType() const override
Definition:
SingleAxisPriorityList.cpp:28
armnn::SingleAxisPriorityList::SingleAxisPriorityList
SingleAxisPriorityList()
Definition:
SingleAxisPriorityList.hpp:23
armnn::SingleAxisPriorityList::Optimize
std::vector< MemBin > Optimize(std::vector< MemBlock > &memBlocks) override
Definition:
SingleAxisPriorityList.cpp:214
armnn::IMemoryOptimizerStrategy
Definition:
IMemoryOptimizerStrategy.hpp:45
armnn::MemBlockStrategyType
MemBlockStrategyType
Definition:
Types.hpp:253
armnn::SingleAxisPriorityList
SingleAxisPriorityList sorts the MemBlocks according to some priority, then trys to place them into a...
Definition:
SingleAxisPriorityList.hpp:20
armnn::MemBlockStrategyType::SingleAxisPacking
@ SingleAxisPacking
std
Definition:
BackendId.hpp:149
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition:
01_00_quick_start.dox:6
Types.hpp
armnn::SingleAxisPriorityList::GetName
std::string GetName() const override
Definition:
SingleAxisPriorityList.cpp:24
src
backends
backendsCommon
memoryOptimizerStrategyLibrary
strategies
SingleAxisPriorityList.hpp
Generated on Wed Aug 28 2024 14:31:49 for Arm NN by
1.8.17