From 549b9600a6eaf0727fa084465a75f173edf8f381 Mon Sep 17 00:00:00 2001 From: Nikhil Raj Date: Tue, 24 May 2022 11:32:07 +0100 Subject: Update 22.05 Doxygen Docs after updates to main Readme Signed-off-by: Nikhil Raj Change-Id: I56711772406a41ff81fa136a5fb6c59c9b9cf504 --- 22.05/classarmnn_1_1_backend_registry.xhtml | 709 ++++++++++++++++++++++++++++ 1 file changed, 709 insertions(+) create mode 100644 22.05/classarmnn_1_1_backend_registry.xhtml (limited to '22.05/classarmnn_1_1_backend_registry.xhtml') diff --git a/22.05/classarmnn_1_1_backend_registry.xhtml b/22.05/classarmnn_1_1_backend_registry.xhtml new file mode 100644 index 0000000000..bc2583700f --- /dev/null +++ b/22.05/classarmnn_1_1_backend_registry.xhtml @@ -0,0 +1,709 @@ + + + + + + + + + + + + + +ArmNN: BackendRegistry Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  22.05 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ + +
+ +

#include <BackendRegistry.hpp>

+
+Inheritance diagram for BackendRegistry:
+
+
+ + +TestBackendRegistry + +
+ + + + +

+Classes

struct  StaticRegistryInitializer
 
+ + + + + +

+Public Types

using PointerType = IBackendInternalUniquePtr
 
using FactoryFunction = std::function< PointerType()>
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

void Register (const BackendId &id, FactoryFunction factory)
 
bool IsBackendRegistered (const BackendId &id) const
 
FactoryFunction GetFactory (const BackendId &id) const
 
size_t Size () const
 
BackendIdSet GetBackendIds () const
 
std::string GetBackendIdsAsString () const
 
void SetProfilingService (armnn::Optional< arm::pipe::IProfilingService &> 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 ()
 
void Deregister (const BackendId &id)
 
void DeregisterAllocator (const BackendId &id)
 
void DeregisterMemoryOptimizerStrategy (const BackendId &id)
 
+ + + +

+Protected Types

using FactoryStorage = std::unordered_map< BackendId, FactoryFunction >
 
+ + + + +

+Static Protected Member Functions

static void Swap (BackendRegistry &instance, FactoryStorage &other)
 For testing only. More...
 
+

Detailed Description

+
+

Definition at line 35 of file BackendRegistry.hpp.

+

Member Typedef Documentation

+ +

◆ FactoryFunction

+ +
+
+ + + + +
using FactoryFunction = std::function<PointerType()>
+
+ +

Definition at line 39 of file BackendRegistry.hpp.

+ +
+
+ +

◆ FactoryStorage

+ +
+
+ + + + + +
+ + + + +
using FactoryStorage = std::unordered_map<BackendId, FactoryFunction>
+
+protected
+
+ +

Definition at line 71 of file BackendRegistry.hpp.

+ +
+
+ +

◆ PointerType

+ +
+
+ +

Definition at line 38 of file BackendRegistry.hpp.

+ +
+
+

Constructor & Destructor Documentation

+ +

◆ BackendRegistry()

+ +
+
+ + + + + +
+ + + + + + + +
BackendRegistry ()
+
+inline
+
+ +

Definition at line 53 of file BackendRegistry.hpp.

+
53 {}
+
+
+ +

◆ ~BackendRegistry()

+ +
+
+ + + + + +
+ + + + + + + +
virtual ~BackendRegistry ()
+
+inlinevirtual
+
+ +

Definition at line 54 of file BackendRegistry.hpp.

+
54 {}
+
+
+

Member Function Documentation

+ +

◆ Deregister()

+ +
+
+ + + + + + + + +
void Deregister (const BackendIdid)
+
+ +

Definition at line 41 of file BackendRegistry.cpp.

+ +

References BackendRegistry::DeregisterAllocator(), OptionalBase::has_value(), and OptionalReferenceSwitch< IsReference, T >::value().

+ +

Referenced by DynamicBackendUtils::DeregisterDynamicBackends(), TEST_SUITE(), MockBackendInitialiser::~MockBackendInitialiser(), and MockImportBackendInitialiser::~MockImportBackendInitialiser().

+
42 {
43  m_Factories.erase(id);
45 
46  if (m_ProfilingService.has_value() && m_ProfilingService.value().IsProfilingEnabled())
47  {
48  m_ProfilingService.value().IncrementCounterValue(arm::pipe::UNREGISTERED_BACKENDS);
49  }
50 }
void DeregisterAllocator(const BackendId &id)
+ +
bool has_value() const noexcept
Definition: Optional.hpp:53
+
+
+
+ +

◆ DeregisterAllocator()

+ +
+
+ + + + + + + + +
void DeregisterAllocator (const BackendIdid)
+
+ +

Definition at line 123 of file BackendRegistry.cpp.

+ +

Referenced by BackendRegistry::Deregister().

+
124 {
125  m_CustomMemoryAllocatorMap.erase(id);
126 }
+
+
+ +

◆ DeregisterMemoryOptimizerStrategy()

+ +
+
+ + + + + + + + +
void DeregisterMemoryOptimizerStrategy (const BackendIdid)
+
+ +

Definition at line 145 of file BackendRegistry.cpp.

+ +

Referenced by TEST_SUITE().

+
146 {
147  m_MemoryOptimizerStrategyMap.erase(id);
148 }
+
+
+ +

◆ GetAllocators()

+ +
+
+ + + + + + + +
std::unordered_map< BackendId, std::shared_ptr< ICustomAllocator > > GetAllocators ()
+
+ +

Definition at line 128 of file BackendRegistry.cpp.

+ +

Referenced by LoadedNetwork::RegisterDebugCallback().

+
129 {
130  return m_CustomMemoryAllocatorMap;
131 }
+
+
+ +

◆ GetBackendIds()

+ +
+
+ + + + + + + +
BackendIdSet GetBackendIds () const
+
+ +

Definition at line 75 of file BackendRegistry.cpp.

+ +

Referenced by BackendRegistry::GetBackendIdsAsString(), and TEST_SUITE().

+
76 {
77  BackendIdSet result;
78  for (const auto& it : m_Factories)
79  {
80  result.insert(it.first);
81  }
82  return result;
83 }
std::unordered_set< BackendId > BackendIdSet
Definition: BackendId.hpp:193
+
+
+
+ +

◆ GetBackendIdsAsString()

+ +
+
+ + + + + + + +
std::string GetBackendIdsAsString () const
+
+ +

Definition at line 85 of file BackendRegistry.cpp.

+ +

References BackendRegistry::GetBackendIds().

+ +

Referenced by InferenceModel< IParser, TDataType >::AddCommandLineOptions(), main(), and ProgramOptions::ProgramOptions().

+
86 {
87  static const std::string delimitator = ", ";
88 
89  std::stringstream output;
90  for (auto& backendId : GetBackendIds())
91  {
92  if (output.tellp() != std::streampos(0))
93  {
94  output << delimitator;
95  }
96  output << backendId;
97  }
98 
99  return output.str();
100 }
BackendIdSet GetBackendIds() const
+
+
+
+ +

◆ GetFactory()

+ +
+
+ + + + + + + + +
BackendRegistry::FactoryFunction GetFactory (const BackendIdid) const
+
+ +

Definition at line 57 of file BackendRegistry.cpp.

+ +

References CHECK_LOCATION.

+ +

Referenced by armnn::GetILayerSupportByBackendId(), LoadedNetwork::MakeLoadedNetwork(), RuntimeImpl::RuntimeImpl(), and TEST_SUITE().

+
58 {
59  auto it = m_Factories.find(id);
60  if (it == m_Factories.end())
61  {
62  throw InvalidArgumentException(
63  std::string(id) + " has no IBackend factory registered",
64  CHECK_LOCATION());
65  }
66 
67  return it->second;
68 }
#define CHECK_LOCATION()
Definition: Exceptions.hpp:203
+
+
+
+ +

◆ GetMemoryOptimizerStrategies()

+ +
+
+ + + + + + + +
MemoryOptimizerStrategiesMapRef GetMemoryOptimizerStrategies ()
+
+ +

Definition at line 150 of file BackendRegistry.cpp.

+ +

Referenced by LoadedNetwork::MakeLoadedNetwork().

+
151 {
152  return m_MemoryOptimizerStrategyMap;
153 }
+
+
+ +

◆ IsBackendRegistered()

+ +
+
+ + + + + + + + +
bool IsBackendRegistered (const BackendIdid) const
+
+ +

Definition at line 52 of file BackendRegistry.cpp.

+ +

Referenced by armnn::GetILayerSupportByBackendId(), and DynamicBackendUtils::RegisterDynamicBackendsImpl().

+
53 {
54  return (m_Factories.find(id) != m_Factories.end());
55 }
+
+
+ +

◆ Register()

+ +
+
+ + + + + + + + + + + + + + + + + + +
void Register (const BackendIdid,
BackendRegistry::FactoryFunction factory 
)
+
+ +

Definition at line 21 of file BackendRegistry.cpp.

+ +

References CHECK_LOCATION, OptionalBase::has_value(), and OptionalReferenceSwitch< IsReference, T >::value().

+ +

Referenced by MockBackendInitialiser::MockBackendInitialiser(), MockImportBackendInitialiser::MockImportBackendInitialiser(), DynamicBackendUtils::RegisterDynamicBackendsImpl(), BackendRegistry::StaticRegistryInitializer::StaticRegistryInitializer(), and TEST_SUITE().

+
22 {
23  if (m_Factories.find(id) != m_Factories.end())
24  {
25  throw InvalidArgumentException(
26  std::string(id) + " already registered as IBackend factory",
27  CHECK_LOCATION());
28  }
29  m_Factories[id] = factory;
30 
31  if (m_ProfilingService.has_value())
32  {
33  if (m_ProfilingService.has_value() && m_ProfilingService.value().IsProfilingEnabled())
34  {
35  m_ProfilingService.value().IncrementCounterValue(arm::pipe::REGISTERED_BACKENDS);
36  }
37  }
38 
39 }
+
bool has_value() const noexcept
Definition: Optional.hpp:53
+
#define CHECK_LOCATION()
Definition: Exceptions.hpp:203
+
+
+
+ +

◆ RegisterAllocator()

+ +
+
+ + + + + + + + + + + + + + + + + + +
void RegisterAllocator (const BackendIdid,
std::shared_ptr< ICustomAllocatoralloc 
)
+
+ +

Definition at line 112 of file BackendRegistry.cpp.

+ +

References CHECK_LOCATION.

+ +

Referenced by RuntimeImpl::RuntimeImpl().

+
113 {
114  if (m_CustomMemoryAllocatorMap.find(id) != m_CustomMemoryAllocatorMap.end())
115  {
116  throw InvalidArgumentException(
117  std::string(id) + " already has an allocator associated with it",
118  CHECK_LOCATION());
119  }
120  m_CustomMemoryAllocatorMap[id] = alloc;
121 }
#define CHECK_LOCATION()
Definition: Exceptions.hpp:203
+
+
+
+ +

◆ RegisterMemoryOptimizerStrategy()

+ +
+
+ + + + + + + + + + + + + + + + + + +
void RegisterMemoryOptimizerStrategy (const BackendIdid,
std::shared_ptr< IMemoryOptimizerStrategystrategy 
)
+
+ +

Definition at line 133 of file BackendRegistry.cpp.

+ +

References CHECK_LOCATION.

+ +

Referenced by RuntimeImpl::RuntimeImpl(), and TEST_SUITE().

+
135 {
136  if (m_MemoryOptimizerStrategyMap.find(id) != m_MemoryOptimizerStrategyMap.end())
137  {
138  throw InvalidArgumentException(
139  std::string(id) + " already has an memory optimizer strategy associated with it",
140  CHECK_LOCATION());
141  }
142  m_MemoryOptimizerStrategyMap[id] = strategy;
143 }
#define CHECK_LOCATION()
Definition: Exceptions.hpp:203
+
+
+
+ +

◆ SetProfilingService()

+ +
+
+ + + + + + + + +
void SetProfilingService (armnn::Optional< arm::pipe::IProfilingService &> profilingService)
+
+ +

Definition at line 107 of file BackendRegistry.cpp.

+ +

Referenced by RuntimeImpl::RuntimeImpl(), and RuntimeImpl::~RuntimeImpl().

+
108 {
109  m_ProfilingService = profilingService;
110 }
+
+
+ +

◆ Size()

+ +
+
+ + + + + + + +
size_t Size () const
+
+ +

Definition at line 70 of file BackendRegistry.cpp.

+ +

Referenced by RuntimeEmptyTestImpl(), RuntimeInvalidOverridePathTestImpl(), and TEST_SUITE().

+
71 {
72  return m_Factories.size();
73 }
+
+
+ +

◆ Swap()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void Swap (BackendRegistryinstance,
BackendRegistry::FactoryStorageother 
)
+
+staticprotected
+
+ +

For testing only.

+ +

Definition at line 102 of file BackendRegistry.cpp.

+ +

References armnn::swap().

+
103 {
104  std::swap(instance.m_Factories, other);
105 }
void swap(OriginsDescriptor &first, OriginsDescriptor &second)
+
+
+
+
The documentation for this class was generated from the following files: +
+
+ + + + -- cgit v1.2.1