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 /include/armnn/BackendRegistry.hpp | |
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 'include/armnn/BackendRegistry.hpp')
-rw-r--r-- | include/armnn/BackendRegistry.hpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/armnn/BackendRegistry.hpp b/include/armnn/BackendRegistry.hpp index c13aa9f8b6..0d09607de2 100644 --- a/include/armnn/BackendRegistry.hpp +++ b/include/armnn/BackendRegistry.hpp @@ -8,7 +8,9 @@ #include <armnn/BackendId.hpp> #include <armnn/Optional.hpp> #include <armnn/backends/ICustomAllocator.hpp> +#include <armnn/backends/IMemoryOptimizerStrategy.hpp> +#include <algorithm> #include <memory> #include <unordered_map> #include <functional> @@ -22,6 +24,7 @@ namespace profiling } class IBackendInternal; using IBackendInternalUniquePtr = std::unique_ptr<IBackendInternal>; +using MemoryOptimizerStrategiesMapRef = std::unordered_map<BackendId, std::shared_ptr<IMemoryOptimizerStrategy>>; class BackendRegistry { @@ -38,6 +41,8 @@ public: void SetProfilingService(armnn::Optional<profiling::ProfilingService&> profilingService); void RegisterAllocator(const BackendId& id, std::shared_ptr<ICustomAllocator> alloc); std::unordered_map<BackendId, std::shared_ptr<ICustomAllocator>> GetAllocators(); + void RegisterMemoryOptimizerStrategy(const BackendId& id, std::shared_ptr<IMemoryOptimizerStrategy> strategy); + MemoryOptimizerStrategiesMapRef GetMemoryOptimizerStrategies(); BackendRegistry() {} virtual ~BackendRegistry() {} @@ -54,6 +59,7 @@ public: void Deregister(const BackendId& id); void DeregisterAllocator(const BackendId &id); + void DeregisterMemoryOptimizerStrategy(const BackendId &id); protected: using FactoryStorage = std::unordered_map<BackendId, FactoryFunction>; @@ -68,6 +74,7 @@ private: FactoryStorage m_Factories; armnn::Optional<profiling::ProfilingService&> m_ProfilingService; std::unordered_map<BackendId, std::shared_ptr<ICustomAllocator>> m_CustomMemoryAllocatorMap; + std::unordered_map<BackendId, std::shared_ptr<IMemoryOptimizerStrategy>> m_MemoryOptimizerStrategyMap; }; BackendRegistry& BackendRegistryInstance(); |