MMALIB User Guide
MMALIB_CNN_convolve_col_smallNo_highPrecision.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 
12 /********************************************************************************
13  * @file MMALIB_CNN_convolve_col_smallNo_highPrecision.h
14  *
15  * @brief Public header file for MMALIB_CNN_convolve_col_smallNo_highPrecision
16  * function
17  *
18  * @version 0.1 - Feb 2018 : Initial Version
19  *
20  ********************************************************************************/
21 
22 #ifndef MMALIB_CNN_CONVOLVE_COL_SMALLNO_HIGHPRECISION_H_
23 #define MMALIB_CNN_CONVOLVE_COL_SMALLNO_HIGHPRECISION_H_
24 
25 #include "../../common/MMALIB_types.h"
27 #include "../MMALIB_CNN_convolve_col_smallNo_highPrecision_pointwisePost/MMALIB_CNN_convolve_col_smallNo_highPrecision_pointwisePost.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
82  // alias
84 
85 #define MMALIB_CONVOLVE_COL_SHIFT_PER_GROUP 1
86 
94 // typedef struct
95 // {
96 // int8_t funcStyle; //!< Variant of the function; refer to @ref MMALIB_FUNCTION_STYLE
97 // int32_t Ni; //!< Number of input channels to be processed
98 // int32_t No; //!< Number of output channels to be processed
99 // int32_t Fr; //!< Number of kernel rows (height)
100 // int32_t Fc; //!< Number of kernel columns (width)
101 // uint8_t shift; //!< Number of bits of right shift parameter for output precision
102 // int8_t shiftMethod; //!< Control behavior of MMALIB_CNN_convolve_col_smallNo_highPrecision_InitArgs.shift. @ref MMALIB_CONVOLVE_COL_SHIFT_PER_GROUP is currently the only supported value.
103 // int32_t strideX; //!< Stride size across columns (horizontal dimension)
104 // int32_t strideY; //!< Stride size across rows (vertical dimension)
105 // int32_t dilationX; //!< Dilation of kernel width
106 // int32_t dilationY; //!< Dilation of kernel height
107 // int32_t topPad; //!< pixels of pad to apply to the top side of the input data
108 // int32_t bottomPad; //!< pixels of pad to apply to the bottom side of the input data
109 // int32_t leftPad; //!< pixels of pad to apply to the left side of the input data
110 // int32_t rightPad; //!< pixels of pad to apply to the right side of the input data
111 //#if defined(__C7100__)
112 // int32_t bias; //!< Bias value in B matrix
113 // int32_t biasDataType; //!< Data type of the bias
114 // int32_t numBiasVals; //!< Number of elements used for the bias (cols in weights, rows in feature maps)
115 //#endif
116 // uint8_t activationType; //!< Activation of RELU, SAT or none for output
117 // int32_t featureWidth; //!< Total feature map width, without pad
118 // int32_t blockFeatureHeight; //!< Number of rows from the input feature map to be processed, without pad
119 // int32_t blockFeaturePitch; //!< Pitch between rows of input feature map, in bytes, without pad
120 // int32_t columnOffset; //!< Distance, in elements, between starting points of even-numbered input feature map block columns (0,2,4,...)
121 // int32_t inPairOffset; //!< Distance, in elements, between the even- and odd-numbered input feature map block columns (i.e. distance from 0 to 1)
122 //#if defined(MMALIB_CONVOLVE_COL_IN_KERNEL_PADDING)
123 // int32_t groupOffset; //!< Distance, in elements, between groups
124 //#endif
125 //#if defined(MMALIB_ENABLE_DYNAMIC_RANGE_TRACKING)
126 // int32_t pSatMin; //!< Minimum value for parameterized saturation
127 // int32_t pSatMax; //!< Maximum value for parameterized saturation
128 //#endif
129 // int32_t inChOffset; //!< Distance, in elements, between the input channels
130 // int32_t outPairOffset; //!< Distance, in elements, between the output of the even- and odd-numbered output feature map block columns
131 // int32_t numGroupsPerKernel; //!< Number of groups to be processed in a single kernel call
132 // } MMALIB_CNN_convolve_col_smallNo_highPrecision_InitArgs ;
133 
134 
135 // alias pointwisePost initArgs to this version; this only works if the structures are identical.
136 // if separate fields are needed, then we either need to add a default initializer or an assignement function (too many cycles of overhead, though)
138 
139 
140 
148 // typedef struct
149 // {
150 // int32_t blockFeatureWidth; //!< Width of the input feature map to be processed
151 // int32_t padFillValue; //!< Pad fill value, must be zero for C7100 devices
152 //#if defined(MMALIB_ENABLE_DYNAMIC_RANGE_TRACKING)
153 // MMALIB_enableDynamicRange_type enableDynamicRange; //!< Flag indicating whether to enable dynamic range range (min,max) calculation.
154 // MMALIB_initDynamicRange_type initDynamicRange; //!< Flag indicating whether to reset dynamic range (min,max) calculation at beginning of compute.
155 //#endif
156 // } MMALIB_CNN_convolve_col_smallNo_highPrecision_ExecInArgs ;
157 
158  // alias
160 
168 // typedef struct
169 // {
170 // int32_t validColsOut; //!< Width of buffer C
171 //#if defined(MMALIB_ENABLE_DYNAMIC_RANGE_TRACKING)
172 // int64_t dynamicRangeMin; //!< Minimum computed value, controlled with MMALIB_CNN_convolve_col_smallNo_highPrecision_ExecInArgs.initDynamicRange
173 // int64_t dynamicRangeMax; //!< Maximum computed value, controlled with MMALIB_CNN_convolve_col_smallNo_highPrecision_ExecInArgs.initDynamicRange
174 //#endif
175 // } MMALIB_CNN_convolve_col_smallNo_highPrecision_ExecOutArgs ;
176  // alias
178 
179 
192 
193 
219  const MMALIB_bufParams3D_t * src0_addr,
220  const MMALIB_bufParams2D_t * src1_addr,
221  const MMALIB_bufParams2D_t * src2_addr,
222  const MMALIB_bufParams1D_t * src3_addr,
223  const MMALIB_bufParams3D_t * dst_addr ,
225 
226 
251  const MMALIB_bufParams3D_t * src0_addr,
252  const MMALIB_bufParams2D_t * src1_addr,
253  const MMALIB_bufParams2D_t * src2_addr,
254  const MMALIB_bufParams1D_t * src3_addr,
255  const MMALIB_bufParams3D_t * dst_addr,
257 
258 
304  const void *src0,
305  const void *src1,
306  const void *src2,
307  const void *src3,
308  const uint8_t *shiftValues,
309  void *restrict dst,
312 
313 
338  const void *src0,
339  const void *src1,
340  const void *src2,
341  const void *src3,
342  const uint8_t *shiftValues,
343  const void *dst,
345 
346 
374 // void MMALIB_CNN_convolve_col_smallNo_highPrecision_perfEst( MMALIB_kernelHandle handle,
375 // const MMALIB_bufParams3D_t * src0_addr,
376 // const MMALIB_bufParams2D_t * src1_addr,
377 // const MMALIB_bufParams2D_t * src2_addr,
378 // const MMALIB_bufParams1D_t * src3_addr,
379 // const MMALIB_bufParams3D_t * dst_addr,
380 // const MMALIB_CNN_convolve_col_smallNo_highPrecision_InitArgs *pKerInitArgs,
381 // const MMALIB_CNN_convolve_col_smallNo_highPrecision_ExecInArgs *pExecInArgs,
382 // MMALIB_CNN_convolve_col_smallNo_highPrecision_ExecOutArgs *pExecOutArgs,
383 // uint64_t *archCycles, uint64_t *estCycles);
384 
386 #ifdef __cplusplus
387 }
388 #endif
389 #endif /* MMALIB_CNN_CONVOLVE_COL_SMALLNO_HIGHPRECISION_H_ */
390 
391 /* ======================================================================== */
392 /* End of file: MMALIB_CNN_convolve_col_smallNo_highPrecision.h */
393 /* ======================================================================== */
MMALIB_CNN_CONVOLVE_COL_SMALLNO_HIGHPRECISION_POINTWISEPOST_STATUS_NAME
Enumeration for different error codes for MMALIB_CNN_convolve_col_smallNo_highPrecision_pointwisePost...
MMALIB_CNN_convolve_col_smallNo_highPrecision_pointwisePost_ExecOutArgs MMALIB_CNN_convolve_col_smallNo_highPrecision_ExecOutArgs
MMALIB_STATUS MMALIB_CNN_convolve_col_smallNo_highPrecision_init(MMALIB_kernelHandle handle, const MMALIB_bufParams3D_t *src0_addr, const MMALIB_bufParams2D_t *src1_addr, const MMALIB_bufParams2D_t *src2_addr, const MMALIB_bufParams1D_t *src3_addr, const MMALIB_bufParams3D_t *dst_addr, const MMALIB_CNN_convolve_col_smallNo_highPrecision_InitArgs *pKerInitArgs)
This function call is required to initialize the handle. In this function most of the one time operat...
MMALIB_STATUS MMALIB_CNN_convolve_col_smallNo_highPrecision_exec_checkParams(MMALIB_kernelHandle handle, const void *src0, const void *src1, const void *src2, const void *src3, const uint8_t *shiftValues, const void *dst, const MMALIB_CNN_convolve_col_smallNo_highPrecision_ExecInArgs *pKerInArgs)
This function checks the parameters and should be called before kernel executuon. It can be called on...
int32_t MMALIB_CNN_convolve_col_smallNo_highPrecision_getHandleSize(MMALIB_CNN_convolve_col_smallNo_highPrecision_InitArgs *pKerInitArgs)
This is a query function to kernel to get the size of internal handle.
MMALIB_STATUS MMALIB_CNN_convolve_col_smallNo_highPrecision_init_checkParams(MMALIB_kernelHandle handle, const MMALIB_bufParams3D_t *src0_addr, const MMALIB_bufParams2D_t *src1_addr, const MMALIB_bufParams2D_t *src2_addr, const MMALIB_bufParams1D_t *src3_addr, const MMALIB_bufParams3D_t *dst_addr, const MMALIB_CNN_convolve_col_smallNo_highPrecision_InitArgs *pKerInitArgs)
This function checks the parameters and should be called before kernel executuon. It can be called on...
MMALIB_CNN_CONVOLVE_COL_SMALLNO_HIGHPRECISION_POINTWISEPOST_STATUS_NAME MMALIB_CNN_CONVOLVE_COL_SMALLNO_HIGHPRECISION_STATUS_NAME
MMALIB_CNN_convolve_col_smallNo_highPrecision_pointwisePost_InitArgs MMALIB_CNN_convolve_col_smallNo_highPrecision_InitArgs
MMALIB_STATUS MMALIB_CNN_convolve_col_smallNo_highPrecision_exec(MMALIB_kernelHandle handle, const void *src0, const void *src1, const void *src2, const void *src3, const uint8_t *shiftValues, void *restrict dst, const MMALIB_CNN_convolve_col_smallNo_highPrecision_ExecInArgs *pKerInArgs, MMALIB_CNN_convolve_col_smallNo_highPrecision_ExecOutArgs *pKerOutArgs)
This function is the main compute function, and performs the convolution primitive (conv + ReLU) for ...
MMALIB_CNN_convolve_col_smallNo_highPrecision_pointwisePost_ExecInArgs MMALIB_CNN_convolve_col_smallNo_highPrecision_ExecInArgs
MMALIB_STATUS_NAME
The enumeration of all status codes.
Definition: MMALIB_types.h:152
void * MMALIB_kernelHandle
Handle type for MMALIB operations.
Definition: MMALIB_types.h:265
This structure holds all the execution input parameters for the CNN column based convolution kernel.
This structure holds all the runtime output parameters for CNN column based convolution kernel.
This structure holds all the initialization parameters for CNN column based convolution kernel.
This structure holds all the execution input parameters for the CNN column based convolution kernel.
This structure holds all the runtime output parameters for CNN column based convolution kernel.
This structure holds all the initialization parameters for CNN column based convolution kernel.
A structure for a 1 dimensional buffer descriptor.
A structure for a 2 dimensional buffer descriptor.
A structure for a 3 dimensional buffer descriptor.