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