MMALIB User Guide
c7120/MMALIB_types.h
Go to the documentation of this file.
1 /******************************************************************************
2  * *
3  * module name :MMALIB *
4  * *
5  * module descripton :Matrix Multiply Accelerator Library module for C7x+MMA *
6  * *
7  * Copyright (C) 2017-2018 Texas Instruments Incorporated - https://www.ti.com/ *
8  * ALL RIGHTS RESERVED *
9  * *
10  ******************************************************************************/
11 
23 #ifndef C7120_MMALIB_TYPES_H_
24 #define C7120_MMALIB_TYPES_H_ 1
25 
26 #include <c7x.h> // for streaming engine, streaming address gen.
27 
31 
32 
33 
34 #ifdef __cplusplus
35 #include <c7x_scalable.h> // for device scalability
36 
37 /******************************************************************************
38  *
39  * PREDEFINED VECTORS
40  *
41  ******************************************************************************/
42 
43 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_scale_No_1;
44 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_scale_No_2;
45 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_scale_No_3;
46 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_scale_No_4;
47 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_scale_No_5;
48 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_scale_No_6;
49 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_scale_No_7;
50 
51 // permutation register values for 32-bit bias
52 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_biasVec0_32bit_No_1;
53 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_biasVec1_32bit_No_1;
54 
55 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_biasVec0_32bit_No_2;
56 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_biasVec1_32bit_No_2;
57 
58 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_biasVec0_32bit_No_3;
59 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_biasVec1_32bit_No_3;
60 
61 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_biasVec0_32bit_No_4;
62 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_biasVec1_32bit_No_4;
63 
64 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_biasVec0_32bit_No_5;
65 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_biasVec1_32bit_No_5;
66 
67 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_biasVec0_32bit_No_6;
68 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_biasVec1_32bit_No_6;
69 
70 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_biasVec0_32bit_No_7;
71 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_biasVec1_32bit_No_7;
72 
73 // permutation register values for 64-bit bias
74 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_biasVec0_64bit_No_1;
75 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_biasVec1_64bit_No_1;
76 
77 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_biasVec0_64bit_No_2;
78 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_biasVec1_64bit_No_2;
79 
80 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_biasVec0_64bit_No_3;
81 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_biasVec1_64bit_No_3;
82 
83 // split groups
84 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_scale_No_1;
85 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_scale_No_2;
86 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_scale_No_3;
87 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_scale_No_4;
88 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_scale_No_5;
89 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_scale_No_6;
90 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_scale_No_7;
91 
92 // permutation register values for 32-bit bias, split groups
93 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_biasVec0_32bit_No_1;
94 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_biasVec1_32bit_No_1;
95 
96 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_biasVec0_32bit_No_2;
97 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_biasVec1_32bit_No_2;
98 
99 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_biasVec0_32bit_No_3;
100 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_biasVec1_32bit_No_3;
101 
102 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_biasVec0_32bit_No_4;
103 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_biasVec1_32bit_No_4;
104 
105 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_biasVec0_32bit_No_5;
106 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_biasVec1_32bit_No_5;
107 
108 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_biasVec0_32bit_No_6;
109 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_biasVec1_32bit_No_6;
110 
111 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_biasVec0_32bit_No_7;
112 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_biasVec1_32bit_No_7;
113 
114 // permutation register values for 64-bit bias, split groups
115 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_biasVec0_64bit_No_1;
116 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_biasVec1_64bit_No_1;
117 
118 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_biasVec0_64bit_No_2;
119 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_biasVec1_64bit_No_2;
120 
121 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_biasVec0_64bit_No_3;
122 extern const c7x::uchar_vec MMALIB_vperm_convolve_col_splitGroups_biasVec1_64bit_No_3;
123 
124 extern "C" {
125 #endif /* __cplusplus */
126 
136 /*******************************************************************************
137  *
138  * TYPEDEFS
139  *
140  ******************************************************************************/
141 
143 typedef enum {
149 } MMALIB_activation_type_e; // formerly eMMAActivationType;
151 
153  typedef enum {
157 
159  typedef enum {
163 
166 
168  typedef enum {
173  /*******************************************************************************
174  *
175  * DEFINES
176  *
177  ******************************************************************************/
178 
179 #define MMALIB_ILUT_SUPPORT 0 // !< No ILUT on this device
180 #define MMALIB_ILUT_NUM_BYTES 0 // !< No ILUT on this device
181 
182 
183  /* ---------------------------------------------------------------- */
184  /* MISRAC Rule 4.9(DEFINE.FUNC) Deviation: The advisory is not */
185  /* being addressed */
186  /* ---------------------------------------------------------------- */
189  #define MMALIB_CALC_STRIDE(BYTES, ALIGN_SHIFT) \
190  (((((BYTES)-1) >> (ALIGN_SHIFT)) + 1) << (ALIGN_SHIFT))
191 
193 #define MMALIB_MMA_SIZE_8_BIT_SHIFT 6
194 #define MMALIB_MMA_SIZE_16_BIT_SHIFT 5
195 #define MMALIB_MMA_SIZE_32_BIT_SHIFT 4
196 
197  /* /\*! @brief MMA size as a function of precision *\/ */
198  /* //#define MMALIB_MMA_SIZE_1_BYTE 1 */
199  /* #define MMALIB_MMA_SIZE_8_BIT \ */
200  /* ((uint32_t)(((uint32_t)1) \ */
201  /* << MMALIB_MMA_SIZE_8_BIT_SHIFT)) //!< Shift for MMA size when data */
202  /* //!< type is 8-bit integers */
203  /* #define MMALIB_MMA_SIZE_16_BIT \ */
204  /* ((uint32_t)(((uint32_t)1) \ */
205  /* << MMALIB_MMA_SIZE_16_BIT_SHIFT)) //!< Shift for MMA size when data */
206  /* //!< type is 16-bit integers */
207  /* #define MMALIB_MMA_SIZE_32_BIT \ */
208  /* ((int32_t)(((uint32_t)1) \ */
209  /* << MMALIB_MMA_SIZE_32_BIT_SHIFT)) //!< Shift for MMA size when data */
210  /* //!< type is 32-bit integers */
211 
212 
213 
214 /*******************************************************************************
215  *
216  * DEFINES
217  *
218  ******************************************************************************/
219 
220 
221 /*******************************************************************************
222  *
223  * Macros
224  *
225  ******************************************************************************/
226 
227 
228 
233 #ifdef __cplusplus
234 }
235 #endif /* __cplusplus */
236 #endif /* C7120_MMALIB_TYPES_H_ */
237 
238 /* ======================================================================== */
239 /* End of file: MMALIB_types.h */
240 /* ======================================================================== */
MMALIB_enableDynamicRange_type_e
The enumeration of possible dynamic range enable settings.
MMALIB_enableDynamicRange_type_e MMALIB_enableDynamicRange_type
Type for enableDynamicRange variables.
MMALIB_initDynamicRange_type_e MMALIB_initDynamicRange_type
Type for initDynamicRange variables.
MMALIB_activation_type_e MMALIB_activation_type
MMALIB_initDynamicRange_type_e
The enumeration of possible dynamic range reset options.
MMALIB_quantMethod_type_e MMALIB_quantMethod_type
Type for initDynamicRange variables.
MMALIB_quantMethod_type_e
The enumeration of possible quantization methods.
MMALIB_activation_type_e
The enumeration of possible activation operations on the computation.
@ MMALIB_DYNAMIC_RANGE_ENABLE
Enable dynamic range computation.
@ MMALIB_DYNAMIC_RANGE_DISABLE
Disable dynamic range computation.
@ MMALIB_DYNAMIC_RANGE_NOINIT
Do not reset dynamic range min/max at start of computation.
@ MMALIB_DYNAMIC_RANGE_INIT
Reset dynamic range min/max at start of computation.
@ MMALIB_QUANT_PER_CHANNEL
@ MMALIB_QUANT_PER_KERNEL
@ MMALIB_PSAT
Return result after parameterized saturation.
@ MMALIB_SATURATION
Return result after saturating.
@ MMALIB_NONE
Return result as-is (allow wrapping)
@ MMALIB_RELU
Return result after applying ReLU operation.
@ MMALIB_ROUNDING
Return result after rounding.