aboutsummaryrefslogtreecommitdiff
path: root/tests/MemoryStrategyBenchmark/TestStrategy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/MemoryStrategyBenchmark/TestStrategy.cpp')
-rw-r--r--tests/MemoryStrategyBenchmark/TestStrategy.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/MemoryStrategyBenchmark/TestStrategy.cpp b/tests/MemoryStrategyBenchmark/TestStrategy.cpp
new file mode 100644
index 0000000000..9e9194972a
--- /dev/null
+++ b/tests/MemoryStrategyBenchmark/TestStrategy.cpp
@@ -0,0 +1,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 \ No newline at end of file