DSPLIB User Guide
DSPLIB_matMul_fixed_priv.h
Go to the documentation of this file.
1 /******************************************************************************
2  * *
3  * module name :DSPLIB *
4  * *
5  * module descripton :Matrix Multiply Accelerator Library module for C7x+MMA *
6  * *
7  * Copyright (C) 2017-2018 Texas Instruments Incorporated - https://www.ti.com/ *
8  * ALL RIGHTS RESERVED *
9  * *
10  ******************************************************************************/
11 
12 /********************************************************************************
13  * @file DSPLIB_matMul_fixed_priv.h
14  *
15  * @brief File to hold private parameter of function DSPLIB_matMul_fixed
16  *
17  * @version 0.1 - Mar 2022 : Initial Version
18  *
19  ********************************************************************************/
20 
21 #ifndef DSPLIB_MATMUL_FIXED_IXX_IXX_OXX_PRIV_H_
22 #define DSPLIB_MATMUL_FIXED_IXX_IXX_OXX_PRIV_H_
23 
24 #include "../common/DSPLIB_utility.h"
25 #include "DSPLIB_matMul_fixed.h"
26 
39 #define DSPLIB_MATMUL_FIXED_IXX_IXX_OXX_PBLOCK_SIZE (3 * SE_PARAM_SIZE)
40 #define DSPLIB_MATMAPY_FXD_I8S_O8S int8_t, c7x::int_vec
41 #define DSPLIB_MATMAPY_FXD_I16S_O16S int16_t, c7x::long_vec
48 /* #define DSPLIB_matMul_fixed_SE_UNROLL_FACTOR (8) */
49 
56  void *restrict pIn1,
57  void *restrict pIn2,
58  void *restrict pOut);
59 
91 template <typename dataTypeIn, typename dataTypeOut>
93  const DSPLIB_bufParams2D_t *bufParamsIn0,
94  const DSPLIB_bufParams2D_t *bufParamsIn1,
95  const DSPLIB_bufParams2D_t *bufParamsOut,
96  const DSPLIB_matMul_fixed_InitArgs *pKerInitArgs);
97 
124 template <typename dataTypeIn, typename dataTypeOut>
126 DSPLIB_matMul_fixed_exec_ci(DSPLIB_kernelHandle handle, void *restrict pIn1, void *restrict pIn2, void *restrict pOut);
127 
147 template <typename dataType>
148 extern DSPLIB_STATUS
149 DSPLIB_matMul_fixed_exec_cn(DSPLIB_kernelHandle handle, void *restrict pIn1, void *restrict pIn2, void *restrict pOut);
150 
154 typedef struct {
159  int32_t M;
160  int32_t N;
161  int32_t K;
162  int32_t qs;
166  int32_t MBlocks;
167  int32_t KBlocks;
168  int32_t NBlocks;
170 
172 
194  DSPLIB_bufParams2D_t *bufParamsIn0,
195  DSPLIB_bufParams2D_t *bufParamsIn1,
196  DSPLIB_bufParams2D_t *bufParamsOut);
197 
198 template <typename dataTypeIn, typename dataTypeOut>
200  const DSPLIB_bufParams2D_t *bufParamsIn0,
201  const DSPLIB_bufParams2D_t *bufParamsIn1,
202  const DSPLIB_bufParams2D_t *bufParamsOut,
203  const DSPLIB_matMul_fixed_InitArgs *pKerInitArgs);
204 
205 template <typename dataTypeIn, typename dataTypeOut>
207  void *restrict pIn0,
208  void *restrict pIn1,
209  void *restrict pOut);
210 
211 template <typename dataType> void printStridedMat(char *inStr, int Nrows, int colStride, dataType *inMat)
212 {
213  printf("Nrwo: %d, colStride: %d\n", Nrows, colStride);
214  printf("%s:\n", inStr);
215  dataType *printMat = inMat;
216  for (int i = 0; i < Nrows; i++) {
217  for (int j = 0; j < colStride; j++) {
218  printf("%8d", (int16_t) *printMat++);
219  }
220  printf("\n");
221  }
222  printf("\n");
223 }
224 template void printStridedMat<int16_t>(char *inStr, int Nrows, int colStride, int16_t *inMat);
225 template void printStridedMat<int8_t>(char *inStr, int Nrows, int colStride, int8_t *inMat);
226 // template void printStridedMat<float>(char *inStr, int Nrows, int colStride, float *inMat);
227 // template void printStridedMat<double>(char *inStr, int Nrows, int colStride, double *inMat);
228 
229 template <typename dataType>
231  const DSPLIB_bufParams2D_t *bufParamsIn0,
232  const DSPLIB_bufParams2D_t *bufParamsIn1,
233  const DSPLIB_bufParams2D_t *bufParamsOut,
234  const DSPLIB_matMul_fixed_InitArgs *pKerInitArgs);
235 
236 template <typename dataTypeIn, typename dataTypeOut>
238  void *restrict pIn0,
239  void *restrict pIn1,
240  void *restrict pOut);
241 
242 template <typename dataType>
244  const DSPLIB_bufParams2D_t *bufParamsIn0,
245  const DSPLIB_bufParams2D_t *bufParamsIn1,
246  const DSPLIB_bufParams2D_t *bufParamsOut,
247  const DSPLIB_matMul_fixed_InitArgs *pKerInitArgs);
248 
249 template <typename dataType>
251  void *restrict pIn0,
252  void *restrict pIn1,
253  void *restrict pOut);
254 
255 #endif /* DSPLIB_MATMUL_FIXED_IXX_IXX_OXX_PRIV_H_ */
256 
257 /* ======================================================================== */
258 /* End of file: DSPLIB_matMul_fixed.h */
259 /* ======================================================================== */
#define DSPLIB_MATMUL_FIXED_IXX_IXX_OXX_PBLOCK_SIZE
Macro to define the size of bufPblock array of DSPLIB_matMul_fixed_PrivArgs structure.
template void printStridedMat< int8_t >(char *inStr, int Nrows, int colStride, int8_t *inMat)
DSPLIB_STATUS DSPLIB_matMul_fixed_generic_init_ci(DSPLIB_kernelHandle handle, const DSPLIB_bufParams2D_t *bufParamsIn0, const DSPLIB_bufParams2D_t *bufParamsIn1, const DSPLIB_bufParams2D_t *bufParamsOut, const DSPLIB_matMul_fixed_InitArgs *pKerInitArgs)
DSPLIB_STATUS DSPLIB_matMul_fixed_exec_ci(DSPLIB_kernelHandle handle, void *restrict pIn1, void *restrict pIn2, void *restrict pOut)
This function is the main execution function for the C7x implementation of the kernel....
DSPLIB_STATUS DSPLIB_matMul_fixed_generic_exec_ci(DSPLIB_kernelHandle handle, void *restrict pIn0, void *restrict pIn1, void *restrict pOut)
DSPLIB_STATUS DSPLIB_matMul_fixed_N_unroll_init_ci(DSPLIB_kernelHandle handle, const DSPLIB_bufParams2D_t *bufParamsIn0, const DSPLIB_bufParams2D_t *bufParamsIn1, const DSPLIB_bufParams2D_t *bufParamsOut, const DSPLIB_matMul_fixed_InitArgs *pKerInitArgs)
DSPLIB_STATUS DSPLIB_matMul_fixed_exec_cn(DSPLIB_kernelHandle handle, void *restrict pIn1, void *restrict pIn2, void *restrict pOut)
This function is the main execution function for the natural C implementation of the kernel....
template void printStridedMat< int16_t >(char *inStr, int Nrows, int colStride, int16_t *inMat)
DSPLIB_STATUS DSPLIB_matMul_fixed_init_cn(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsIn0, DSPLIB_bufParams2D_t *bufParamsIn1, DSPLIB_bufParams2D_t *bufParamsOut)
This function is the initialization function for the natural C implementation of the kernel....
void printStridedMat(char *inStr, int Nrows, int colStride, dataType *inMat)
DSPLIB_STATUS(* pFxnDSPLIB_matMul_fixed_exec)(DSPLIB_kernelHandle handle, void *restrict pIn1, void *restrict pIn2, void *restrict pOut)
Macro to define the size of bufPblock array of DSPLIB_matMul_fixed_PrivArgs structure.
DSPLIB_STATUS DSPLIB_matMul_fixed_N_unroll_exec_ci(DSPLIB_kernelHandle handle, void *restrict pIn0, void *restrict pIn1, void *restrict pOut)
DSPLIB_STATUS DSPLIB_matMul_fixed_init_ci(DSPLIB_kernelHandle handle, const DSPLIB_bufParams2D_t *bufParamsIn0, const DSPLIB_bufParams2D_t *bufParamsIn1, const DSPLIB_bufParams2D_t *bufParamsOut, const DSPLIB_matMul_fixed_InitArgs *pKerInitArgs)
This function is the initialization function for the C7x implementation of the kernel....
DSPLIB_STATUS_NAME DSPLIB_STATUS
Return value for DSPLIB functions.
Definition: DSPLIB_types.h:170
DSPLIB_STATUS_NAME
The enumeration of all status codes.
Definition: DSPLIB_types.h:151
void * DSPLIB_kernelHandle
Handle type for DSPLIB operations.
Definition: DSPLIB_types.h:172
A structure for a 2 dimensional buffer descriptor.
Structure containing the parameters to initialize the kernel.
Structure that is reserved for internal use by the kernel.
pFxnDSPLIB_matMul_fixed_exec execute
Function pointer to point to the right execution variant between DSPLIB_matMul_fixed_exec_cn and DSPL...