aboutsummaryrefslogtreecommitdiff
path: root/tests/MemoryStrategyBenchmark/TestStrategy.cpp
blob: 9e9194972aa4b857a733a5acc28e49ea083a54e8 (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
//
// Copyright © 2021 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//

#include "TestStrategy.hpp"

namespace armnn
{

    std::string TestStrategy::GetName() const
    {
        return m_Name;
    }

    MemBlockStrategyType TestStrategy::GetMemBlockStrategyType() const
    {
        return m_MemBlockStrategyType;
    }

    // A IMemoryOptimizerStrategy must ensure that
    // 1: All MemBlocks have been assigned to a MemBin
    // 2: No MemBlock is assigned to multiple MemBins
    // 3: No two Memblocks in a MemBin overlap in both the X and Y axis
    std::vector<MemBin> TestStrategy::Optimize(std::vector<MemBlock>& memBlocks)
    {
        std::vector<MemBin> memBins;
        memBins.reserve(memBlocks.size());

        for (auto& memBlock : memBlocks)
        {
            MemBin memBin;
            memBin.m_MemSize = memBlock.m_MemSize;
            memBin.m_MemBlocks.reserve(1);
            memBlock.m_Offset = 0;
            memBin.m_MemBlocks.push_back(memBlock);
            memBins.push_back(memBin);
        }

        return memBins;
    }

} // namespace armnn