• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright © 2017-2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
7 #include <armnn/backends/IBackendInternal.hpp>
8 
9 namespace armnn
10 {
11 
12 // add new capabilities here..
13 const BackendCapabilities cpuAccCapabilities("CpuAcc",
14                                              {
15                                                      {"NonConstWeights", true},
16                                                      {"AsyncExecution", false},
17                                                      {"ProtectedContentAllocation", false},
18                                                      {"ConstantTensorsAsInputs", true},
19                                                      {"PreImportIOTensors", false},
20                                                      {"ExternallyManagedMemory", true},
21                                                      {"MultiAxisPacking", false},
22                                                      {"SingleAxisPacking", true}
23                                              });
24 
25 
26 class NeonBackend : public IBackendInternal
27 {
28 public:
29     NeonBackend()  = default;
30     ~NeonBackend() = default;
31 
32     static const BackendId& GetIdStatic();
GetId() const33     const BackendId& GetId() const override { return GetIdStatic(); }
34 
35     IBackendInternal::IMemoryManagerUniquePtr CreateMemoryManager() const override;
36 
37     IWorkloadFactoryPtr CreateWorkloadFactory(
38         const IBackendInternal::IMemoryManagerSharedPtr& memoryManager = nullptr) const override;
39 
40     IWorkloadFactoryPtr CreateWorkloadFactory(
41         class TensorHandleFactoryRegistry& tensorHandleFactoryRegistry) const override;
42 
43     IWorkloadFactoryPtr CreateWorkloadFactory( const IMemoryManagerSharedPtr& memoryManager,
44                                                const ModelOptions& modelOptions) const override;
45 
46     IWorkloadFactoryPtr CreateWorkloadFactory(class TensorHandleFactoryRegistry& tensorHandleFactoryRegistry,
47                                               const ModelOptions& modelOptions) const override;
48 
49     IBackendInternal::IBackendContextPtr CreateBackendContext(const IRuntime::CreationOptions&) const override;
50     IBackendInternal::IBackendProfilingContextPtr CreateBackendProfilingContext(
51         const IRuntime::CreationOptions&, IBackendProfilingPtr& backendProfiling) override;
52     IBackendInternal::ILayerSupportSharedPtr GetLayerSupport() const override;
53     IBackendInternal::ILayerSupportSharedPtr GetLayerSupport(const ModelOptions& modelOptions) const override;
54 
55     OptimizationViews OptimizeSubgraphView(const SubgraphView& subgraph,
56                                            const ModelOptions& modelOptions) const override;
57 
58     std::vector<ITensorHandleFactory::FactoryId> GetHandleFactoryPreferences() const override;
59 
60     void RegisterTensorHandleFactories(class TensorHandleFactoryRegistry& registry) override;
61 
62     IBackendInternal::IBackendSpecificModelContextPtr CreateBackendSpecificModelContext(
63         const ModelOptions& modelOptions) const override;
64 
GetCapabilities() const65     BackendCapabilities GetCapabilities() const override
66     {
67         return cpuAccCapabilities;
68     };
69 
70     std::unique_ptr<ICustomAllocator> GetDefaultAllocator() const override;
71 };
72 
73 } // namespace armnn
74