ArmNN
 24.08
RefBackend.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2022-2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
8 
9 namespace armnn
10 {
11 // add new capabilities here..
13  {
14  {"NonConstWeights", true},
15  {"AsyncExecution", true},
16  {"ProtectedContentAllocation", false},
17  {"ConstantTensorsAsInputs", true},
18  {"PreImportIOTensors", true},
19  {"ExternallyManagedMemory", true},
20  {"MultiAxisPacking", false},
21  {"SingleAxisPacking", true},
22  {"HasFp16", true}
23  });
24 
25 const std::set<armnn::BackendCapability> oldCpuRefCapabilities {
27 };
28 
29 
31 {
32 public:
33  RefBackend() = default;
34  ~RefBackend() = default;
35 
36  static const BackendId& GetIdStatic();
37  const BackendId& GetId() const override { return GetIdStatic(); }
38 
40 
42  const IBackendInternal::IMemoryManagerSharedPtr& memoryManager = nullptr) const override;
43 
45  class TensorHandleFactoryRegistry& tensorHandleFactoryRegistry) const override;
46 
48 
50  const IRuntime::CreationOptions& creationOptions, IBackendProfilingPtr& backendProfiling) override;
51 
53 
55  const ModelOptions& modelOptions) const override;
56 
57  std::vector<ITensorHandleFactory::FactoryId> GetHandleFactoryPreferences() const override;
58 
59  void RegisterTensorHandleFactories(class TensorHandleFactoryRegistry& registry) override;
60 
62  {
63  return cpuRefCapabilities;
64  };
65 
66  std::unique_ptr<ICustomAllocator> GetDefaultAllocator() const override;
67 
68  ExecutionData CreateExecutionData(WorkingMemDescriptor& workingMemDescriptor) const override;
69 
70  void UpdateExecutionData(ExecutionData& executionData, WorkingMemDescriptor& workingMemDescriptor) const override;
71 };
72 
73 } // namespace armnn
armnn::RefBackend::OptimizeSubgraphView
OptimizationViews OptimizeSubgraphView(const SubgraphView &subgraph, const ModelOptions &modelOptions) const override
Definition: RefBackend.cpp:72
armnn::RefBackend::CreateBackendProfilingContext
IBackendInternal::IBackendProfilingContextPtr CreateBackendProfilingContext(const IRuntime::CreationOptions &creationOptions, IBackendProfilingPtr &backendProfiling) override
Create context specifically used for profiling interaction from backends.
Definition: RefBackend.cpp:55
armnn::RefBackend::GetCapabilities
BackendCapabilities GetCapabilities() const override
Returns a BackendCapability if the backend lists the capability The BackendCapability must then be in...
Definition: RefBackend.hpp:61
armnn::RefBackend::CreateBackendContext
IBackendInternal::IBackendContextPtr CreateBackendContext(const IRuntime::CreationOptions &) const override
Create the runtime context of the backend.
Definition: RefBackend.cpp:50
armnn::BackendCapability::NonConstWeights
@ NonConstWeights
Constant weights can be accessed through the descriptors, On the other hand, non-const weights can be...
armnn::IBackendInternal::IMemoryManagerSharedPtr
std::shared_ptr< IMemoryManager > IMemoryManagerSharedPtr
Definition: IBackendInternal.hpp:99
armnn::TensorHandleFactoryRegistry
Definition: TensorHandleFactoryRegistry.hpp:23
armnn::BackendCapabilities
BackendOptions BackendCapabilities
Definition: BackendOptions.hpp:19
armnn::RefBackend::GetId
const BackendId & GetId() const override
Definition: RefBackend.hpp:37
armnn::IBackendInternal
Definition: IBackendInternal.hpp:77
armnn::IBackendInternal::IBackendContextPtr
std::unique_ptr< IBackendContext > IBackendContextPtr
Definition: IBackendInternal.hpp:90
armnn::RefBackend::CreateMemoryManager
IBackendInternal::IMemoryManagerUniquePtr CreateMemoryManager() const override
Definition: RefBackend.cpp:61
armnn::RefBackend::GetIdStatic
static const BackendId & GetIdStatic()
Definition: RefBackend.cpp:22
armnn::RefBackend::GetDefaultAllocator
std::unique_ptr< ICustomAllocator > GetDefaultAllocator() const override
Returns the default memory allocator for the backend.
Definition: RefBackend.cpp:157
armnn::RefBackend::RefBackend
RefBackend()=default
armnn::RefBackend
Definition: RefBackend.hpp:30
IBackendInternal.hpp
armnn::RefBackend::GetLayerSupport
IBackendInternal::ILayerSupportSharedPtr GetLayerSupport() const override
Definition: RefBackend.cpp:66
armnn::cpuRefCapabilities
const BackendCapabilities cpuRefCapabilities("CpuRef", { {"NonConstWeights", true}, {"AsyncExecution", true}, {"ProtectedContentAllocation", false}, {"ConstantTensorsAsInputs", true}, {"PreImportIOTensors", true}, {"ExternallyManagedMemory", true}, {"MultiAxisPacking", false}, {"SingleAxisPacking", true}, {"HasFp16", true} })
armnn::SubgraphView
The SubgraphView class represents a subgraph of a Graph.
Definition: SubgraphView.hpp:31
armnn::OptimizationViews
Definition: OptimizationViews.hpp:17
armnn::RefBackend::CreateWorkloadFactory
IBackendInternal::IWorkloadFactoryPtr CreateWorkloadFactory(const IBackendInternal::IMemoryManagerSharedPtr &memoryManager=nullptr) const override
Definition: RefBackend.cpp:28
armnn::RefBackend::RegisterTensorHandleFactories
void RegisterTensorHandleFactories(class TensorHandleFactoryRegistry &registry) override
(Optional) Register TensorHandleFactories Either this method or CreateMemoryManager() and IWorkloadFa...
Definition: RefBackend.cpp:143
armnn::RefBackend::CreateExecutionData
ExecutionData CreateExecutionData(WorkingMemDescriptor &workingMemDescriptor) const override
Returns ExecutionData for the backend.
Definition: RefBackend.cpp:162
armnn::IBackendInternal::IBackendProfilingContextPtr
std::shared_ptr< arm::pipe::IBackendProfilingContext > IBackendProfilingContextPtr
This is the bridge between backend and backend profiling we'll keep it in the backend namespace.
Definition: IBackendInternal.hpp:92
armnn::oldCpuRefCapabilities
const std::set< armnn::BackendCapability > oldCpuRefCapabilities
Definition: RefBackend.hpp:25
armnn::BackendOptions
Struct for the users to pass backend specific options.
Definition: BackendOptions.hpp:22
armnn::IBackendInternal::IBackendProfilingPtr
std::unique_ptr< arm::pipe::IBackendProfiling > IBackendProfilingPtr
Definition: IBackendInternal.hpp:93
armnn::IRuntime::CreationOptions
Definition: IRuntime.hpp:78
armnn::RefBackend::UpdateExecutionData
void UpdateExecutionData(ExecutionData &executionData, WorkingMemDescriptor &workingMemDescriptor) const override
Update the ExecutionData for a layer.
Definition: RefBackend.cpp:169
armnn::IBackendInternal::IMemoryManagerUniquePtr
std::unique_ptr< IMemoryManager > IMemoryManagerUniquePtr
Definition: IBackendInternal.hpp:98
armnn::BackendId
Definition: BackendId.hpp:75
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::RefBackend::~RefBackend
~RefBackend()=default
armnn::experimental::WorkingMemDescriptor
Definition: WorkingMemDescriptor.hpp:18
armnn::IBackendInternal::ILayerSupportSharedPtr
std::shared_ptr< ILayerSupport > ILayerSupportSharedPtr
Definition: IBackendInternal.hpp:94
armnn::ModelOptions
std::vector< BackendOptions > ModelOptions
Definition: BackendOptions.hpp:18
armnn::RefBackend::GetHandleFactoryPreferences
std::vector< ITensorHandleFactory::FactoryId > GetHandleFactoryPreferences() const override
(Optional) Returns a vector of supported TensorHandleFactory ids in preference order.
Definition: RefBackend.cpp:138
armnn::IBackendInternal::IWorkloadFactoryPtr
std::unique_ptr< IWorkloadFactory > IWorkloadFactoryPtr
Definition: IBackendInternal.hpp:89
armnn::experimental::ExecutionData
Definition: ExecutionData.hpp:14