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 - http://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_SINGLE 0
86 #define MMALIB_CONVOLVE_COL_SHIFT_PER_GROUP 1
87 
95 // typedef struct
96 // {
97 // int8_t funcStyle; //!< Variant of the function; refer to @ref MMALIB_FUNCTION_STYLE
98 // int32_t Ni; //!< Number of input channels to be processed
99 // int32_t No; //!< Number of output channels to be processed
100 // int32_t Fr; //!< Number of kernel rows (height)
101 // int32_t Fc; //!< Number of kernel columns (width)
102 // uint8_t shift; //!< Number of bits of right shift parameter for output precision
103 // int8_t shiftMethod; //!< Control behavior of MMALIB_CNN_convolve_col_smallNo_highPrecision_InitArgs.shift. @ref MMALIB_CONVOLVE_COL_SHIFT_SINGLE is currently the only supported value.
104 // int32_t strideX; //!< Stride size across columns (horizontal dimension)
105 // int32_t strideY; //!< Stride size across rows (vertical dimension)
106 // int32_t dilationX; //!< Dilation of kernel width
107 // int32_t dilationY; //!< Dilation of kernel height
108 // int32_t topPad; //!< pixels of pad to apply to the top side of the input data
109 // int32_t bottomPad; //!< pixels of pad to apply to the bottom side of the input data
110 // int32_t leftPad; //!< pixels of pad to apply to the left side of the input data
111 // int32_t rightPad; //!< pixels of pad to apply to the right side of the input data
112 //#if defined(__C7100__)
113 // int32_t bias; //!< Bias value in B matrix
114 // int32_t biasDataType; //!< Data type of the bias
115 // int32_t numBiasVals; //!< Number of elements used for the bias (cols in weights, rows in feature maps)
116 //#endif
117 // uint8_t activationType; //!< Activation of RELU, SAT or none for output
118 // int32_t featureWidth; //!< Total feature map width, without pad
119 // int32_t blockFeatureHeight; //!< Number of rows from the input feature map to be processed, without pad
120 // int32_t blockFeaturePitch; //!< Pitch between rows of input feature map, in bytes, without pad
121 // int32_t columnOffset; //!< Distance, in elements, between starting points of even-numbered input feature map block columns (0,2,4,...)
122 // int32_t inPairOffset; //!< Distance, in elements, between the even- and odd-numbered input feature map block columns (i.e. distance from 0 to 1)
123 //#if defined(MMALIB_CONVOLVE_COL_IN_KERNEL_PADDING)
124 // int32_t groupOffset; //!< Distance, in elements, between groups
125 //#endif
126 //#if defined(MMALIB_ENABLE_DYNAMIC_RANGE_TRACKING)
127 // int32_t pSatMin; //!< Minimum value for parameterized saturation
128 // int32_t pSatMax; //!< Maximum value for parameterized saturation
129 //#endif
130 // int32_t inChOffset; //!< Distance, in elements, between the input channels
131 // int32_t outPairOffset; //!< Distance, in elements, between the output of the even- and odd-numbered output feature map block columns
132 // int32_t numGroupsPerKernel; //!< Number of groups to be processed in a single kernel call
133 // } MMALIB_CNN_convolve_col_smallNo_highPrecision_InitArgs ;
134 
135 
136 // alias pointwisePost initArgs to this version; this only works if the structures are identical.
137 // if separate fields are needed, then we either need to add a default initializer or an assignement function (too many cycles of overhead, though)
139 
140 
141 
149 // typedef struct
150 // {
151 // int32_t blockFeatureWidth; //!< Width of the input feature map to be processed
152 // int32_t padFillValue; //!< Pad fill value, must be zero for C7100 devices
153 //#if defined(MMALIB_ENABLE_DYNAMIC_RANGE_TRACKING)
154 // MMALIB_enableDynamicRange_type enableDynamicRange; //!< Flag indicating whether to enable dynamic range range (min,max) calculation.
155 // MMALIB_initDynamicRange_type initDynamicRange; //!< Flag indicating whether to reset dynamic range (min,max) calculation at beginning of compute.
156 //#endif
157 // } MMALIB_CNN_convolve_col_smallNo_highPrecision_ExecInArgs ;
158 
159  // alias
161 
169 // typedef struct
170 // {
171 // int32_t validColsOut; //!< Width of buffer C
172 //#if defined(MMALIB_ENABLE_DYNAMIC_RANGE_TRACKING)
173 // int64_t dynamicRangeMin; //!< Minimum computed value, controlled with MMALIB_CNN_convolve_col_smallNo_highPrecision_ExecInArgs.initDynamicRange
174 // int64_t dynamicRangeMax; //!< Maximum computed value, controlled with MMALIB_CNN_convolve_col_smallNo_highPrecision_ExecInArgs.initDynamicRange
175 //#endif
176 // } MMALIB_CNN_convolve_col_smallNo_highPrecision_ExecOutArgs ;
177  // alias
179 
180 
193 
194 
220  const MMALIB_bufParams3D_t * src0_addr,
221  const MMALIB_bufParams2D_t * src1_addr,
222  const MMALIB_bufParams2D_t * src2_addr,
223  const MMALIB_bufParams1D_t * src3_addr,
224  const MMALIB_bufParams3D_t * dst_addr ,
226 
227 
252  const MMALIB_bufParams3D_t * src0_addr,
253  const MMALIB_bufParams2D_t * src1_addr,
254  const MMALIB_bufParams2D_t * src2_addr,
255  const MMALIB_bufParams1D_t * src3_addr,
256  const MMALIB_bufParams3D_t * dst_addr,
258 
259 
305  const void *src0,
306  const void *src1,
307  const void *src2,
308  const void *src3,
309  const uint8_t *shiftValues,
310  void *restrict dst,
313 
314 
339  const void *src0,
340  const void *src1,
341  const void *src2,
342  const void *src3,
343  const uint8_t *shiftValues,
344  const void *dst,
346 
347 
376  const MMALIB_bufParams3D_t * src0_addr,
377  const MMALIB_bufParams2D_t * src1_addr,
378  const MMALIB_bufParams2D_t * src2_addr,
379  const MMALIB_bufParams1D_t * src3_addr,
380  const MMALIB_bufParams3D_t * dst_addr,
384  uint64_t *archCycles, uint64_t *estCycles);
385 
387 #ifdef __cplusplus
388 }
389 #endif
390 #endif /* MMALIB_CNN_CONVOLVE_COL_SMALLNO_HIGHPRECISION_H_ */
391 
392 /* ======================================================================== */
393 /* End of file: MMALIB_CNN_convolve_col_smallNo_highPrecision.h */
394 /* ======================================================================== */
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
void MMALIB_CNN_convolve_col_smallNo_highPrecision_perfEst(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, const MMALIB_CNN_convolve_col_smallNo_highPrecision_ExecInArgs *pExecInArgs, MMALIB_CNN_convolve_col_smallNo_highPrecision_ExecOutArgs *pExecOutArgs, uint64_t *archCycles, uint64_t *estCycles)
This function estimates the cycles consumed for the kernel execution.
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:262
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.