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/SingleAxisPriorityListTests.cpp | |
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/SingleAxisPriorityListTests.cpp')
-rw-r--r-- | src/backends/backendsCommon/memoryOptimizerStrategyLibrary/test/SingleAxisPriorityListTests.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/backends/backendsCommon/memoryOptimizerStrategyLibrary/test/SingleAxisPriorityListTests.cpp b/src/backends/backendsCommon/memoryOptimizerStrategyLibrary/test/SingleAxisPriorityListTests.cpp new file mode 100644 index 0000000000..516f6f3771 --- /dev/null +++ b/src/backends/backendsCommon/memoryOptimizerStrategyLibrary/test/SingleAxisPriorityListTests.cpp @@ -0,0 +1,42 @@ +// +// Copyright © 2021 Arm Ltd and Contributors. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#include <backendsCommon/memoryOptimizerStrategyLibrary/strategies/SingleAxisPriorityList.hpp> +#include <backendsCommon/memoryOptimizerStrategyLibrary/strategies/StrategyValidator.hpp> +#include "TestMemBlocks.hpp" + +#include <doctest/doctest.h> +#include <vector> + +using namespace armnn; + +TEST_SUITE("SingleAxisPriorityListTestSuite") +{ + TEST_CASE("SingleAxisPriorityListTest") + { + std::vector<MemBlock> memBlocks = fsrcnn; + + auto singleAxisPriorityList = std::make_shared<SingleAxisPriorityList>(); + + CHECK_EQ(singleAxisPriorityList->GetName(), std::string("SingleAxisPriorityList")); + CHECK_EQ(singleAxisPriorityList->GetMemBlockStrategyType(), MemBlockStrategyType::SingleAxisPacking); + + StrategyValidator validator; + validator.SetStrategy(singleAxisPriorityList); + + std::vector<MemBin> memBins; + + CHECK_NOTHROW(memBins = validator.Optimize(memBlocks)); + + size_t minMemSize = GetMinPossibleMemorySize(memBlocks); + size_t actualSize = 0; + for (auto memBin : memBins) + { + actualSize += memBin.m_MemSize; + } + + CHECK(minMemSize == actualSize); + } +} |