IVGCVSW-6470 Create MemoryStrategyBenchmark
* Refactor the strategy library to be more generic
* Shorten the names of the current strategies
* Change validatorStrat to throw exceptions
Change-Id: I0d9c9ef609b2d8675e5788610d1accac6767c660
Signed-off-by: Finn Williams <finwil01@e127804.cambridge.arm.com>
Signed-off-by: Jim Flynn <jim.flynn@arm.com>
diff --git a/src/backends/backendsCommon/memoryOptimizerStrategyLibrary/strategies/StrategyValidator.hpp b/src/backends/backendsCommon/memoryOptimizerStrategyLibrary/strategies/StrategyValidator.hpp
new file mode 100644
index 0000000..e1f9111
--- /dev/null
+++ b/src/backends/backendsCommon/memoryOptimizerStrategyLibrary/strategies/StrategyValidator.hpp
@@ -0,0 +1,41 @@
+//
+// Copyright © 2021 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+#pragma once
+
+#include <armnn/Types.hpp>
+#include <armnn/Exceptions.hpp>
+#include <armnn/backends/IMemoryOptimizerStrategy.hpp>
+
+namespace armnn
+{
+
+class StrategyValidator : public IMemoryOptimizerStrategy
+{
+public:
+
+ void SetStrategy(std::shared_ptr<IMemoryOptimizerStrategy> strategy)
+ {
+ m_Strategy = strategy;
+ m_MemBlockStrategyType = strategy->GetMemBlockStrategyType();
+ }
+
+ std::string GetName() const override
+ {
+ return "StrategyValidator";
+ }
+
+ MemBlockStrategyType GetMemBlockStrategyType() const override
+ {
+ return m_MemBlockStrategyType;
+ }
+
+ std::vector<MemBin> Optimize(std::vector<MemBlock>& memBlocks) override;
+
+private:
+ std::shared_ptr<IMemoryOptimizerStrategy> m_Strategy;
+ MemBlockStrategyType m_MemBlockStrategyType;
+};
+
+} // namespace armnn
\ No newline at end of file