ArmNN
 25.02
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NeonBackend.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017-2024 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  {"ProtectedContentAllocation", false},
19  {"ConstantTensorsAsInputs", true},
20  {"PreImportIOTensors", false},
21  {"ExternallyManagedMemory", true},
22  {"MultiAxisPacking", false},
23  {"SingleAxisPacking", true},
24  {"HasFp16", arm_compute::CPUInfo::get().has_fp16()},
25  {"AllOrNothing", false}
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
std::shared_ptr< ILayerSupport > ILayerSupportSharedPtr
std::unique_ptr< IMemoryManager > IMemoryManagerUniquePtr
std::unique_ptr< arm::pipe::IBackendProfiling > IBackendProfilingPtr
std::shared_ptr< IBackendModelContext > IBackendSpecificModelContextPtr
std::shared_ptr< IMemoryManager > IMemoryManagerSharedPtr
std::unique_ptr< IWorkloadFactory > IWorkloadFactoryPtr
std::unique_ptr< IBackendContext > IBackendContextPtr
std::shared_ptr< arm::pipe::IBackendProfilingContext > IBackendProfilingContextPtr
This is the bridge between backend and backend profiling we'll keep it in the backend namespace.
static const BackendId & GetIdStatic()
Definition: NeonBackend.cpp:46
NeonBackend()=default
IBackendInternal::IBackendSpecificModelContextPtr CreateBackendSpecificModelContext(const ModelOptions &modelOptions) const override
OptimizationViews OptimizeSubgraphView(const SubgraphView &subgraph, const ModelOptions &modelOptions) const override
~NeonBackend()=default
void RegisterTensorHandleFactories(class TensorHandleFactoryRegistry &registry) override
(Optional) Register TensorHandleFactories Either this method or CreateMemoryManager() and IWorkloadFa...
std::vector< ITensorHandleFactory::FactoryId > GetHandleFactoryPreferences() const override
(Optional) Returns a vector of supported TensorHandleFactory ids in preference order.
IBackendInternal::IBackendProfilingContextPtr CreateBackendProfilingContext(const IRuntime::CreationOptions &, IBackendProfilingPtr &backendProfiling) override
Create context specifically used for profiling interaction from backends.
const BackendId & GetId() const override
Definition: NeonBackend.hpp:36
IBackendInternal::IBackendContextPtr CreateBackendContext(const IRuntime::CreationOptions &) const override
Create the runtime context of the backend.
IWorkloadFactoryPtr CreateWorkloadFactory(const IBackendInternal::IMemoryManagerSharedPtr &memoryManager=nullptr) const override
Definition: NeonBackend.cpp:58
IBackendInternal::ILayerSupportSharedPtr GetLayerSupport() const override
IBackendInternal::IMemoryManagerUniquePtr CreateMemoryManager() const override
Definition: NeonBackend.cpp:52
BackendCapabilities GetCapabilities() const override
Returns a BackendCapability if the backend lists the capability The BackendCapability must then be in...
Definition: NeonBackend.hpp:68
std::unique_ptr< ICustomAllocator > GetDefaultAllocator() const override
Returns the default memory allocator for the backend.
The SubgraphView class represents a subgraph of a Graph.
Copyright (c) 2021 ARM Limited and Contributors.
std::vector< BackendOptions > ModelOptions
const BackendCapabilities cpuAccCapabilities("CpuAcc", { {"NonConstWeights", true}, {"ProtectedContentAllocation", false}, {"ConstantTensorsAsInputs", true}, {"PreImportIOTensors", false}, {"ExternallyManagedMemory", true}, {"MultiAxisPacking", false}, {"SingleAxisPacking", true}, {"HasFp16", arm_compute::CPUInfo::get().has_fp16()}, {"AllOrNothing", false} })
Struct for the users to pass backend specific options.