From ae050524109f1ce827962665436ef7430f2ac479 Mon Sep 17 00:00:00 2001 From: David Monahan Date: Wed, 22 Mar 2023 16:48:58 +0000 Subject: IVGCVSW-7255 Update Doxygen Documentation and publish on GitHub. * Updating Doxygen documentation for 23.02 release. Signed-off-by: David Monahan Change-Id: I545574ff7664b4595d2fe6a91a3c35d2ad55df82 --- latest/classarmnn_1_1_backend_registry.xhtml | 793 +++++++++++++++++++++++++++ 1 file changed, 793 insertions(+) create mode 100644 latest/classarmnn_1_1_backend_registry.xhtml (limited to 'latest/classarmnn_1_1_backend_registry.xhtml') diff --git a/latest/classarmnn_1_1_backend_registry.xhtml b/latest/classarmnn_1_1_backend_registry.xhtml new file mode 100644 index 0000000000..f7dbe6587a --- /dev/null +++ b/latest/classarmnn_1_1_backend_registry.xhtml @@ -0,0 +1,793 @@ + + + + + + + + + + + + + +ArmNN: BackendRegistry Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  23.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ + +
+ +

#include <BackendRegistry.hpp>

+ + + + +

+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.

+
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 }
+
+

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

+ +

Referenced by DynamicBackendUtils::DeregisterDynamicBackends().

+ +
+
+ +

◆ DeregisterAllocator()

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

Definition at line 123 of file BackendRegistry.cpp.

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

Referenced by BackendRegistry::Deregister().

+ +
+
+ +

◆ DeregisterMemoryOptimizerStrategy()

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

Definition at line 145 of file BackendRegistry.cpp.

+
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.

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

◆ GetBackendIds()

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

Definition at line 75 of file BackendRegistry.cpp.

+
76 {
+
77  BackendIdSet result;
+
78  for (const auto& it : m_Factories)
+
79  {
+
80  result.insert(it.first);
+
81  }
+
82  return result;
+
83 }
+
+

Referenced by BackendRegistry::GetBackendIdsAsString().

+ +
+
+ +

◆ GetBackendIdsAsString()

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

Definition at line 85 of file BackendRegistry.cpp.

+
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 }
+
+

References BackendRegistry::GetBackendIds().

+ +
+
+ +

◆ GetFactory()

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

Definition at line 57 of file BackendRegistry.cpp.

+
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 }
+
+

References CHECK_LOCATION.

+ +

Referenced by armnn::GetILayerSupportByBackendId(), and RuntimeImpl::RuntimeImpl().

+ +
+
+ +

◆ GetMemoryOptimizerStrategies()

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

Definition at line 150 of file BackendRegistry.cpp.

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

◆ IsBackendRegistered()

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

Definition at line 52 of file BackendRegistry.cpp.

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

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

+ +
+
+ +

◆ Register()

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

Definition at line 21 of file BackendRegistry.cpp.

+
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 }
+
+

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

+ +

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

+ +
+
+ +

◆ RegisterAllocator()

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

Definition at line 112 of file BackendRegistry.cpp.

+
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 }
+
+

References CHECK_LOCATION.

+ +

Referenced by RuntimeImpl::RuntimeImpl().

+ +
+
+ +

◆ RegisterMemoryOptimizerStrategy()

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

Definition at line 133 of file BackendRegistry.cpp.

+
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 }
+
+

References CHECK_LOCATION.

+ +

Referenced by RuntimeImpl::RuntimeImpl().

+ +
+
+ +

◆ SetProfilingService()

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

Definition at line 107 of file BackendRegistry.cpp.

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

Referenced by RuntimeImpl::~RuntimeImpl().

+ +
+
+ +

◆ Size()

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

Definition at line 70 of file BackendRegistry.cpp.

+
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.

+
103 {
+
104  std::swap(instance.m_Factories, other);
+
105 }
+
+

References armnn::swap().

+ +
+
+
The documentation for this class was generated from the following files: +
+
+
#define CHECK_LOCATION()
Definition: Exceptions.hpp:203
+
void DeregisterAllocator(const BackendId &id)
+
BackendIdSet GetBackendIds() const
+ +
void swap(OriginsDescriptor &first, OriginsDescriptor &second)
+
bool has_value() const noexcept
Definition: Optional.hpp:53
+
std::unordered_set< BackendId > BackendIdSet
Definition: BackendId.hpp:193
+ + + + -- cgit v1.2.1