MMALIB User Guide
MMALIB_CNN_fullyConnectedBias_ixX_ixX_oxX.h
Go to the documentation of this file.
1 /******************************************************************************/
5 /* Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  *
14  * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the
17  * distribution.
18  *
19  * Neither the name of Texas Instruments Incorporated nor the names of
20  * its contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  *
35  ******************************************************************************/
36 
37 #ifndef MMALIB_CNN_FULLYCONNECTEDBIAS_IXX_IXX_OXX_H_
38 #define MMALIB_CNN_FULLYCONNECTEDBIAS_IXX_IXX_OXX_H_
39 
40 #include "../../common/MMALIB_types.h"
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 // clang-format off
126 // clang-format on
134 typedef enum {
136  /*@todo Add more appropriate error codes */
139 
144 typedef struct {
146  int8_t funcStyle;
150  int32_t pSatMax;
152  int32_t pSatMin;
154  int32_t Ni;
166 #if defined (__SE_FEAT_SPARSITY)
168  int8_t packetizeMode;
169 #endif
171 
177 typedef struct {
187  bool firstCall;
189  bool lastCall;
193  int32_t blockOffsetA;
196  MMALIB_enableDynamicRange_type enableDynamicRange;
199  MMALIB_initDynamicRange_type initDynamicRange;
201  MMALIB_quantMethod_type quantMethod;
203 
209 typedef struct {
219 
231 
259  MMALIB_kernelHandle handle,
260  const MMALIB_bufParams2D_t *src0_addr,
261  const MMALIB_bufParams2D_t *src1_addr,
262  const MMALIB_bufParams1D_t *src2_addr,
263  const MMALIB_bufParams1D_t *src3_addr,
264  const MMALIB_bufParams2D_t *dst_addr,
266 
290  MMALIB_kernelHandle handle,
291  const MMALIB_bufParams2D_t *src0_addr,
292  const MMALIB_bufParams2D_t *src1_addr,
293  const MMALIB_bufParams1D_t *src2_addr,
294  const MMALIB_bufParams2D_t *dst_addr,
296 
336  MMALIB_kernelHandle handle,
337  const void *src0,
338  const void *src1,
339  const void *src2,
340  const void *src3,
341  const void *src4,
342  void *dst,
345 
368  MMALIB_kernelHandle handle,
369  const void *src0,
370  const void *src1,
371  const void *src2,
372  const void *dst);
373 
374 #if defined(__SE_FEAT_SPARSITY)
376 MMALIB_CNN_fullyConnectedBias_ixX_ixX_oxX_packetizeWeights (
377  MMALIB_bufParams2D_t* restrict h_addr,
378 const void *restrict pWeights,
379  void *restrict pReorderWeights
380  );
381 #endif
382 
407  MMALIB_kernelHandle handle,
408  const MMALIB_bufParams2D_t *src0_addr,
409  const MMALIB_bufParams2D_t *src1_addr,
410  const MMALIB_bufParams2D_t *dst_addr,
411  uint64_t *idealCycles,
412  uint64_t *archCycles,
413  uint64_t *estCycles,
414  int32_t *caseNumber);
415 
418 #ifdef __cplusplus
419 }
420 #endif
421 
422 #endif /* MMALIB_CNN_FULLYCONNECTEDBIAS_IXX_IXX_OXX_H_ */
423 
424 /* ======================================================================== */
425 /* End of file: MMALIB_CNN_fullyConnectedBias_ixX_ixX_oxX.h */
426 /* ======================================================================== */
void MMALIB_CNN_fullyConnectedBias_ixX_ixX_oxX_perfEst(MMALIB_kernelHandle handle, const MMALIB_bufParams2D_t *src0_addr, const MMALIB_bufParams2D_t *src1_addr, const MMALIB_bufParams2D_t *dst_addr, uint64_t *idealCycles, uint64_t *archCycles, uint64_t *estCycles, int32_t *caseNumber)
This function estimates the cycles consumed for the kernel execution.
int32_t MMALIB_CNN_fullyConnectedBias_ixX_ixX_oxX_getHandleSize(MMALIB_CNN_fullyConnectedBias_ixX_ixX_oxX_InitArgs *pKerInitArgs)
This is a query function to return the size of internal handle.
MMALIB_CNN_FULLYCONNECTEDBIAS_IXX_IXX_OXX_STATUS_NAME
Enumeration of different error codes for the MMALIB_CNN_FULLYCONNECTED kernel.
MMALIB_STATUS MMALIB_CNN_fullyConnectedBias_ixX_ixX_oxX_init_checkParams(MMALIB_kernelHandle handle, const MMALIB_bufParams2D_t *src0_addr, const MMALIB_bufParams2D_t *src1_addr, const MMALIB_bufParams1D_t *src2_addr, const MMALIB_bufParams2D_t *dst_addr, const MMALIB_CNN_fullyConnectedBias_ixX_ixX_oxX_InitArgs *pKerInitArgs)
This function checks the parameters and should be called before kernel execution. It can be called on...
MMALIB_STATUS MMALIB_CNN_fullyConnectedBias_ixX_ixX_oxX_init(MMALIB_kernelHandle handle, const MMALIB_bufParams2D_t *src0_addr, const MMALIB_bufParams2D_t *src1_addr, const MMALIB_bufParams1D_t *src2_addr, const MMALIB_bufParams1D_t *src3_addr, const MMALIB_bufParams2D_t *dst_addr, const MMALIB_CNN_fullyConnectedBias_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_fullyConnectedBias_ixX_ixX_oxX_exec(MMALIB_kernelHandle handle, const void *src0, const void *src1, const void *src2, const void *src3, const void *src4, void *dst, const MMALIB_CNN_fullyConnectedBias_ixX_ixX_oxX_ExecInArgs *pKerExecInArgs, MMALIB_CNN_fullyConnectedBias_ixX_ixX_oxX_ExecOutArgs *pKerExecOutArgs)
This function is the main compute function, and performs matrix-matrix multiplication.
MMALIB_STATUS MMALIB_CNN_fullyConnectedBias_ixX_ixX_oxX_exec_checkParams(MMALIB_kernelHandle handle, const void *src0, const void *src1, const void *src2, const void *dst)
This function checks the parameters and should be called before kernel executuon. It can be called on...
@ MMALIB_CNN_FULLYCONNECTEDBIAS_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 kernel.
bool multiPassX
Flag signifies feature matrix cannot be fit in memory; therefore, we process the matrix in chunks.
int32_t blockOffsetA
Offset of A matrix when kernel matrix is broken down in multi-pass case to pick appropriate block of ...
MMALIB_enableDynamicRange_type enableDynamicRange
Flag indicating whether to enable dynamic range (min,max) calculation.
bool writeCBuffer
Flag signifies when to write accumulated value out Cbuffer.
bool lastCall
Flag signifies last call to kernel when compute is broken down.
MMALIB_quantMethod_type quantMethod
Specify quantization method.
bool firstCall
Flag signifies first call to kernel when compute is broken down.
MMALIB_initDynamicRange_type initDynamicRange
Flag indicating whether to reset dynamic range (min,max) calculation at beginning of compute.
bool multiPassH
Flag signifies kernel matrix cannot be fit in memory; therefore, we process the matrix in chunks.
This structure holds all the runtime output parameters for the kernel.
int64_t dynamicRangeMin
Minimum computed value, controlled with MMALIB_CNN_fullyConnectedBias_ixX_ixX_oxX_ExecInArgs::initDyn...
int64_t dynamicRangeMax
Minimum computed value, controlled with MMALIB_CNN_fullyConnectedBias_ixX_ixX_oxX_ExecInArgs::initDyn...
void * bufCAccum_cn
Buffer pointer to hold partially accumulated values in multi-pass case.
int8_t funcStyle
Variant of the function refer to MMALIB_FUNCTION_STYLE
bool multiPassX
flag signifies feature matrix cannot be fit in memory; therefore, compute is broken down by processi...
bool multiPassH
flag signifies kernel matrix cannot be fit in memory; therefore, compute is broken down by processin...
A structure for a 1 dimensional buffer descriptor.
A structure for a 2 dimensional buffer descriptor.