gna_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 GNA plugin.
7  * These properties should be used in SetConfig() and LoadNetwork() methods of plugins
8  *
9  * @file gna_config.hpp
10  */
11 
12 #pragma once
13 
14 #include <string>
15 #include "ie_plugin_config.hpp"
16 
17 #ifdef GNA_LIB_VER
18 #if GNA_LIB_VER == 2
19 #define DISABLE_TEST_ON_GNA2 GTEST_SKIP();
20 #else
21 #define DISABLE_TEST_ON_GNA2
22 #endif
23 #endif
24 
25 namespace InferenceEngine {
26 
27 /**
28  * @brief GNA plugin configuration
29  */
30 namespace GNAConfigParams {
31 
32 /**
33  * @def GNA_CONFIG_KEY(name)
34  * @brief Shortcut for defining configuration keys
35  */
36 #define GNA_CONFIG_KEY(name) InferenceEngine::GNAConfigParams::_CONFIG_KEY(GNA_##name)
37 /**
38  * @def GNA_CONFIG_VALUE(name)
39  * @brief Shortcut for defining configuration values
40  */
41 #define GNA_CONFIG_VALUE(name) InferenceEngine::GNAConfigParams::GNA_##name
42 
43 #define DECLARE_GNA_CONFIG_KEY(name) DECLARE_CONFIG_KEY(GNA_##name)
44 #define DECLARE_GNA_CONFIG_VALUE(name) DECLARE_CONFIG_VALUE(GNA_##name)
45 
46 /**
47 * @brief Scale factor that is calculated by user, in order to use static quantisation feature
48 * This option should be used with floating point value serialized to string with decimal separator equals to . (dot)
49 * @details For multiple input case, individual scale factors can be passed, using KEY_GNA_SCALE_FACTOR[_input_layer_name]
50 * where input_layer can be obtained from from CNNNetwork::GetInputsInfo
51 */
52 DECLARE_GNA_CONFIG_KEY(SCALE_FACTOR);
53 
54 /**
55 * @brief By default gna api work in Int16 precision, however this can be adjusted if necessary,
56 * currently supported values are I16, I8
57 */
58 DECLARE_GNA_CONFIG_KEY(PRECISION);
59 
60 
61 /**
62 * @brief if turned on, dump GNA firmware model into specified file
63 */
64 DECLARE_GNA_CONFIG_KEY(FIRMWARE_MODEL_IMAGE);
65 
66 /**
67 * @brief inforamtion on GNA generation chosen for firmware model dump, can be overriden by GNA3
68 */
69 DECLARE_GNA_CONFIG_KEY(FIRMWARE_MODEL_IMAGE_GENERATION);
70 
71 /**
72 * @brief GNA proc_type setting that should be one of GNA_AUTO, GNA_HW, GNA_SW, GNA_SW_EXACT
73 */
74 DECLARE_GNA_CONFIG_KEY(DEVICE_MODE);
75 
76 DECLARE_GNA_CONFIG_VALUE(AUTO);
77 DECLARE_GNA_CONFIG_VALUE(HW);
78 DECLARE_GNA_CONFIG_VALUE(SW);
79 DECLARE_GNA_CONFIG_VALUE(SW_EXACT);
80 DECLARE_GNA_CONFIG_VALUE(SW_FP32);
81 DECLARE_GNA_CONFIG_VALUE(GEN);
82 DECLARE_GNA_CONFIG_VALUE(GEN_EXACT);
83 DECLARE_GNA_CONFIG_VALUE(SSE);
84 DECLARE_GNA_CONFIG_VALUE(SSE_EXACT);
85 DECLARE_GNA_CONFIG_VALUE(AVX1);
86 DECLARE_GNA_CONFIG_VALUE(AVX1_EXACT);
87 DECLARE_GNA_CONFIG_VALUE(AVX2);
88 DECLARE_GNA_CONFIG_VALUE(AVX2_EXACT);
89 
90 /**
91 * @brief if enabled produced minimum memory footprint for loaded network in GNA memory, default value is YES
92 */
93 DECLARE_GNA_CONFIG_KEY(COMPACT_MODE);
94 
95 /**
96 * @brief The option to enable/disable uniformly distributed PWL algorithm.
97 * By default (in case of NO value set) the optimized algorithm called "Recursive Descent Algorithm for Finding
98 * the Optimal Minimax Piecewise Linear Approximation of Convex Functions is used.
99 * If value is YES then simple uniform distribution used to create PWL approximation of activation functions
100 * Uniform distribution usually gives poor approximation with same number of segments
101 */
102 DECLARE_GNA_CONFIG_KEY(PWL_UNIFORM_DESIGN);
103 
104 /**
105 * @brief By default, the GNA plugin uses one worker thread for inference computations.
106 * This parameter allows you to create up to 127 threads for software modes.
107 *
108 * Note that multithreading mode does not guarantee the same computation order as order
109 * of issuing. Additionally, in this case, software modes do not implement any serializations.
110 */
111 DECLARE_GNA_CONFIG_KEY(LIB_N_THREADS);
112 } // namespace GNAConfigParams
113 } // namespace InferenceEngine
Inference Engine API.
Definition: ie_argmax_layer.hpp:15
a header for advanced hardware related properties for IE plugins
HW 2D layout.
Definition: ie_common.h:104