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 
87  /* @{ */
88 
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 inChOffset;
136  int32_t outPairOffset;
139 
140 
148  typedef struct
149  {
152 
153 
161  typedef struct
162  {
163  int32_t validColsOut;
165 
166 
179 
180 
202  const MMALIB_bufParams2D_t * src0_addr,
203  const MMALIB_bufParams2D_t * src1_addr,
204  const MMALIB_bufParams3D_t * dst_addr ,
206 
207 
228  const MMALIB_bufParams2D_t * src0_addr,
229  const MMALIB_bufParams2D_t * src1_addr,
230  const MMALIB_bufParams3D_t * dst_addr,
232 
233 
283  const void *src0,
284  const void *src1,
285  const uint8_t *shiftValues,
286  const int32_t *biasBValues,
287  void *restrict dst,
290 
291 
315  const void *src0,
316  const void *src1,
317  const uint8_t *shiftValues,
318  const int32_t *biasBValues,
319  const void *dst,
321 
322 
348  const MMALIB_bufParams2D_t * src0_addr,
349  const MMALIB_bufParams2D_t * src1_addr,
350  const MMALIB_bufParams3D_t * dst_addr,
354  uint64_t *archCycles, uint64_t *estCycles);
355 
356  /* @} */
357 #ifdef __cplusplus
358 }
359 #endif
360 #endif /* MMALIB_CNN_CONVOLVE_COL_SMALLNO_IXX_IXX_OXX_H_ */
361 
362 /* ======================================================================== */
363 /* End of file: MMALIB_CNN_convolve_col_smallNo_ixX_ixX_oxX.h */
364 /* ======================================================================== */
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_CNN_CONVOLVE_COL_SMALLNO_IXX_IXX_OXX_ERR_SMALL_K
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_STATUS_NAME
The enumeration of all status codes.
Definition: MMALIB_types.h:176
@ MMALIB_ERROR_MAX
Definition: MMALIB_types.h:190
void * MMALIB_kernelHandle
Handle type for MMALIB operations.
Definition: MMALIB_types.h:279
This structure holds all the execution input parameters for the CNN column based convolution kernel.
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.
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 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....
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 inChOffset
Distance, in elements, between the input channels.
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.