diff options
author | Matteo Martincigh <matteo.martincigh@arm.com> | 2019-08-15 12:08:06 +0100 |
---|---|---|
committer | Matteo Martincigh <matteo.martincigh@arm.com> | 2019-08-19 12:12:28 +0000 |
commit | 895339092fa9edc0aa59de0309f79bebacc3fa63 (patch) | |
tree | 6e98c570423ff4ff292ebd109e9c3792bdd1a3b9 /src/armnn | |
parent | f800de2140ca55f29bacfa6795df7a28aba3e5ff (diff) | |
download | armnn-895339092fa9edc0aa59de0309f79bebacc3fa63.tar.gz |
IVGCVSW-3545 Update the device specs with the dynamic backend ids
* Now the utility function RegisterDynamicBackends returns a list of
the backend ids that have been registered
* The list of registered ids is added to the list of supported backends
in the Runtime
* Added unit tests
Change-Id: I97bbe1f680920358f5baba5a4666e4983b849cac
Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com>
Diffstat (limited to 'src/armnn')
-rw-r--r-- | src/armnn/DeviceSpec.hpp | 7 | ||||
-rw-r--r-- | src/armnn/Runtime.cpp | 8 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/armnn/DeviceSpec.hpp b/src/armnn/DeviceSpec.hpp index 35923e6f9d..32264706fd 100644 --- a/src/armnn/DeviceSpec.hpp +++ b/src/armnn/DeviceSpec.hpp @@ -24,9 +24,14 @@ public: return m_SupportedBackends; } + void AddSupportedBackends(const BackendIdSet& backendIds) + { + m_SupportedBackends.insert(backendIds.begin(), backendIds.end()); + } + private: DeviceSpec() = delete; BackendIdSet m_SupportedBackends; }; -} +} // namespace armnn diff --git a/src/armnn/Runtime.cpp b/src/armnn/Runtime.cpp index 6b91863deb..9e874848ec 100644 --- a/src/armnn/Runtime.cpp +++ b/src/armnn/Runtime.cpp @@ -144,8 +144,7 @@ Runtime::Runtime(const CreationOptions& options) { // Store backend contexts for the supported ones const BackendIdSet& supportedBackends = m_DeviceSpec.GetSupportedBackends(); - auto it = supportedBackends.find(id); - if (it != supportedBackends.end()) + if (supportedBackends.find(id) != supportedBackends.end()) { auto factoryFun = BackendRegistryInstance().GetFactory(id); auto backend = factoryFun(); @@ -257,7 +256,10 @@ void Runtime::LoadDynamicBackends(const std::string& overrideBackendPath) m_DynamicBackends = DynamicBackendUtils::CreateDynamicBackends(sharedObjects); // Register the dynamic backends in the backend registry - DynamicBackendUtils::RegisterDynamicBackends(m_DynamicBackends); + BackendIdSet registeredBackendIds = DynamicBackendUtils::RegisterDynamicBackends(m_DynamicBackends); + + // Add the registered dynamic backend ids to the list of supported backends + m_DeviceSpec.AddSupportedBackends(registeredBackendIds); } } // namespace armnn |