ArmNN
 24.08
NeonBackend.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017-2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
8 
9 #include <arm_compute/core/CPP/CPPTypes.h>
10 
11 namespace armnn
12 {
13 
14 // add new capabilities here..
16  {
17  {"NonConstWeights", true},
18  {"AsyncExecution", false},
19  {"ProtectedContentAllocation", false},
20  {"ConstantTensorsAsInputs", true},
21  {"PreImportIOTensors", false},
22  {"ExternallyManagedMemory", true},
23  {"MultiAxisPacking", false},
24  {"SingleAxisPacking", true},
25  {"HasFp16", arm_compute::CPUInfo::get().has_fp16()}
26  });
27 
28 
30 {
31 public:
32  NeonBackend() = default;
33  ~NeonBackend() = 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  const ModelOptions& modelOptions) const override;
48 
50  const ModelOptions& modelOptions) const override;
51 
54  const IRuntime::CreationOptions&, IBackendProfilingPtr& backendProfiling) override;
56  IBackendInternal::ILayerSupportSharedPtr GetLayerSupport(const ModelOptions& modelOptions) const override;
57 
59  const ModelOptions& modelOptions) const override;
60 
61  std::vector<ITensorHandleFactory::FactoryId> GetHandleFactoryPreferences() const override;
62 
63  void RegisterTensorHandleFactories(class TensorHandleFactoryRegistry& registry) override;
64 
66  const ModelOptions& modelOptions) const override;
67 
69  {
70  return cpuAccCapabilities;
71  };
72 
73  std::unique_ptr<ICustomAllocator> GetDefaultAllocator() const override;
74 };
75 
76 } // namespace armnn
armnn::NeonBackend::GetCapabilities
BackendCapabilities GetCapabilities() const override
Returns a BackendCapability if the backend lists the capability The BackendCapability must then be in...
Definition: NeonBackend.hpp:68
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::IBackendInternal
Definition: IBackendInternal.hpp:77
armnn::IBackendInternal::IBackendContextPtr
std::unique_ptr< IBackendContext > IBackendContextPtr
Definition: IBackendInternal.hpp:90
armnn::NeonBackend::GetHandleFactoryPreferences
std::vector< ITensorHandleFactory::FactoryId > GetHandleFactoryPreferences() const override
(Optional) Returns a vector of supported TensorHandleFactory ids in preference order.
Definition: NeonBackend.cpp:618
armnn::NeonBackend::NeonBackend
NeonBackend()=default
armnn::NeonBackend::CreateBackendContext
IBackendInternal::IBackendContextPtr CreateBackendContext(const IRuntime::CreationOptions &) const override
Create the runtime context of the backend.
Definition: NeonBackend.cpp:109
armnn::cpuAccCapabilities
const BackendCapabilities cpuAccCapabilities("CpuAcc", { {"NonConstWeights", true}, {"AsyncExecution", false}, {"ProtectedContentAllocation", false}, {"ConstantTensorsAsInputs", true}, {"PreImportIOTensors", false}, {"ExternallyManagedMemory", true}, {"MultiAxisPacking", false}, {"SingleAxisPacking", true}, {"HasFp16", arm_compute::CPUInfo::get().has_fp16()} })
armnn::NeonBackend::GetDefaultAllocator
std::unique_ptr< ICustomAllocator > GetDefaultAllocator() const override
Returns the default memory allocator for the backend.
Definition: NeonBackend.cpp:637
armnn::NeonBackend::OptimizeSubgraphView
OptimizationViews OptimizeSubgraphView(const SubgraphView &subgraph, const ModelOptions &modelOptions) const override
Definition: NeonBackend.cpp:144
IBackendInternal.hpp
armnn::NeonBackend
Definition: NeonBackend.hpp:29
armnn::NeonBackend::CreateBackendProfilingContext
IBackendInternal::IBackendProfilingContextPtr CreateBackendProfilingContext(const IRuntime::CreationOptions &, IBackendProfilingPtr &backendProfiling) override
Create context specifically used for profiling interaction from backends.
Definition: NeonBackend.cpp:114
armnn::SubgraphView
The SubgraphView class represents a subgraph of a Graph.
Definition: SubgraphView.hpp:31
armnn::OptimizationViews
Definition: OptimizationViews.hpp:17
armnn::NeonBackend::GetId
const BackendId & GetId() const override
Definition: NeonBackend.hpp:36
armnn::NeonBackend::CreateMemoryManager
IBackendInternal::IMemoryManagerUniquePtr CreateMemoryManager() const override
Definition: NeonBackend.cpp:52
armnn::NeonBackend::GetIdStatic
static const BackendId & GetIdStatic()
Definition: NeonBackend.cpp:46
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::NeonBackend::GetLayerSupport
IBackendInternal::ILayerSupportSharedPtr GetLayerSupport() const override
Definition: NeonBackend.cpp:126
armnn::NeonBackend::CreateBackendSpecificModelContext
IBackendInternal::IBackendSpecificModelContextPtr CreateBackendSpecificModelContext(const ModelOptions &modelOptions) const override
Definition: NeonBackend.cpp:120
armnn::BackendOptions
Struct for the users to pass backend specific options.
Definition: BackendOptions.hpp:22
armnn::NeonBackend::RegisterTensorHandleFactories
void RegisterTensorHandleFactories(class TensorHandleFactoryRegistry &registry) override
(Optional) Register TensorHandleFactories Either this method or CreateMemoryManager() and IWorkloadFa...
Definition: NeonBackend.cpp:623
armnn::IBackendInternal::IBackendProfilingPtr
std::unique_ptr< arm::pipe::IBackendProfiling > IBackendProfilingPtr
Definition: IBackendInternal.hpp:93
armnn::IRuntime::CreationOptions
Definition: IRuntime.hpp:78
armnn::NeonBackend::~NeonBackend
~NeonBackend()=default
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::IBackendInternal::ILayerSupportSharedPtr
std::shared_ptr< ILayerSupport > ILayerSupportSharedPtr
Definition: IBackendInternal.hpp:94
armnn::ModelOptions
std::vector< BackendOptions > ModelOptions
Definition: BackendOptions.hpp:18
armnn::IBackendInternal::IWorkloadFactoryPtr
std::unique_ptr< IWorkloadFactory > IWorkloadFactoryPtr
Definition: IBackendInternal.hpp:89
armnn::NeonBackend::CreateWorkloadFactory
IWorkloadFactoryPtr CreateWorkloadFactory(const IBackendInternal::IMemoryManagerSharedPtr &memoryManager=nullptr) const override
Definition: NeonBackend.cpp:58
armnn::IBackendInternal::IBackendSpecificModelContextPtr
std::shared_ptr< IBackendModelContext > IBackendSpecificModelContextPtr
Definition: IBackendInternal.hpp:96