ArmNN
 22.11
RefBackend.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2022 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  });
23 
24 const std::set<armnn::BackendCapability> oldCpuRefCapabilities {
26 };
27 
28 
30 {
31 public:
32  RefBackend() = default;
33  ~RefBackend() = default;
34 
35  static const BackendId& GetIdStatic();
36  const BackendId& GetId() const override { return GetIdStatic(); }
37 
39 
41  const IBackendInternal::IMemoryManagerSharedPtr& memoryManager = nullptr) const override;
42 
44  class TensorHandleFactoryRegistry& tensorHandleFactoryRegistry) const override;
45 
47 
49  const IRuntime::CreationOptions& creationOptions, IBackendProfilingPtr& backendProfiling) override;
50 
52 
54  const ModelOptions& modelOptions) const override;
55 
56  std::vector<ITensorHandleFactory::FactoryId> GetHandleFactoryPreferences() const override;
57 
58  void RegisterTensorHandleFactories(class TensorHandleFactoryRegistry& registry) override;
59 
61  {
62  return cpuRefCapabilities;
63  };
64 
65  std::unique_ptr<ICustomAllocator> GetDefaultAllocator() const override;
66 
67  ExecutionData CreateExecutionData(WorkingMemDescriptor& workingMemDescriptor) const override;
68 
69  void UpdateExecutionData(ExecutionData& executionData, WorkingMemDescriptor& workingMemDescriptor) const override;
70 };
71 
72 } // namespace armnn
std::unique_ptr< IWorkloadFactory > IWorkloadFactoryPtr
IBackendInternal::IMemoryManagerUniquePtr CreateMemoryManager() const override
Definition: RefBackend.cpp:63
BackendCapabilities GetCapabilities() const override
Returns a BackendCapability if the backend lists the capability The BackendCapability must then be in...
Definition: RefBackend.hpp:60
std::vector< BackendOptions > ModelOptions
void UpdateExecutionData(ExecutionData &executionData, WorkingMemDescriptor &workingMemDescriptor) const override
Update the ExecutionData for a layer.
Definition: RefBackend.cpp:164
const BackendId & GetId() const override
Definition: RefBackend.hpp:36
IBackendInternal::ILayerSupportSharedPtr GetLayerSupport() const override
Definition: RefBackend.cpp:68
static const BackendId & GetIdStatic()
Definition: RefBackend.cpp:24
void RegisterTensorHandleFactories(class TensorHandleFactoryRegistry &registry) override
(Optional) Register TensorHandleFactories Either this method or CreateMemoryManager() and IWorkloadFa...
Definition: RefBackend.cpp:138
Copyright (c) 2021 ARM Limited and Contributors.
std::unique_ptr< IMemoryManager > IMemoryManagerUniquePtr
IBackendInternal::IBackendContextPtr CreateBackendContext(const IRuntime::CreationOptions &) const override
Create the runtime context of the backend.
Definition: RefBackend.cpp:52
const BackendCapabilities cpuRefCapabilities("CpuRef", { {"NonConstWeights", true}, {"AsyncExecution", true}, {"ProtectedContentAllocation", false}, {"ConstantTensorsAsInputs", true}, {"PreImportIOTensors", true}, {"ExternallyManagedMemory", true}, {"MultiAxisPacking", false}, {"SingleAxisPacking", true} })
IBackendInternal::IBackendProfilingContextPtr CreateBackendProfilingContext(const IRuntime::CreationOptions &creationOptions, IBackendProfilingPtr &backendProfiling) override
Create context specifically used for profiling interaction from backends.
Definition: RefBackend.cpp:57
The SubgraphView class represents a subgraph of a Graph.
const std::set< armnn::BackendCapability > oldCpuRefCapabilities
Definition: RefBackend.hpp:24
Constant weights can be accessed through the descriptors, On the other hand, non-const weights can be...
ExecutionData CreateExecutionData(WorkingMemDescriptor &workingMemDescriptor) const override
Returns ExecutionData for the backend.
Definition: RefBackend.cpp:157
std::shared_ptr< IMemoryManager > IMemoryManagerSharedPtr
OptimizationViews OptimizeSubgraphView(const SubgraphView &subgraph, const ModelOptions &modelOptions) const override
Definition: RefBackend.cpp:74
IBackendInternal::IWorkloadFactoryPtr CreateWorkloadFactory(const IBackendInternal::IMemoryManagerSharedPtr &memoryManager=nullptr) const override
Definition: RefBackend.cpp:30
BackendOptions BackendCapabilities
std::shared_ptr< arm::pipe::IBackendProfilingContext > IBackendProfilingContextPtr
This is the bridge between backend and backend profiling we&#39;ll keep it in the backend namespace...
std::unique_ptr< ICustomAllocator > GetDefaultAllocator() const override
Returns the default memory allocator for the backend.
Definition: RefBackend.cpp:152
std::shared_ptr< ILayerSupport > ILayerSupportSharedPtr
Struct for the users to pass backend specific options.
std::unique_ptr< arm::pipe::IBackendProfiling > IBackendProfilingPtr
RefBackend()=default
std::vector< ITensorHandleFactory::FactoryId > GetHandleFactoryPreferences() const override
(Optional) Returns a vector of supported TensorHandleFactory ids in preference order.
Definition: RefBackend.cpp:133
~RefBackend()=default
std::unique_ptr< IBackendContext > IBackendContextPtr