ArmNN
 25.11
Loading...
Searching...
No Matches
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
11namespace 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{
31public:
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;
57
59 const ModelOptions& modelOptions) const override;
60
61 std::vector<ITensorHandleFactory::FactoryId> GetHandleFactoryPreferences() const override;
62
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
IBackendInternal()=default
Creation must be done through a specific backend interface.
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()
NeonBackend()=default
IBackendInternal::IBackendSpecificModelContextPtr CreateBackendSpecificModelContext(const ModelOptions &modelOptions) const override
const BackendId & GetId() 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.
IBackendInternal::IBackendContextPtr CreateBackendContext(const IRuntime::CreationOptions &) const override
Create the runtime context of the backend.
IWorkloadFactoryPtr CreateWorkloadFactory(const IBackendInternal::IMemoryManagerSharedPtr &memoryManager=nullptr) const override
IBackendInternal::ILayerSupportSharedPtr GetLayerSupport() const override
IBackendInternal::IMemoryManagerUniquePtr CreateMemoryManager() const override
BackendCapabilities GetCapabilities() const override
Returns a BackendCapability if the backend lists the capability The BackendCapability must then be in...
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
BackendOptions BackendCapabilities
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} })