hddl_plugin_config.hpp
Go to the documentation of this file.
1 // Copyright (C) 2018-2020 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 /**
6  * @brief A header that defines advanced related properties for VPU plugins.
7  * These properties should be used in SetConfig() and LoadNetwork() methods of plugins
8  *
9  * @file
10  */
11 
12 #pragma once
13 
14 #include <string>
15 #include <vector>
16 
17 #include "ie_plugin_config.hpp"
18 #include "ie_api.h"
19 
20 //
21 // Options
22 //
23 
24 /**
25  * @def VPU_HDDL_CONFIG_KEY(name)
26  * @brief Shortcut for defining VPU HDDL configuration key
27  */
28 #define VPU_HDDL_CONFIG_KEY(name) InferenceEngine::VPUConfigParams::_CONFIG_KEY(VPU_HDDL_##name)
29 /**
30  * @def VPU_HDDL_CONFIG_VALUE(name)
31  * @brief Shortcut for defining VPU HDDL configuration value
32  */
33 #define VPU_HDDL_CONFIG_VALUE(name) InferenceEngine::VPUConfigParams::VPU_HDDL_##name
34 
35 #define DECLARE_VPU_HDDL_CONFIG_KEY(name) DECLARE_CONFIG_KEY(VPU_HDDL_##name)
36 #define DECLARE_VPU_HDDL_CONFIG_VALUE(name) DECLARE_CONFIG_VALUE(VPU_HDDL_##name)
37 
38 //
39 // Metrics
40 //
41 
42 /**
43  * @def VPU_HDDL_METRIC(name)
44  * @brief Shortcut for defining VPU HDDL metric
45  */
46 #define VPU_HDDL_METRIC(name) METRIC_KEY(VPU_HDDL_##name)
47 #define DECLARE_VPU_HDDL_METRIC(name, ...) DECLARE_METRIC_KEY(VPU_HDDL_##name, __VA_ARGS__)
48 
49 namespace InferenceEngine {
50 
51 namespace Metrics {
52 
53 /**
54 * @brief Metric to get a int of the device number, String value is METRIC_VPU_HDDL_DEVICE_NUM
55 */
56 DECLARE_VPU_HDDL_METRIC(DEVICE_NUM, int);
57 
58 /**
59 * @brief Metric to get a std::vector<std::string> of device names, String value is METRIC_VPU_HDDL_DEVICE_NAME
60 */
61 DECLARE_VPU_HDDL_METRIC(DEVICE_NAME, std::vector<std::string>);
62 
63 /**
64 * @brief Metric to get a std::vector<float> of device thermal, String value is METRIC_VPU_HDDL_DEVICE_THERMAL
65 */
66 DECLARE_VPU_HDDL_METRIC(DEVICE_THERMAL, std::vector<float>);
67 
68 /**
69 * @brief Metric to get a std::vector<uint32> of device ids, String value is METRIC_VPU_HDDL_DEVICE_ID
70 */
71 DECLARE_VPU_HDDL_METRIC(DEVICE_ID, std::vector<unsigned int>);
72 
73 /**
74 * @brief Metric to get a std::vector<int> of device subclasses, String value is METRIC_VPU_HDDL_DEVICE_SUBCLASS
75 */
76 DECLARE_VPU_HDDL_METRIC(DEVICE_SUBCLASS, std::vector<int>);
77 
78 /**
79 * @brief Metric to get a std::vector<uint32> of device total memory, String value is METRIC_VPU_HDDL_MEMORY_TOTAL
80 */
81 DECLARE_VPU_HDDL_METRIC(DEVICE_MEMORY_TOTAL, std::vector<unsigned int>);
82 
83 /**
84 * @brief Metric to get a std::vector<uint32> of device used memory, String value is METRIC_VPU_HDDL_DEVICE_MEMORY_USED
85 */
86 DECLARE_VPU_HDDL_METRIC(DEVICE_MEMORY_USED, std::vector<unsigned int>);
87 
88 /**
89 * @brief Metric to get a std::vector<float> of device utilization, String value is METRIC_VPU_HDDL_DEVICE_UTILIZATION
90 */
91 DECLARE_VPU_HDDL_METRIC(DEVICE_UTILIZATION, std::vector<float>);
92 
93 /**
94 * @brief Metric to get a std::vector<std::string> of stream ids, String value is METRIC_VPU_HDDL_DEVICE_STREAM_ID
95 */
96 DECLARE_VPU_HDDL_METRIC(STREAM_ID, std::vector<std::string>);
97 
98 /**
99 * @brief Metric to get a std::vector<std::string> of device tags, String value is METRIC_VPU_HDDL_DEVICE_TAG
100 */
101 DECLARE_VPU_HDDL_METRIC(DEVICE_TAG, std::vector<std::string>);
102 
103 /**
104 * @brief Metric to get a std::vector<int> of group ids, String value is METRIC_VPU_HDDL_GROUP_ID
105 */
106 DECLARE_VPU_HDDL_METRIC(GROUP_ID, std::vector<int>);
107 
108 /**
109 * @brief Metric to get a int number of device be using for group, String value is METRIC_VPU_HDDL_DEVICE_GROUP_USING_NUM
110 */
111 DECLARE_VPU_HDDL_METRIC(DEVICE_GROUP_USING_NUM, int);
112 
113 /**
114 * @brief Metric to get a int number of total device, String value is METRIC_VPU_HDDL_DEVICE_TOTAL_NUM
115 */
116 DECLARE_VPU_HDDL_METRIC(DEVICE_TOTAL_NUM, int);
117 
118 } // namespace Metrics
119 
120 namespace VPUConfigParams {
121 
122 /**
123  * @brief [Only for HDDLPlugin]
124  * Type: Arbitrary non-empty string. If empty (""), equals no set, default: "";
125  * This option allows to specify the number of MYX devices used for inference a specific Executable network.
126  * Note: Only one network would be allocated to one device.
127  * The number of devices for the tag is specified in the hddl_service.config file.
128  * Example:
129  * "service_settings":
130  * {
131  * "graph_tag_map":
132  * {
133  * "tagA":3
134  * }
135  * }
136  * It means that an executable network marked with tagA will be executed on 3 devices
137  */
138 DECLARE_VPU_HDDL_CONFIG_KEY(GRAPH_TAG);
139 
140 /**
141  * @brief [Only for HDDLPlugin]
142  * Type: Arbitrary non-empty string. If empty (""), equals no set, default: "";
143  * This config makes the executable networks to be allocated on one certain device (instead of multiple devices).
144  * And all inference through this executable network, will be done on this device.
145  * Note: Only one network would be allocated to one device.
146  * The number of devices which will be used for stream-affinity must be specified in hddl_service.config file.
147  * Example:
148  * "service_settings":
149  * {
150  * "stream_device_number":5
151  * }
152  * It means that 5 device will be used for stream-affinity
153  */
154 DECLARE_VPU_HDDL_CONFIG_KEY(STREAM_ID);
155 
156 /**
157  * @brief [Only for HDDLPlugin]
158  * Type: Arbitrary non-empty string. If empty (""), equals no set, default: "";
159  * This config allows user to control device flexibly. This config gives a "tag" for a certain device while
160  * allocating a network to it. Afterward, user can allocating/deallocating networks to this device with this "tag".
161  * Devices used for such use case is controlled by a so-called "Bypass Scheduler" in HDDL backend, and the number
162  * of such device need to be specified in hddl_service.config file.
163  * Example:
164  * "service_settings":
165  * {
166  * "bypass_device_number": 5
167  * }
168  * It means that 5 device will be used for Bypass scheduler.
169  */
170 DECLARE_VPU_HDDL_CONFIG_KEY(DEVICE_TAG);
171 
172 /**
173  * @brief [Only for HDDLPlugin]
174  * Type: "YES/NO", default is "NO".
175  * This config is a sub-config of DEVICE_TAG, and only available when "DEVICE_TAG" is set. After a user load a
176  * network, the user got a handle for the network.
177  * If "YES", the network allocated is bind to the device (with the specified "DEVICE_TAG"), which means all afterwards
178  * inference through this network handle will be executed on this device only.
179  * If "NO", the network allocated is not bind to the device (with the specified "DEVICE_TAG"). If the same network
180  * is allocated on multiple other devices (also set BIND_DEVICE to "False"), then inference through any handle of these
181  * networks may be executed on any of these devices those have the network loaded.
182  */
183 DECLARE_VPU_HDDL_CONFIG_KEY(BIND_DEVICE);
184 
185 /**
186  * @brief [Only for HDDLPlugin]
187  * Type: A signed int wrapped in a string, default is "0".
188  * This config is a sub-config of DEVICE_TAG, and only available when "DEVICE_TAG" is set and "BIND_DEVICE" is "False".
189  * When there are multiple devices running a certain network (a same network running on multiple devices in Bypass Scheduler),
190  * the device with a larger number has a higher priority, and more inference tasks will be fed to it with priority.
191  */
192 DECLARE_VPU_HDDL_CONFIG_KEY(RUNTIME_PRIORITY);
193 
194 /**
195  * @brief [Only for HDDLPlugin]
196  * Type: "YES/NO", default is "NO".
197  * SGAD is short for "Single Graph All Device". With this scheduler, once application allocates 1 network, all devices
198  * (managed by SGAD scheduler) will be loaded with this graph. The number of network that can be loaded to one device
199  * can exceed one. Once application deallocates 1 network from device, all devices will unload the network from them.
200  */
201 DECLARE_VPU_HDDL_CONFIG_KEY(USE_SGAD);
202 
203 /**
204  * @brief [Only for HDDLPlugin]
205  * Type: A signed int wrapped in a string, default is "0".
206  * This config gives a "group id" for a certain device when this device has been reserved for certain client, client
207  * can use this device grouped by calling this group id while other client can't use this device
208  * Each device has their own group id. Device in one group shares same group id.
209  */
210 DECLARE_VPU_HDDL_CONFIG_KEY(GROUP_DEVICE);
211 
212 } // namespace VPUConfigParams
213 
214 } // namespace InferenceEngine
Inference Engine API.
Definition: ie_argmax_layer.hpp:15
a header for advanced hardware related properties for IE plugins
The macro defines a symbol import/export mechanism essential for Microsoft Windows(R) OS...