blob: d7de161dec4fd58c7af0efcf5109a3f677993da5 [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
6#include "RefBackend.hpp"
David Beck3e9e1152018-10-17 14:17:50 +01007#include "RefBackendId.hpp"
arovir01a0944792018-10-11 15:00:58 +01008#include "RefWorkloadFactory.hpp"
David Beck111b5d92018-11-12 14:59:37 +00009#include "RefLayerSupport.hpp"
arovir01a0944792018-10-11 15:00:58 +010010
David Beck263e3492018-11-09 14:46:40 +000011#include <backendsCommon/IBackendContext.hpp>
Aron Virginas-Tar56055192018-11-12 18:10:43 +000012#include <backendsCommon/IMemoryManager.hpp>
Aron Virginas-Tarc9cc8042018-11-01 16:15:57 +000013#include <backendsCommon/BackendRegistry.hpp>
David Beck111b5d92018-11-12 14:59:37 +000014
David Beck263e3492018-11-09 14:46:40 +000015#include <Optimizer.hpp>
arovir01a0944792018-10-11 15:00:58 +010016
David Beck9efb57d2018-11-05 13:40:33 +000017#include <boost/cast.hpp>
18
arovir014424b0a2018-10-04 10:46:04 +010019namespace armnn
20{
21
David Beck6b779f02018-10-09 17:20:21 +010022namespace
23{
David Beck6b779f02018-10-09 17:20:21 +010024
David Beck111b5d92018-11-12 14:59:37 +000025static BackendRegistry::StaticRegistryInitializer g_RegisterHelper
David Beck3e9e1152018-10-17 14:17:50 +010026{
27 BackendRegistryInstance(),
David Beck3cc9a622018-10-12 10:38:31 +010028 RefBackend::GetIdStatic(),
David Beck9efb57d2018-11-05 13:40:33 +000029 []()
David Beck6b779f02018-10-09 17:20:21 +010030 {
David Beck29c75de2018-10-23 13:35:58 +010031 return IBackendInternalUniquePtr(new RefBackend);
David Beck6b779f02018-10-09 17:20:21 +010032 }
33};
34
35}
arovir014424b0a2018-10-04 10:46:04 +010036
David Beck3cc9a622018-10-12 10:38:31 +010037const BackendId& RefBackend::GetIdStatic()
arovir014424b0a2018-10-04 10:46:04 +010038{
David Beck3e9e1152018-10-17 14:17:50 +010039 static const BackendId s_Id{RefBackendId()};
arovir014424b0a2018-10-04 10:46:04 +010040 return s_Id;
41}
42
Aron Virginas-Tar56055192018-11-12 18:10:43 +000043IBackendInternal::IWorkloadFactoryPtr RefBackend::CreateWorkloadFactory(
44 const IBackendInternal::IMemoryManagerSharedPtr& memoryManager) const
arovir014424b0a2018-10-04 10:46:04 +010045{
arovir01a0944792018-10-11 15:00:58 +010046 return std::make_unique<RefWorkloadFactory>();
arovir014424b0a2018-10-04 10:46:04 +010047}
48
David Beck263e3492018-11-09 14:46:40 +000049IBackendInternal::IBackendContextPtr RefBackend::CreateBackendContext(const IRuntime::CreationOptions&) const
50{
51 return IBackendContextPtr{};
52}
53
Aron Virginas-Tar56055192018-11-12 18:10:43 +000054IBackendInternal::IMemoryManagerUniquePtr RefBackend::CreateMemoryManager() const
55{
56 return IMemoryManagerUniquePtr{};
57}
58
David Beck263e3492018-11-09 14:46:40 +000059IBackendInternal::Optimizations RefBackend::GetOptimizations() const
60{
61 return Optimizations{};
62}
63
David Beck111b5d92018-11-12 14:59:37 +000064IBackendInternal::ILayerSupportSharedPtr RefBackend::GetLayerSupport() const
65{
66 static ILayerSupportSharedPtr layerSupport{new RefLayerSupport};
67 return layerSupport;
68}
69
Derek Lambertiff05cc52019-04-26 13:05:17 +010070IBackendInternal::SubgraphViewUniquePtr RefBackend::OptimizeSubgraphView(const SubgraphView& subgraph,
71 bool& optimizationAttempted) const
Matteo Martincighadddddb2019-01-24 14:06:23 +000072{
73 // Not trying to optimize the given sub-graph
74 optimizationAttempted = false;
75
Derek Lambertiff05cc52019-04-26 13:05:17 +010076 return SubgraphViewUniquePtr{};
Matteo Martincighadddddb2019-01-24 14:06:23 +000077}
78
79} // namespace armnn