ArmNN
 25.11
Loading...
Searching...
No Matches
RefBackend.hpp
Go to the documentation of this file.
1//
2// Copyright © 2022-2024 Arm Ltd and Contributors. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5#pragma once
6
8
9namespace armnn
10{
11// add new capabilities here..
13 {
14 {"NonConstWeights", true},
15 {"ProtectedContentAllocation", false},
16 {"ConstantTensorsAsInputs", true},
17 {"PreImportIOTensors", true},
18 {"ExternallyManagedMemory", true},
19 {"MultiAxisPacking", false},
20 {"SingleAxisPacking", true},
21 {"HasFp16", true},
22 {"AllOrNothing", false}
23 });
24
25const std::set<armnn::BackendCapability> oldCpuRefCapabilities {
27};
28
29
31{
32public:
33 RefBackend() = default;
34 ~RefBackend() = default;
35
36 static const BackendId& GetIdStatic();
37 const BackendId& GetId() const override { return GetIdStatic(); }
38
40
42 const IBackendInternal::IMemoryManagerSharedPtr& memoryManager = nullptr) const override;
43
45 class TensorHandleFactoryRegistry& tensorHandleFactoryRegistry) const override;
46
48
50 const IRuntime::CreationOptions& creationOptions, IBackendProfilingPtr& backendProfiling) override;
51
53
55 const ModelOptions& modelOptions) const override;
56
57 std::vector<ITensorHandleFactory::FactoryId> GetHandleFactoryPreferences() const override;
58
60
62 {
63 return cpuRefCapabilities;
64 };
65
66 std::unique_ptr<ICustomAllocator> GetDefaultAllocator() const override;
67};
68
69} // namespace armnn
std::shared_ptr< ILayerSupport > ILayerSupportSharedPtr
std::unique_ptr< IMemoryManager > IMemoryManagerUniquePtr
std::unique_ptr< arm::pipe::IBackendProfiling > IBackendProfilingPtr
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()
const BackendId & GetId() const override
OptimizationViews OptimizeSubgraphView(const SubgraphView &subgraph, const ModelOptions &modelOptions) const override
RefBackend()=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::IBackendContextPtr CreateBackendContext(const IRuntime::CreationOptions &) const override
Create the runtime context of the backend.
IBackendInternal::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...
IBackendInternal::IBackendProfilingContextPtr CreateBackendProfilingContext(const IRuntime::CreationOptions &creationOptions, IBackendProfilingPtr &backendProfiling) override
Create context specifically used for profiling interaction from backends.
~RefBackend()=default
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 cpuRefCapabilities("CpuRef", { {"NonConstWeights", true}, {"ProtectedContentAllocation", false}, {"ConstantTensorsAsInputs", true}, {"PreImportIOTensors", true}, {"ExternallyManagedMemory", true}, {"MultiAxisPacking", false}, {"SingleAxisPacking", true}, {"HasFp16", true}, {"AllOrNothing", false} })
BackendOptions BackendCapabilities
@ NonConstWeights
Constant weights can be accessed through the descriptors, On the other hand, non-const weights can be...
Definition Types.hpp:291
const std::set< armnn::BackendCapability > oldCpuRefCapabilities