ArmNN
 24.02
ClRegistryInitializer.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "ClBackend.hpp"
7 
9 
10 namespace
11 {
12 
13 using namespace armnn;
14 
15 static BackendRegistry::StaticRegistryInitializer g_RegisterHelper
16 {
19  []()
20  {
21  // Check if we have a CustomMemoryAllocator associated with the backend
22  // and if so register it with the backend.
23  auto customAllocators = BackendRegistryInstance().GetAllocators();
24  auto allocatorIterator = customAllocators.find(ClBackend::GetIdStatic());
25  if (allocatorIterator != customAllocators.end())
26  {
27  return IBackendInternalUniquePtr(new ClBackend(allocatorIterator->second));
28  }
30  }
31 };
32 
33 } // Anonymous namespace
BackendRegistry.hpp
armnn::ClBackend
Definition: ClBackend.hpp:24
armnn::BackendRegistryInstance
BackendRegistry & BackendRegistryInstance()
Definition: BackendRegistry.cpp:15
armnn::BackendRegistry::StaticRegistryInitializer
Definition: BackendRegistry.hpp:56
ClBackend.hpp
armnn::BackendRegistry::GetAllocators
std::unordered_map< BackendId, std::shared_ptr< ICustomAllocator > > GetAllocators()
Definition: BackendRegistry.cpp:128
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::ClBackend::GetIdStatic
static const BackendId & GetIdStatic()
Definition: ClBackend.cpp:45
armnn::IBackendInternalUniquePtr
std::unique_ptr< IBackendInternal > IBackendInternalUniquePtr
Definition: BackendRegistry.hpp:32