blob: 1a79d7090aede13db994f3ea12d295691cd77800 [file] [log] [blame]
arovir014424b0a2018-10-04 10:46:04 +01001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5#pragma once
6
Matteo Martincighe5b8eb92019-11-28 15:45:42 +00007#include <armnn/backends/IBackendInternal.hpp>
arovir014424b0a2018-10-04 10:46:04 +01008
9namespace armnn
10{
Finn Williamsb9af86e2021-05-26 18:38:12 +010011// add new capabilities here..
12const BackendCapabilities cpuRefCapabilities("CpuRef",
13 {
14 {"NonConstWeights", true},
Matthew Sloyan81beae32021-07-13 19:46:11 +010015 {"AsyncExecution", true},
Finn Williamsdbf5f312021-08-26 11:08:01 +010016 {"ProtectedContentAllocation", false},
17 {"ConstantTensorsAsInputs", true},
18 {"PreImportIOTensors", false}
Finn Williamsb9af86e2021-05-26 18:38:12 +010019 });
arovir014424b0a2018-10-04 10:46:04 +010020
Finn Williamsb9af86e2021-05-26 18:38:12 +010021const std::set<armnn::BackendCapability> oldCpuRefCapabilities {
22 armnn::BackendCapability::NonConstWeights,
Sadik Armaganf0a6dec2021-03-25 07:46:55 +000023};
24
Finn Williamsb9af86e2021-05-26 18:38:12 +010025
arovir014424b0a2018-10-04 10:46:04 +010026class RefBackend : public IBackendInternal
27{
28public:
David Beck9efb57d2018-11-05 13:40:33 +000029 RefBackend() = default;
30 ~RefBackend() = default;
arovir014424b0a2018-10-04 10:46:04 +010031
David Beck3cc9a622018-10-12 10:38:31 +010032 static const BackendId& GetIdStatic();
33 const BackendId& GetId() const override { return GetIdStatic(); }
arovir014424b0a2018-10-04 10:46:04 +010034
Aron Virginas-Tar56055192018-11-12 18:10:43 +000035 IBackendInternal::IMemoryManagerUniquePtr CreateMemoryManager() const override;
36
37 IBackendInternal::IWorkloadFactoryPtr CreateWorkloadFactory(
38 const IBackendInternal::IMemoryManagerSharedPtr& memoryManager = nullptr) const override;
39
Ferran Balaguerbfeb2712019-08-07 15:14:56 +010040 IBackendInternal::IWorkloadFactoryPtr CreateWorkloadFactory(
41 class TensorHandleFactoryRegistry& tensorHandleFactoryRegistry) const override;
42
David Beck263e3492018-11-09 14:46:40 +000043 IBackendInternal::IBackendContextPtr CreateBackendContext(const IRuntime::CreationOptions&) const override;
Aron Virginas-Tar56055192018-11-12 18:10:43 +000044
Colm Donelane49755b2020-01-29 15:22:43 +000045 IBackendInternal::IBackendProfilingContextPtr CreateBackendProfilingContext(
Colm Donelan1aff3932020-02-05 17:48:59 +000046 const IRuntime::CreationOptions& creationOptions, IBackendProfilingPtr& backendProfiling) override;
Colm Donelane49755b2020-01-29 15:22:43 +000047
David Beck263e3492018-11-09 14:46:40 +000048 IBackendInternal::Optimizations GetOptimizations() const override;
David Beck111b5d92018-11-12 14:59:37 +000049 IBackendInternal::ILayerSupportSharedPtr GetLayerSupport() const override;
Matteo Martincighadddddb2019-01-24 14:06:23 +000050
Matteo Martincighc3ba50e2019-05-22 14:28:16 +010051 OptimizationViews OptimizeSubgraphView(const SubgraphView& subgraph) const override;
Ferran Balaguerbfeb2712019-08-07 15:14:56 +010052
53 std::vector<ITensorHandleFactory::FactoryId> GetHandleFactoryPreferences() const override;
54
55 void RegisterTensorHandleFactories(class TensorHandleFactoryRegistry& registry) override;
Sadik Armaganf0a6dec2021-03-25 07:46:55 +000056
Finn Williamsb9af86e2021-05-26 18:38:12 +010057 BackendCapabilities GetCapabilities() const override
58 {
59 return cpuRefCapabilities;
60 };
61
Sadik Armaganf0a6dec2021-03-25 07:46:55 +000062 bool HasCapability(BackendCapability capabilityClass) const override;
arovir014424b0a2018-10-04 10:46:04 +010063};
64
Matteo Martincighadddddb2019-01-24 14:06:23 +000065} // namespace armnn