MMALIB User Guide
MMALIB_CNN_deconvolve_row_ixX_ixX_oxX.h
Go to the documentation of this file.
1 /*******************************************************************************
2  **+--------------------------------------------------------------------------+**
3  **| **** |**
4  **| **** |**
5  **| ******o*** |**
6  **| ********_///_**** |**
7  **| ***** /_//_/ **** |**
8  **| ** ** (__/ **** |**
9  **| ********* |**
10  **| **** |**
11  **| *** |**
12  **| |**
13  **| Copyright (c) 2016 Texas Instruments Incorporated |**
14  **| |**
15  **| All rights reserved not granted herein. |**
16  **| |**
17  **| Limited License. |**
18  **| |**
19  **| Texas Instruments Incorporated grants a world-wide, royalty-free, |**
20  **| non-exclusive license under copyrights and patents it now or |**
21  **| hereafter owns or controls to make, have made, use, import, offer to |**
22  **| sell and sell ("Utilize") this software subject to the terms herein. |**
23  **| With respect to the foregoing patent license, such license is granted |**
24  **| solely to the extent that any such patent is necessary to Utilize the |**
25  **| software alone. The patent license shall not apply to any |**
26  **| combinations which include this software, other than combinations |**
27  **| with devices manufactured by or for TI ("TI Devices"). No hardware |**
28  **| patent is licensed hereunder. |**
29  **| |**
30  **| Redistributions must preserve existing copyright notices and |**
31  **| reproduce this license (including the above copyright notice and the |**
32  **| disclaimer and (if applicable) source code license limitations below) |**
33  **| in the documentation and/or other materials provided with the |**
34  **| distribution |**
35  **| |**
36  **| Redistribution and use in binary form, without modification, are |**
37  **| permitted provided that the following conditions are met: |**
38  **| |**
39  **| * No reverse engineering, decompilation, or disassembly of this |**
40  **| software is permitted with respect to any software provided in binary |**
41  **| form. |**
42  **| |**
43  **| * any redistribution and use are licensed by TI for use only with |**
44  **| TI Devices. |**
45  **| |**
46  **| * Nothing shall obligate TI to provide you with source code for |**
47  **| the software licensed and provided to you in object code. |**
48  **| |**
49  **| If software source code is provided to you, modification and |**
50  **| redistribution of the source code are permitted provided that the |**
51  **| following conditions are met: |**
52  **| |**
53  **| * any redistribution and use of the source code, including any |**
54  **| resulting derivative works, are licensed by TI for use only with TI |**
55  **| Devices. |**
56  **| |**
57  **| * any redistribution and use of any object code compiled from the |**
58  **| source code and any resulting derivative works, are licensed by TI |**
59  **| for use only with TI Devices. |**
60  **| |**
61  **| Neither the name of Texas Instruments Incorporated nor the names of |**
62  **| its suppliers may be used to endorse or promote products derived from |**
63  **| this software without specific prior written permission. |**
64  **| |**
65  **| DISCLAIMER. |**
66  **| |**
67  **| THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY |**
68  **| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |**
69  **| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |**
70  **| PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL TI AND TI'S LICENSORS BE |**
71  **| LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |**
72  **| CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |**
73  **| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |**
74  **| BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |**
75  **| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |**
76  **| OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |**
77  **| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |**
78  **+--------------------------------------------------------------------------+**
79  *******************************************************************************/
80 
81 /******************************************************************************
82  * *
83  * module name :MMALIB *
84  * *
85  * module descripton :Matrix Multiply Accelerator Library module for C7x+MMA *
86  * *
87  * Copyright (C) 2017-2018 Texas Instruments Incorporated - http://www.ti.com/ *
88  * ALL RIGHTS RESERVED *
89  * *
90  ******************************************************************************/
103 #ifndef MMALIB_CNN_DECONVOLVE_ROW_IXX_IXX_OXX_H_
104 #define MMALIB_CNN_DECONVOLVE_ROW_IXX_IXX_OXX_H_
105 
106 #include "../../common/MMALIB_types.h"
107 
108 #ifdef __cplusplus
109 extern "C" {
110 #endif
111 
156 /* @{ */
157 
163 typedef enum {
168 
175 typedef struct {
177  int8_t funcStyle;
179  uint32_t No;
181  uint32_t numGroups;
183  uint32_t inChOffset;
185  int32_t validColsIn;
189  int32_t validRowsIn;
195  uint32_t inWidth;
197  uint32_t pad;
199  // validColsOut x numMMAcalls < inWidth x maxHeight
200  int32_t maxHeight;
202  uint32_t subMChannels;
204  uint32_t shift;
206  int32_t Fr;
208  int32_t Fc;
210  int32_t strideX;
212  int32_t strideY;
214  int32_t dilationX;
216  int32_t dilationY;
218  uint32_t bias;
220  uint8_t activationType;
222  uint8_t mode;
224 
231 typedef struct {
233  int32_t validColsIn;
235  uint32_t subMChannels;
237 
244 typedef struct {
246  uint32_t validColsOut;
248 
260 
281  MMALIB_kernelHandle handle,
282  const MMALIB_bufParams2D_t * src0_addr,
283  const MMALIB_bufParams2D_t * src1_addr,
284  const MMALIB_bufParams2D_t * dst_addr,
286 
307  MMALIB_kernelHandle handle,
308  const MMALIB_bufParams2D_t * src0_addr,
309  const MMALIB_bufParams2D_t * src1_addr,
310  const MMALIB_bufParams2D_t * dst_addr,
312 
346  MMALIB_kernelHandle handle,
347  const void * src0,
348  const void * src1,
349  void * dst,
352 
373  MMALIB_kernelHandle handle,
374  const void * src0,
375  const void * src1,
376  const void * dst,
378 
402  uint32_t numInChannels,
403  uint32_t pitchA,
404  uint32_t numOutChannels,
405  uint32_t numGroups,
406  const uint32_t mmaSize,
407  const void *restrict src,
408  void *restrict dst);
409 
433  uint32_t numInChannels,
434  uint32_t pitchA,
435  uint32_t numOutChannels,
436  uint32_t numGroups,
437  const uint32_t mmaSize,
438  const void *restrict src,
439  void *restrict dst);
440 
464  uint32_t numInChannels,
465  uint32_t pitchA,
466  uint32_t numOutChannels,
467  uint32_t numGroups,
468  const uint32_t mmaSize,
469  const void *restrict src,
470  void *restrict dst);
471 
497  const MMALIB_bufParams2D_t * src0_addr,
498  const MMALIB_bufParams2D_t * src1_addr,
499  const MMALIB_bufParams2D_t * dst_addr,
503  int32_t iterN,
504  uint64_t * archCycles,
505  uint64_t * estCycles);
506 
509 #ifdef __cplusplus
510 }
511 #endif
512 #endif /* MMALIB_CNN_DECONVOLVE_ROW_IXX_IXX_OXX_H_ */
513 
514 /* ======================================================================== */
515 /* End of file: MMALIB_CNN_deconvolve_row_ixX_ixX_oxX.h */
516 /* ======================================================================== */
MMALIB_STATUS MMALIB_CNN_deconvolve_row_ixX_ixX_oxX_init(MMALIB_kernelHandle handle, const MMALIB_bufParams2D_t *src0_addr, const MMALIB_bufParams2D_t *src1_addr, const MMALIB_bufParams2D_t *dst_addr, const MMALIB_CNN_deconvolve_row_ixX_ixX_oxX_InitArgs *pKerInitArgs)
This function call is required to initialize the handle. In this function, most of the one-time opera...
MMALIB_STATUS MMALIB_CNN_deconvolve_row_ixX_ixX_oxX_exec(MMALIB_kernelHandle handle, const void *src0, const void *src1, void *dst, const MMALIB_CNN_deconvolve_row_ixX_ixX_oxX_ExecInArgs *pKerInArgs, MMALIB_CNN_deconvolve_row_ixX_ixX_oxX_ExecOutArgs *pKerOutArgs)
This function is the main compute function and performs the deconvolution primitive (conv + ReLU) for...
int32_t MMALIB_CNN_deconvolve_row_ixX_ixX_oxX_getHandleSize(MMALIB_CNN_deconvolve_row_ixX_ixX_oxX_InitArgs *pKerInitArgs)
This is a query function to return the size of internal handle.
void MMALIB_CNN_deconvolveBiasReLUCompute_ixX_ixX_oxX_perfEst(const MMALIB_bufParams2D_t *src0_addr, const MMALIB_bufParams2D_t *src1_addr, const MMALIB_bufParams2D_t *dst_addr, const MMALIB_CNN_deconvolve_row_ixX_ixX_oxX_InitArgs *kerInitArgs, const MMALIB_CNN_deconvolve_row_ixX_ixX_oxX_ExecInArgs *pKerInArgs, MMALIB_CNN_deconvolve_row_ixX_ixX_oxX_ExecOutArgs *pKerOutArgs, int32_t iterN, uint64_t *archCycles, uint64_t *estCycles)
This function estimates the cycles consumed for the kernel execution.
MMALIB_STATUS MMALIB_CNN_deconvolve_row_4x4Stride2PreProcessParameters(uint32_t kDim, uint32_t numInChannels, uint32_t pitchA, uint32_t numOutChannels, uint32_t numGroups, const uint32_t mmaSize, const void *restrict src, void *restrict dst)
This is a pre-processing function that reshapes the parameter buffer from to . The kernel expects th...
MMALIB_STATUS MMALIB_CNN_deconvolve_row_ixX_ixX_oxX_init_checkParams(MMALIB_kernelHandle handle, const MMALIB_bufParams2D_t *src0_addr, const MMALIB_bufParams2D_t *src1_addr, const MMALIB_bufParams2D_t *dst_addr, const MMALIB_CNN_deconvolve_row_ixX_ixX_oxX_InitArgs *pKerInitArgs)
This function call is required to initialize the handle. In this function, most of the one-time opera...
MMALIB_STATUS MMALIB_CNN_deconvolve_row_ixX_ixX_oxX_exec_checkParams(MMALIB_kernelHandle handle, const void *src0, const void *src1, const void *dst, const MMALIB_CNN_deconvolve_row_ixX_ixX_oxX_ExecInArgs *pKerInArgs)
This function checks the parameters and should be called before kernel execution. It can be called on...
MMALIB_STATUS MMALIB_CNN_deconvolve_row_2x2Stride2PreProcessParameters(uint32_t kDim, uint32_t numInChannels, uint32_t pitchA, uint32_t numOutChannels, uint32_t numGroups, const uint32_t mmaSize, const void *restrict src, void *restrict dst)
This is a pre-processing function that reshapes the parameter buffer from to . The kernel expects th...
MMALIB_STATUS MMALIB_CNN_deconvolve_row_8x8Stride2PreProcessParameters(uint32_t kDim, uint32_t numInChannels, uint32_t pitchA, uint32_t numOutChannels, uint32_t numGroups, const uint32_t mmaSize, const void *restrict src, void *restrict dst)
This is a pre-processing function that reshapes the parameter buffer from to . The kernel expects th...
MMALIB_CNN_DECONVOLVE_ROW_IXX_IXX_OXX_STATUS_NAME
Enumeration for different Error codes for MMALIB_CNN_DECONVOLVE_ROW Kernel.
@ MMALIB_CNN_DECONVOLVE_ROW_IXX_IXX_OXX_ERR_SMALL_K
@ MMALIB_CNN_DECONVOLVE_ROW_IXX_IXX_OXX_ERR_MAX
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
Structure containing the parameters for input to the execute phase of CNN deconvolution computation.
Structure containing the parameters initialization of CNN deconvolution computation.
int32_t outputPitchPerRow
Strided convolution - output pitch per row.
int32_t inputPitchPerRow
Strided convolution - input pitch per row.
int8_t funcStyle
Variant of the function refer to MMALIB_FUNCTION_STYLE
uint32_t numGroups
Total number output groups; supported for only Ni=No=1.
int32_t validColsPerRowIn
Strided convolution - input columns per row.
uint8_t mode
Circular or Linear addressing for B matrix.
uint32_t No
Total number of output channels to be processed.
A structure for a 2 dimensional buffer descriptor.