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