MMALIB User Guide
MMALIB_CNN_convolve_col_smallNo_ixX_ixX_oxX.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_ixX_ixX_oxX.h
14  *
15  * @brief Public header file for MMALIB_CNN_convolve_col_smallNo_ixX_ixX_oxX
16  * function
17  *
18  * @version 0.1 - Feb 2018 : Initial Version
19  *
20  ********************************************************************************/
21 
22 #ifndef MMALIB_CNN_CONVOLVE_COL_SMALLNO_IXX_IXX_OXX_H_
23 #define MMALIB_CNN_CONVOLVE_COL_SMALLNO_IXX_IXX_OXX_H_
24 
25 #include "../../common/MMALIB_types.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
96  typedef enum
97  {
99  /* @todo Add more appropriate error codes */
102 
103 #define MMALIB_CONVOLVE_COL_SHIFT_SINGLE 0
104 #define MMALIB_CONVOLVE_COL_SHIFT_PER_GROUP 1
105 
113  typedef struct
114  {
115  int8_t funcStyle;
116  int32_t Ni;
117  int32_t No;
118  int32_t Fr;
119  int32_t Fc;
120  uint8_t shift;
121  int8_t shiftMethod;
122  int32_t strideX;
123  int32_t strideY;
124  int32_t dilationX;
125  int32_t dilationY;
126  int32_t bias;
127  int32_t biasDataType;
128  int32_t numBiasVals;
129  uint8_t activationType;
130  int32_t featureWidth;
133  int32_t columnOffset;
134  int32_t inPairOffset;
135  int32_t topPad;
136  int32_t bottomPad;
137  int32_t leftPad;
138  int32_t rightPad;
139  int32_t groupOffset;
140  int32_t pSatMin;
141  int32_t pSatMax;
142  int32_t inChOffset;
143  int32_t outPairOffset;
146 
147 
155  typedef struct
156  {
158  int32_t padFillValue;
159  MMALIB_enableDynamicRange_type enableDynamicRange;
160  MMALIB_initDynamicRange_type initDynamicRange;
162 
163 
171  typedef struct
172  {
173  int32_t validColsOut;
174  int64_t dynamicRangeMin;
175  int64_t dynamicRangeMax;
177 
178 
191 
192 
214  const MMALIB_bufParams2D_t * src0_addr,
215  const MMALIB_bufParams2D_t * src1_addr,
216  const MMALIB_bufParams3D_t * dst_addr ,
218 
219 
240  const MMALIB_bufParams2D_t * src0_addr,
241  const MMALIB_bufParams2D_t * src1_addr,
242  const MMALIB_bufParams3D_t * dst_addr,
244 
245 
295  const void *src0,
296  const void *src1,
297  const uint8_t *shiftValues,
298  const int32_t *biasBValues,
299  void *restrict dst,
302 
303 
327  const void *src0,
328  const void *src1,
329  const uint8_t *shiftValues,
330  const int32_t *biasBValues,
331  const void *dst,
333 
334 
360  const MMALIB_bufParams2D_t * src0_addr,
361  const MMALIB_bufParams2D_t * src1_addr,
362  const MMALIB_bufParams3D_t * dst_addr,
366  uint64_t *archCycles, uint64_t *estCycles);
367 
369 #ifdef __cplusplus
370 }
371 #endif
372 #endif /* MMALIB_CNN_CONVOLVE_COL_SMALLNO_IXX_IXX_OXX_H_ */
373 
374 /* ======================================================================== */
375 /* End of file: MMALIB_CNN_convolve_col_smallNo_ixX_ixX_oxX.h */
376 /* ======================================================================== */
void MMALIB_CNN_convolve_col_smallNo_ixX_ixX_oxX_perfEst(MMALIB_kernelHandle handle, const MMALIB_bufParams2D_t *src0_addr, const MMALIB_bufParams2D_t *src1_addr, const MMALIB_bufParams3D_t *dst_addr, const MMALIB_CNN_convolve_col_smallNo_ixX_ixX_oxX_InitArgs *pKerInitArgs, const MMALIB_CNN_convolve_col_smallNo_ixX_ixX_oxX_ExecInArgs *pExecInArgs, MMALIB_CNN_convolve_col_smallNo_ixX_ixX_oxX_ExecOutArgs *pExecOutArgs, uint64_t *archCycles, uint64_t *estCycles)
This function estimates the cycles consumed for the kernel execution.
MMALIB_CNN_CONVOLVE_COL_SMALLNO_IXX_IXX_OXX_STATUS_NAME
Enumeration for different error codes for MMALIB_CNN_CONVOLVE_COL_SMALLNO kernel.
MMALIB_STATUS MMALIB_CNN_convolve_col_smallNo_ixX_ixX_oxX_init_checkParams(MMALIB_kernelHandle handle, const MMALIB_bufParams2D_t *src0_addr, const MMALIB_bufParams2D_t *src1_addr, const MMALIB_bufParams3D_t *dst_addr, const MMALIB_CNN_convolve_col_smallNo_ixX_ixX_oxX_InitArgs *pKerInitArgs)
This function checks the parameters and should be called before kernel executuon. It can be called on...
int32_t MMALIB_CNN_convolve_col_smallNo_ixX_ixX_oxX_getHandleSize(MMALIB_CNN_convolve_col_smallNo_ixX_ixX_oxX_InitArgs *pKerInitArgs)
This is a query function to kernel to get the size of internal handle.
MMALIB_STATUS MMALIB_CNN_convolve_col_smallNo_ixX_ixX_oxX_init(MMALIB_kernelHandle handle, const MMALIB_bufParams2D_t *src0_addr, const MMALIB_bufParams2D_t *src1_addr, const MMALIB_bufParams3D_t *dst_addr, const MMALIB_CNN_convolve_col_smallNo_ixX_ixX_oxX_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_ixX_ixX_oxX_exec(MMALIB_kernelHandle handle, const void *src0, const void *src1, const uint8_t *shiftValues, const int32_t *biasBValues, void *restrict dst, const MMALIB_CNN_convolve_col_smallNo_ixX_ixX_oxX_ExecInArgs *pKerInArgs, MMALIB_CNN_convolve_col_smallNo_ixX_ixX_oxX_ExecOutArgs *pKerOutArgs)
This function is the main compute function, and performs the convolution primitive (conv + ReLU) for ...
MMALIB_STATUS MMALIB_CNN_convolve_col_smallNo_ixX_ixX_oxX_exec_checkParams(MMALIB_kernelHandle handle, const void *src0, const void *src1, const uint8_t *shiftValues, const int32_t *biasBValues, const void *dst, const MMALIB_CNN_convolve_col_smallNo_ixX_ixX_oxX_ExecInArgs *pKerInArgs)
This function checks the parameters and should be called before kernel executuon. It can be called on...
@ MMALIB_CNN_CONVOLVE_COL_SMALLNO_IXX_IXX_OXX_ERR_SMALL_K
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
@ MMALIB_ERROR_MAX
Definition: MMALIB_types.h:167
This structure holds all the execution input parameters for the CNN column based convolution kernel.
int32_t padFillValue
Pad fill value (not supported for C7100 devices)
MMALIB_initDynamicRange_type initDynamicRange
Flag indicating whether to reset dynamic range (min,max) calculation at beginning of compute.
MMALIB_enableDynamicRange_type enableDynamicRange
Flag indicating whether to enable dynamic range range (min,max) calculation.
int32_t blockFeatureWidth
Width of the input feature map to be processed.
This structure holds all the runtime output parameters for CNN column based convolution kernel.
int64_t dynamicRangeMin
Minimum computed value, controlled with MMALIB_CNN_convolve_col_smallNo_ixX_ixX_oxX_ExecInArgs....
int64_t dynamicRangeMax
Maximum computed value, controlled with MMALIB_CNN_convolve_col_smallNo_ixX_ixX_oxX_ExecInArgs....
This structure holds all the initialization parameters for CNN column based convolution kernel.
int32_t strideX
Stride size across columns (horizontal dimension)
int32_t blockFeaturePitch
Pitch between rows of input feature map, in bytes, without pad.
int32_t topPad
pixels of pad to apply to the top side of the input data
int32_t numGroupsPerKernel
Number of groups to be processed in a single kernel call.
int8_t funcStyle
Variant of the function; refer to MMALIB_FUNCTION_STYLE.
int32_t numBiasVals
Number of elements used for the bias (cols in weights, rows in feature maps)
int32_t inPairOffset
Distance, in elements, between the even- and odd-numbered input feature map block columns (i....
int32_t leftPad
pixels of pad to apply to the left side of the input data
int8_t shiftMethod
Control behavior of MMALIB_CNN_convolve_col_smallNo_ixX_ixX_oxX_InitArgs.shift. MMALIB_CONVOLVE_COL_S...
int32_t blockFeatureHeight
Number of rows from the input feature map to be processed, without pad.
int32_t columnOffset
Distance, in elements, between starting points of even-numbered input feature map block columns (0,...
int32_t rightPad
pixels of pad to apply to the right side of the input data
int32_t inChOffset
Distance, in elements, between the input channels.
int32_t bottomPad
pixels of pad to apply to the bottom side of the input data
int32_t outPairOffset
Distance, in elements, between the output of the even- and odd-numbered output feature map block colu...
uint8_t shift
Number of bits of right shift parameter for output precision.
A structure for a 2 dimensional buffer descriptor.
A structure for a 3 dimensional buffer descriptor.