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