arovir01 | 4424b0a | 2018-10-04 10:46:04 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | #pragma once |
| 6 | |
Matteo Martincigh | e5b8eb9 | 2019-11-28 15:45:42 +0000 | [diff] [blame] | 7 | #include <armnn/backends/IBackendInternal.hpp> |
arovir01 | 4424b0a | 2018-10-04 10:46:04 +0100 | [diff] [blame] | 8 | |
| 9 | namespace armnn |
| 10 | { |
Finn Williams | b9af86e | 2021-05-26 18:38:12 +0100 | [diff] [blame] | 11 | // add new capabilities here.. |
| 12 | const BackendCapabilities cpuRefCapabilities("CpuRef", |
| 13 | { |
| 14 | {"NonConstWeights", true}, |
Matthew Sloyan | 81beae3 | 2021-07-13 19:46:11 +0100 | [diff] [blame] | 15 | {"AsyncExecution", true}, |
| 16 | {"ConstantTensorsAsInputs", true} |
Finn Williams | b9af86e | 2021-05-26 18:38:12 +0100 | [diff] [blame] | 17 | }); |
arovir01 | 4424b0a | 2018-10-04 10:46:04 +0100 | [diff] [blame] | 18 | |
Finn Williams | b9af86e | 2021-05-26 18:38:12 +0100 | [diff] [blame] | 19 | const std::set<armnn::BackendCapability> oldCpuRefCapabilities { |
| 20 | armnn::BackendCapability::NonConstWeights, |
Sadik Armagan | f0a6dec | 2021-03-25 07:46:55 +0000 | [diff] [blame] | 21 | }; |
| 22 | |
Finn Williams | b9af86e | 2021-05-26 18:38:12 +0100 | [diff] [blame] | 23 | |
arovir01 | 4424b0a | 2018-10-04 10:46:04 +0100 | [diff] [blame] | 24 | class RefBackend : public IBackendInternal |
| 25 | { |
| 26 | public: |
David Beck | 9efb57d | 2018-11-05 13:40:33 +0000 | [diff] [blame] | 27 | RefBackend() = default; |
| 28 | ~RefBackend() = default; |
arovir01 | 4424b0a | 2018-10-04 10:46:04 +0100 | [diff] [blame] | 29 | |
David Beck | 3cc9a62 | 2018-10-12 10:38:31 +0100 | [diff] [blame] | 30 | static const BackendId& GetIdStatic(); |
| 31 | const BackendId& GetId() const override { return GetIdStatic(); } |
arovir01 | 4424b0a | 2018-10-04 10:46:04 +0100 | [diff] [blame] | 32 | |
Aron Virginas-Tar | 5605519 | 2018-11-12 18:10:43 +0000 | [diff] [blame] | 33 | IBackendInternal::IMemoryManagerUniquePtr CreateMemoryManager() const override; |
| 34 | |
| 35 | IBackendInternal::IWorkloadFactoryPtr CreateWorkloadFactory( |
| 36 | const IBackendInternal::IMemoryManagerSharedPtr& memoryManager = nullptr) const override; |
| 37 | |
Ferran Balaguer | bfeb271 | 2019-08-07 15:14:56 +0100 | [diff] [blame] | 38 | IBackendInternal::IWorkloadFactoryPtr CreateWorkloadFactory( |
| 39 | class TensorHandleFactoryRegistry& tensorHandleFactoryRegistry) const override; |
| 40 | |
David Beck | 263e349 | 2018-11-09 14:46:40 +0000 | [diff] [blame] | 41 | IBackendInternal::IBackendContextPtr CreateBackendContext(const IRuntime::CreationOptions&) const override; |
Aron Virginas-Tar | 5605519 | 2018-11-12 18:10:43 +0000 | [diff] [blame] | 42 | |
Colm Donelan | e49755b | 2020-01-29 15:22:43 +0000 | [diff] [blame] | 43 | IBackendInternal::IBackendProfilingContextPtr CreateBackendProfilingContext( |
Colm Donelan | 1aff393 | 2020-02-05 17:48:59 +0000 | [diff] [blame] | 44 | const IRuntime::CreationOptions& creationOptions, IBackendProfilingPtr& backendProfiling) override; |
Colm Donelan | e49755b | 2020-01-29 15:22:43 +0000 | [diff] [blame] | 45 | |
David Beck | 263e349 | 2018-11-09 14:46:40 +0000 | [diff] [blame] | 46 | IBackendInternal::Optimizations GetOptimizations() const override; |
David Beck | 111b5d9 | 2018-11-12 14:59:37 +0000 | [diff] [blame] | 47 | IBackendInternal::ILayerSupportSharedPtr GetLayerSupport() const override; |
Matteo Martincigh | adddddb | 2019-01-24 14:06:23 +0000 | [diff] [blame] | 48 | |
Matteo Martincigh | c3ba50e | 2019-05-22 14:28:16 +0100 | [diff] [blame] | 49 | OptimizationViews OptimizeSubgraphView(const SubgraphView& subgraph) const override; |
Ferran Balaguer | bfeb271 | 2019-08-07 15:14:56 +0100 | [diff] [blame] | 50 | |
| 51 | std::vector<ITensorHandleFactory::FactoryId> GetHandleFactoryPreferences() const override; |
| 52 | |
| 53 | void RegisterTensorHandleFactories(class TensorHandleFactoryRegistry& registry) override; |
Sadik Armagan | f0a6dec | 2021-03-25 07:46:55 +0000 | [diff] [blame] | 54 | |
Finn Williams | b9af86e | 2021-05-26 18:38:12 +0100 | [diff] [blame] | 55 | BackendCapabilities GetCapabilities() const override |
| 56 | { |
| 57 | return cpuRefCapabilities; |
| 58 | }; |
| 59 | |
Sadik Armagan | f0a6dec | 2021-03-25 07:46:55 +0000 | [diff] [blame] | 60 | bool HasCapability(BackendCapability capabilityClass) const override; |
arovir01 | 4424b0a | 2018-10-04 10:46:04 +0100 | [diff] [blame] | 61 | }; |
| 62 | |
Matteo Martincigh | adddddb | 2019-01-24 14:06:23 +0000 | [diff] [blame] | 63 | } // namespace armnn |