diff options
author | Finn Williams <finn.williams@arm.com> | 2021-10-27 11:25:02 +0100 |
---|---|---|
committer | finn.williams <finn.williams@arm.com> | 2021-11-04 12:53:02 +0000 |
commit | f9d96e5a04810b4f1182b4c1b0f27601f6deb0dd (patch) | |
tree | 88f67fe9d0f91ebe500a7f771b2774d622dfa88b /src/backends/backendsCommon/memoryOptimizerStrategyLibrary/test/TestMemBlocks.hpp | |
parent | 5095667f04d41801d5d6049b7dbd75b5d8f6013a (diff) | |
download | armnn-f9d96e5a04810b4f1182b4c1b0f27601f6deb0dd.tar.gz |
IVGCVSW-6303 Create a SingleAxisPacking strategy
* add fsrcnn and mobilebert memory profiles to the strategy benchmark
Signed-off-by: Finn Williams <finn.williams@arm.com>
Change-Id: Ibd8b26f2153c561e5c5bec477f6246d0e8ffa4af
Diffstat (limited to 'src/backends/backendsCommon/memoryOptimizerStrategyLibrary/test/TestMemBlocks.hpp')
-rw-r--r-- | src/backends/backendsCommon/memoryOptimizerStrategyLibrary/test/TestMemBlocks.hpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/backends/backendsCommon/memoryOptimizerStrategyLibrary/test/TestMemBlocks.hpp b/src/backends/backendsCommon/memoryOptimizerStrategyLibrary/test/TestMemBlocks.hpp new file mode 100644 index 0000000000..09369d1efa --- /dev/null +++ b/src/backends/backendsCommon/memoryOptimizerStrategyLibrary/test/TestMemBlocks.hpp @@ -0,0 +1,43 @@ +// +// Copyright © 2021 Arm Ltd and Contributors. All rights reserved. +// SPDX-License-Identifier: MIT +// + +size_t GetMinPossibleMemorySize(const std::vector<armnn::MemBlock>& blocks) +{ + unsigned int maxLifetime = 0; + for (auto& block: blocks) + { + maxLifetime = std::max(maxLifetime, block.m_EndOfLife); + } + maxLifetime++; + + std::vector<size_t> lifetimes(maxLifetime); + for (const auto& block : blocks) + { + for (auto lifetime = block.m_StartOfLife; lifetime <= block.m_EndOfLife; ++lifetime) + { + lifetimes[lifetime] += block.m_MemSize; + } + } + return *std::max_element(lifetimes.begin(), lifetimes.end()); +} + +// Generated from fsrcnn_720p.tflite +std::vector<armnn::MemBlock> fsrcnn +{ + { 0, 1, 691200, 0, 0 }, + { 1, 3, 7372800, 0, 1 }, + { 2, 5, 7372800, 0, 2 }, + { 3, 7, 1843200, 0, 3 }, + { 4, 9, 1843200, 0, 4 }, + { 5, 11, 1843200, 0, 5 }, + { 6, 13, 1843200, 0, 6 }, + { 7, 15, 1843200, 0, 7 }, + { 8, 17, 1843200, 0, 8 }, + { 9, 19, 7372800, 0, 9 }, + { 10, 21, 7372800, 0, 10 }, + { 11, 23, 2764800, 0, 11 }, + { 12, 25, 2764800, 0, 12 }, + { 13, 27, 2764800, 0, 13 } +};
\ No newline at end of file |