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 | |||||
6 | #include "ClBackend.hpp" | ||||
David Beck | 3e9e115 | 2018-10-17 14:17:50 +0100 | [diff] [blame] | 7 | #include "ClBackendId.hpp" |
arovir01 | a094479 | 2018-10-11 15:00:58 +0100 | [diff] [blame] | 8 | #include "ClWorkloadFactory.hpp" |
David Beck | 1b61be5 | 2018-11-08 09:19:14 +0000 | [diff] [blame] | 9 | #include "ClBackendContext.hpp" |
David Beck | 111b5d9 | 2018-11-12 14:59:37 +0000 | [diff] [blame^] | 10 | #include "ClLayerSupport.hpp" |
arovir01 | a094479 | 2018-10-11 15:00:58 +0100 | [diff] [blame] | 11 | |
David Beck | 263e349 | 2018-11-09 14:46:40 +0000 | [diff] [blame] | 12 | #include <backendsCommon/IBackendContext.hpp> |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 13 | #include <backendsCommon/BackendRegistry.hpp> |
David Beck | 263e349 | 2018-11-09 14:46:40 +0000 | [diff] [blame] | 14 | #include <Optimizer.hpp> |
arovir01 | 4424b0a | 2018-10-04 10:46:04 +0100 | [diff] [blame] | 15 | |
16 | namespace armnn | ||||
17 | { | ||||
18 | |||||
David Beck | 6b779f0 | 2018-10-09 17:20:21 +0100 | [diff] [blame] | 19 | namespace |
20 | { | ||||
David Beck | 6b779f0 | 2018-10-09 17:20:21 +0100 | [diff] [blame] | 21 | |
David Beck | 111b5d9 | 2018-11-12 14:59:37 +0000 | [diff] [blame^] | 22 | static BackendRegistry::StaticRegistryInitializer g_RegisterHelper |
David Beck | 3e9e115 | 2018-10-17 14:17:50 +0100 | [diff] [blame] | 23 | { |
24 | BackendRegistryInstance(), | ||||
David Beck | 3cc9a62 | 2018-10-12 10:38:31 +0100 | [diff] [blame] | 25 | ClBackend::GetIdStatic(), |
David Beck | 9efb57d | 2018-11-05 13:40:33 +0000 | [diff] [blame] | 26 | []() |
David Beck | 6b779f0 | 2018-10-09 17:20:21 +0100 | [diff] [blame] | 27 | { |
David Beck | 29c75de | 2018-10-23 13:35:58 +0100 | [diff] [blame] | 28 | return IBackendInternalUniquePtr(new ClBackend); |
David Beck | 6b779f0 | 2018-10-09 17:20:21 +0100 | [diff] [blame] | 29 | } |
30 | }; | ||||
31 | |||||
David Beck | 9efb57d | 2018-11-05 13:40:33 +0000 | [diff] [blame] | 32 | } |
arovir01 | 4424b0a | 2018-10-04 10:46:04 +0100 | [diff] [blame] | 33 | |
David Beck | 3cc9a62 | 2018-10-12 10:38:31 +0100 | [diff] [blame] | 34 | const BackendId& ClBackend::GetIdStatic() |
arovir01 | 4424b0a | 2018-10-04 10:46:04 +0100 | [diff] [blame] | 35 | { |
David Beck | 3e9e115 | 2018-10-17 14:17:50 +0100 | [diff] [blame] | 36 | static const BackendId s_Id{ClBackendId()}; |
arovir01 | 4424b0a | 2018-10-04 10:46:04 +0100 | [diff] [blame] | 37 | return s_Id; |
38 | } | ||||
39 | |||||
David Beck | 29c75de | 2018-10-23 13:35:58 +0100 | [diff] [blame] | 40 | IBackendInternal::IWorkloadFactoryPtr ClBackend::CreateWorkloadFactory() const |
arovir01 | 4424b0a | 2018-10-04 10:46:04 +0100 | [diff] [blame] | 41 | { |
arovir01 | a094479 | 2018-10-11 15:00:58 +0100 | [diff] [blame] | 42 | return std::make_unique<ClWorkloadFactory>(); |
arovir01 | 4424b0a | 2018-10-04 10:46:04 +0100 | [diff] [blame] | 43 | } |
44 | |||||
David Beck | 1b61be5 | 2018-11-08 09:19:14 +0000 | [diff] [blame] | 45 | IBackendInternal::IBackendContextPtr |
46 | ClBackend::CreateBackendContext(const IRuntime::CreationOptions& options) const | ||||
47 | { | ||||
48 | return IBackendContextPtr{new ClBackendContext{options}}; | ||||
49 | } | ||||
50 | |||||
David Beck | 263e349 | 2018-11-09 14:46:40 +0000 | [diff] [blame] | 51 | IBackendInternal::Optimizations ClBackend::GetOptimizations() const |
52 | { | ||||
53 | return Optimizations{}; | ||||
54 | } | ||||
David Beck | 1b61be5 | 2018-11-08 09:19:14 +0000 | [diff] [blame] | 55 | |
David Beck | 111b5d9 | 2018-11-12 14:59:37 +0000 | [diff] [blame^] | 56 | IBackendInternal::ILayerSupportSharedPtr ClBackend::GetLayerSupport() const |
57 | { | ||||
58 | static ILayerSupportSharedPtr layerSupport{new ClLayerSupport}; | ||||
59 | return layerSupport; | ||||
60 | } | ||||
61 | |||||
David Beck | 9efb57d | 2018-11-05 13:40:33 +0000 | [diff] [blame] | 62 | } // namespace armnn |