hddl_plugin_config.hpp
1 // Copyright (C) 2018-2019 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 vpu_plugin_config.hpp
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 #define VPU_HDDL_CONFIG_KEY(name) InferenceEngine::VPUConfigParams::_CONFIG_KEY(VPU_HDDL_##name)
25 #define VPU_HDDL_CONFIG_VALUE(name) InferenceEngine::VPUConfigParams::VPU_HDDL_##name
26 
27 #define DECLARE_VPU_HDDL_CONFIG_KEY(name) DECLARE_CONFIG_KEY(VPU_HDDL_##name)
28 #define DECLARE_VPU_HDDL_CONFIG_VALUE(name) DECLARE_CONFIG_VALUE(VPU_HDDL_##name)
29 
30 //
31 // Metrics
32 //
33 
34 #define VPU_HDDL_METRIC(name) METRIC_KEY(VPU_HDDL_##name)
35 #define DECLARE_VPU_HDDL_METRIC(name, ...) DECLARE_METRIC_KEY(VPU_HDDL_##name, __VA_ARGS__)
36 
37 namespace InferenceEngine {
38 
39 namespace Metrics {
40 
41 /**
42 * @brief Metric to get a int of the device number, String value is METRIC_VPU_HDDL_DEVICE_NUM
43 */
44 DECLARE_VPU_HDDL_METRIC(DEVICE_NUM, int);
45 
46 /**
47 * @brief Metric to get a std::vector<std::string> of device names, String value is METRIC_VPU_HDDL_DEVICE_NAME
48 */
49 DECLARE_VPU_HDDL_METRIC(DEVICE_NAME, std::vector<std::string>);
50 
51 /**
52 * @brief Metric to get a std::vector<std::string> of device models, String value is METRIC_VPU_HDDL_DEVICE_MODEL
53 */
54 DECLARE_VPU_HDDL_METRIC(DEVICE_MODEL, std::vector<std::string>);
55 
56 /**
57 * @brief Metric to get a std::vector<float> of device thermal, String value is METRIC_VPU_HDDL_DEVICE_THERMAL
58 */
59 DECLARE_VPU_HDDL_METRIC(DEVICE_THERMAL, std::vector<float>);
60 
61 /**
62 * @brief Metric to get a std::vector<uint32> of device ids, String value is METRIC_VPU_HDDL_DEVICE_ID
63 */
64 DECLARE_VPU_HDDL_METRIC(DEVICE_ID, std::vector<unsigned int>);
65 
66 /**
67 * @brief Metric to get a std::vector<int> of device subclasses, String value is METRIC_VPU_HDDL_DEVICE_SUBCLASS
68 */
69 DECLARE_VPU_HDDL_METRIC(DEVICE_SUBCLASS, std::vector<int>);
70 
71 /**
72 * @brief Metric to get a std::vector<uint32> of device total memory, String value is METRIC_VPU_HDDL_MEMORY_TOTAL
73 */
74 DECLARE_VPU_HDDL_METRIC(DEVICE_MEMORY_TOTAL, std::vector<unsigned int>);
75 
76 /**
77 * @brief Metric to get a std::vector<uint32> of device used memory, String value is METRIC_VPU_HDDL_DEVICE_MEMORY_USED
78 */
79 DECLARE_VPU_HDDL_METRIC(DEVICE_MEMORY_USED, std::vector<unsigned int>);
80 
81 /**
82 * @brief Metric to get a std::vector<float> of device utilization, String value is METRIC_VPU_HDDL_DEVICE_UTILIZATION
83 */
84 DECLARE_VPU_HDDL_METRIC(DEVICE_UTILIZATION, std::vector<float>);
85 
86 /**
87 * @brief Metric to get a std::vector<std::string> of stream ids, String value is METRIC_VPU_HDDL_DEVICE_STREAM_ID
88 */
89 DECLARE_VPU_HDDL_METRIC(STREAM_ID, std::vector<std::string>);
90 
91 
92 /**
93 * @brief Metric to get a std::vector<std::string> of device tags, String value is METRIC_VPU_HDDL_DEVICE_TAG
94 */
95 DECLARE_VPU_HDDL_METRIC(DEVICE_TAG, std::vector<std::string>);
96 
97 } // namespace Metrics
98 
99 namespace VPUConfigParams {
100 
101 /**
102  * @brief [Only for HDDLPlugin]
103  * Type: Arbitrary non-empty string. If empty (""), equals no set, default: "";
104  * This option allows to specify the number of MYX devices used for inference a specific Executable network.
105  * Note: Only one network would be allocated to one device.
106  * The number of devices for the tag is specified in the hddl_service.config file.
107  * Example:
108  * "service_settings":
109  * {
110  * "graph_tag_map":
111  * {
112  * "tagA":3
113  * }
114  * }
115  * It means that an executable network marked with tagA will be executed on 3 devices
116  */
117 DECLARE_VPU_HDDL_CONFIG_KEY(GRAPH_TAG);
118 
119 /**
120  * @brief [Only for HDDLPlugin]
121  * Type: Arbitrary non-empty string. If empty (""), equals no set, default: "";
122  * This config makes the executable networks to be allocated on one certain device (instead of multiple devices).
123  * And all inference through this executable network, will be done on this device.
124  * Note: Only one network would be allocated to one device.
125  * The number of devices which will be used for stream-affinity must be specified in hddl_service.config file.
126  * Example:
127  * "service_settings":
128  * {
129  * "stream_device_number":5
130  * }
131  * It means that 5 device will be used for stream-affinity
132  */
133 DECLARE_VPU_HDDL_CONFIG_KEY(STREAM_ID);
134 
135 /**
136  * @brief [Only for HDDLPlugin]
137  * Type: Arbitrary non-empty string. If empty (""), equals no set, default: "";
138  * This config allows user to control device flexibly. This config gives a "tag" for a certain device while
139  * allocating a network to it. Afterward, user can allocating/deallocating networks to this device with this "tag".
140  * Devices used for such use case is controlled by a so-called "Bypass Scheduler" in HDDL backend, and the number
141  * of such device need to be specified in hddl_service.config file.
142  * Example:
143  * "service_settings":
144  * {
145  * "bypass_device_number": 5
146  * }
147  * It means that 5 device will be used for Bypass scheduler.
148  */
149 DECLARE_VPU_HDDL_CONFIG_KEY(DEVICE_TAG);
150 
151 /**
152  * @brief [Only for HDDLPlugin]
153  * Type: "YES/NO", default is "NO".
154  * This config is a sub-config of DEVICE_TAG, and only available when "DEVICE_TAG" is set. After a user load a
155  * network, the user got a handle for the network.
156  * If "YES", the network allocated is bind to the device (with the specified "DEVICE_TAG"), which means all afterwards
157  * inference through this network handle will be executed on this device only.
158  * If "NO", the network allocated is not bind to the device (with the specified "DEVICE_TAG"). If the same network
159  * is allocated on multiple other devices (also set BIND_DEVICE to "False"), then inference through any handle of these
160  * networks may be executed on any of these devices those have the network loaded.
161  */
162 DECLARE_VPU_HDDL_CONFIG_KEY(BIND_DEVICE);
163 
164 /**
165  * @brief [Only for HDDLPlugin]
166  * Type: A signed int wrapped in a string, default is "0".
167  * This config is a sub-config of DEVICE_TAG, and only available when "DEVICE_TAG" is set and "BIND_DEVICE" is "False".
168  * When there are multiple devices running a certain network (a same network running on multiple devices in Bypass Scheduler),
169  * the device with a larger number has a higher priority, and more inference tasks will be fed to it with priority.
170  */
171 DECLARE_VPU_HDDL_CONFIG_KEY(RUNTIME_PRIORITY);
172 
173 } // namespace VPUConfigParams
174 
175 } // namespace InferenceEngine
Definition: ie_argmax_layer.hpp:11
a header for advanced hardware related properties for clDNN plugin To use in SetConfig() method of pl...
The macro defines a symbol import/export mechanism essential for Microsoft Windows(R) OS...