diff options
author | Sadik Armagan <sadik.armagan@arm.com> | 2021-10-04 15:13:11 +0100 |
---|---|---|
committer | TeresaARM <teresa.charlinreyes@arm.com> | 2021-10-06 13:27:57 +0000 |
commit | b8a26d8f497f92643288a4c519af4d230ede1d7e (patch) | |
tree | 89b1ad2303b8a18d4491eb47ab16f37e53e33c37 /src/armnn/BackendRegistry.cpp | |
parent | bc3bb62c2d5b881ca7f0b3973a533134196fc802 (diff) | |
download | armnn-b8a26d8f497f92643288a4c519af4d230ede1d7e.tar.gz |
IVGCVSW-6300 'IMemoryOptimizerStrategy Add strategy library and add support in BackendRegistry'
* Updated IRuntime interface for providing custom memory optimizer strategy.
* Enabled selecting existing memory optimizer strategy by using BackendOptions
* Added MemoryOptimizerStrategyLibrary that sets one of the existing memory optimizer
strategies selected by user
Signed-off-by: Sadik Armagan <sadik.armagan@arm.com>
Change-Id: I037f8ac8efa79c0f71bd63e379101e3ad92d80c9
Diffstat (limited to 'src/armnn/BackendRegistry.cpp')
-rw-r--r-- | src/armnn/BackendRegistry.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/armnn/BackendRegistry.cpp b/src/armnn/BackendRegistry.cpp index 80daed9896..ade844fc39 100644 --- a/src/armnn/BackendRegistry.cpp +++ b/src/armnn/BackendRegistry.cpp @@ -128,4 +128,26 @@ std::unordered_map<BackendId, std::shared_ptr<ICustomAllocator>> BackendRegistry return m_CustomMemoryAllocatorMap; } +void BackendRegistry::RegisterMemoryOptimizerStrategy(const BackendId& id, + std::shared_ptr<IMemoryOptimizerStrategy> strategy) +{ + if (m_MemoryOptimizerStrategyMap.find(id) != m_MemoryOptimizerStrategyMap.end()) + { + throw InvalidArgumentException( + std::string(id) + " already has an memory optimizer strategy associated with it", + CHECK_LOCATION()); + } + m_MemoryOptimizerStrategyMap[id] = strategy; +} + +void BackendRegistry::DeregisterMemoryOptimizerStrategy(const BackendId &id) +{ + m_MemoryOptimizerStrategyMap.erase(id); +} + +MemoryOptimizerStrategiesMapRef BackendRegistry::GetMemoryOptimizerStrategies() +{ + return m_MemoryOptimizerStrategyMap; +} + } // namespace armnn |