• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
7 #include <armnn/Types.hpp>
8 #include <set>
9 #include <vector>
10 
11 namespace armnn
12 {
13 
14 class DeviceSpec : public IDeviceSpec
15 {
16 public:
DeviceSpec()17     DeviceSpec()
18     {}
19 
DeviceSpec(const BackendIdSet & supportedBackends)20     DeviceSpec(const BackendIdSet& supportedBackends)
21         : m_SupportedBackends{supportedBackends} {}
22 
~DeviceSpec()23     virtual ~DeviceSpec() {}
24 
GetSupportedBackends() const25     virtual const BackendIdSet& GetSupportedBackends() const override
26     {
27         return m_SupportedBackends;
28     }
29 
AddSupportedBackends(const BackendIdSet & backendIds,bool isDynamic=false)30     void AddSupportedBackends(const BackendIdSet& backendIds, bool isDynamic = false)
31     {
32         m_SupportedBackends.insert(backendIds.begin(), backendIds.end());
33         if (isDynamic)
34         {
35             m_DynamicBackends.insert(backendIds.begin(), backendIds.end());
36         }
37     }
38 
ClearDynamicBackends()39     void ClearDynamicBackends()
40     {
41         for (const auto& id : m_DynamicBackends)
42         {
43             m_SupportedBackends.erase(id);
44         }
45         m_DynamicBackends.clear();
46     }
47 
GetDynamicBackends() const48     const BackendIdSet& GetDynamicBackends() const
49     {
50         return m_DynamicBackends;
51     }
52 
53 private:
54     BackendIdSet m_SupportedBackends;
55     BackendIdSet m_DynamicBackends;
56 };
57 
58 } // namespace armnn
59