24.08
ConstantMemoryStrategy.cpp
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
6
#include "
ConstantMemoryStrategy.hpp
"
7
8
namespace
armnn
9
{
10
11
std::string
ConstantMemoryStrategy::GetName
()
const
12
{
13
return
m_Name;
14
}
15
16
MemBlockStrategyType
ConstantMemoryStrategy::GetMemBlockStrategyType
()
const
17
{
18
return
m_MemBlockStrategyType;
19
}
20
21
// A IMemoryOptimizerStrategy must ensure that
22
// 1: All MemBlocks have been assigned to a MemBin
23
// 2: No MemBlock is assigned to multiple MemBins
24
// 3: No two Memblocks in a MemBin overlap in both the X and Y axis
25
std::vector<MemBin>
ConstantMemoryStrategy::Optimize
(std::vector<MemBlock>& memBlocks)
26
{
27
std::vector<MemBin> memBins;
28
memBins.reserve(memBlocks.size());
29
30
for
(
auto
& memBlock : memBlocks)
31
{
32
MemBin
memBin;
33
memBin.
m_MemSize
= memBlock.m_MemSize;
34
memBin.
m_MemBlocks
.reserve(1);
35
memBlock.m_Offset = 0;
36
memBin.
m_MemBlocks
.push_back(memBlock);
37
memBins.push_back(memBin);
38
}
39
40
return
memBins;
41
}
42
43
}
// namespace armnn
armnn::MemBlockStrategyType
MemBlockStrategyType
Definition:
Types.hpp:253
armnn::MemBin::m_MemSize
size_t m_MemSize
Definition:
IMemoryOptimizerStrategy.hpp:35
armnn::MemBin::m_MemBlocks
std::vector< MemBlock > m_MemBlocks
Definition:
IMemoryOptimizerStrategy.hpp:34
armnn::ConstantMemoryStrategy::GetName
std::string GetName() const override
Definition:
ConstantMemoryStrategy.cpp:11
ConstantMemoryStrategy.hpp
armnn::ConstantMemoryStrategy::GetMemBlockStrategyType
MemBlockStrategyType GetMemBlockStrategyType() const override
Definition:
ConstantMemoryStrategy.cpp:16
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition:
01_00_quick_start.dox:6
armnn::ConstantMemoryStrategy::Optimize
std::vector< MemBin > Optimize(std::vector< MemBlock > &memBlocks) override
Definition:
ConstantMemoryStrategy.cpp:25
armnn::MemBin
Definition:
IMemoryOptimizerStrategy.hpp:32
src
backends
backendsCommon
memoryOptimizerStrategyLibrary
strategies
ConstantMemoryStrategy.cpp
Generated on Wed Aug 28 2024 14:31:49 for Arm NN by
1.8.17