DSPLIB User Guide
DSPLIB_lud_sol.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  * *
3  * module name :DSPLIB *
4  * *
5  * module descripton :Digital Signal Processing 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 
23 #include "DSPLIB_lud_sol_priv.h"
24 
26 {
27  int32_t privBufSize = sizeof(DSPLIB_lud_sol_PrivArgs);
28 
29  DSPLIB_DEBUGPRINTFN(0, "privBufSize: %d\n", privBufSize);
30 
31  return privBufSize;
32 }
33 
35  const DSPLIB_bufParams2D_t * bufParamsP,
36  const DSPLIB_bufParams2D_t * bufParamsL,
37  const DSPLIB_bufParams2D_t * bufParamsU,
38  const DSPLIB_bufParams1D_t * bufParamsB,
39  const DSPLIB_bufParams1D_t * bufParamsX,
40  const DSPLIB_bufParams2D_t * bufParamsVecScratch,
41  const DSPLIB_bufParams2D_t * bufParamsScratchTrans,
42  const DSPLIB_lud_solInitArgs *pKerInitArgs)
43 {
44  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering Function");
45 
47 
48  if (handle == NULL) {
49  status = DSPLIB_ERR_NULL_POINTER;
50  }
51 
52  if (status == DSPLIB_SUCCESS) {
53 
54  /* Condition change */
55  if (((bufParamsL->data_type != DSPLIB_FLOAT32) && (bufParamsL->data_type != DSPLIB_FLOAT64)) ||
56  ((bufParamsU->data_type != DSPLIB_FLOAT32) && (bufParamsU->data_type != DSPLIB_FLOAT64)) ||
57  ((bufParamsP->data_type != DSPLIB_UINT16))) {
58  status = DSPLIB_ERR_INVALID_TYPE;
59  }
60  else if ((bufParamsL->data_type != bufParamsX->data_type)) {
61  status = DSPLIB_ERR_INVALID_TYPE;
62  }
63  else if (bufParamsL->dim_x != bufParamsL->dim_y) {
65  }
66  else if (bufParamsU->dim_x != bufParamsU->dim_y) {
68  }
69  else {
70  /* Do nothing */
71  }
72  }
73 
74  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
75 
76  return status;
77 }
78 
80  void *restrict pP,
81  void *restrict pL,
82  void *restrict pU,
83  void *restrict pB,
84  void *restrict pX,
85  void *restrict pVecScratch,
86  void *restrict pScratchTrans)
87 {
88  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
89 
90  DSPLIB_STATUS status;
91 
92  if ((pP == NULL) || (pL == NULL) || (pU == NULL) || (pB == NULL) || (pX == NULL) || (pVecScratch == NULL) ||
93  (pScratchTrans == NULL)) {
94  status = DSPLIB_ERR_NULL_POINTER;
95  }
96  else {
97  status = DSPLIB_SUCCESS;
98  }
99 
100  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
101 
102  return status;
103 }
104 
106  const DSPLIB_bufParams2D_t * bufParamsP,
107  const DSPLIB_bufParams2D_t * bufParamsL,
108  const DSPLIB_bufParams2D_t * bufParamsU,
109  const DSPLIB_bufParams1D_t * bufParamsB,
110  const DSPLIB_bufParams1D_t * bufParamsX,
111  const DSPLIB_bufParams2D_t * bufParamsVecScratch,
112  const DSPLIB_bufParams2D_t * bufParamsScratchTrans,
113  const DSPLIB_lud_solInitArgs *pKerInitArgs)
114 {
115  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
116 
117  DSPLIB_STATUS status = DSPLIB_SUCCESS;
118  DSPLIB_lud_sol_PrivArgs *pKerPrivArgs = (DSPLIB_lud_sol_PrivArgs *) handle;
119 
120  pKerPrivArgs->order = bufParamsL->dim_x;
121  pKerPrivArgs->strideOrder = bufParamsL->stride_y;
122  pKerPrivArgs->strideP = bufParamsP->stride_y;
123  pKerPrivArgs->strideVec = bufParamsVecScratch->stride_y;
124 
125  DSPLIB_DEBUGPRINTFN(0, "pKerInitArgs->funcStyle: %d bufParamsL->data_type: %d\n", pKerInitArgs->funcStyle,
126  bufParamsL->data_type);
127 
128  if (pKerInitArgs->funcStyle == DSPLIB_FUNCTION_NATC) {
129  if (bufParamsL->data_type == DSPLIB_FLOAT32) {
130  pKerPrivArgs->execute = DSPLIB_lud_sol_exec_cn<float>;
131  status = DSPLIB_lud_sol_init_cn(handle, bufParamsP, bufParamsL, bufParamsU, bufParamsB, bufParamsX,
132  bufParamsVecScratch, bufParamsScratchTrans, pKerInitArgs);
133  }
134  else if (bufParamsL->data_type == DSPLIB_FLOAT64) {
135  pKerPrivArgs->execute = DSPLIB_lud_sol_exec_cn<double>;
136  status = DSPLIB_lud_sol_init_cn(handle, bufParamsP, bufParamsL, bufParamsU, bufParamsB, bufParamsX,
137  bufParamsVecScratch, bufParamsScratchTrans, pKerInitArgs);
138  }
139  else {
140  status = DSPLIB_ERR_INVALID_TYPE;
141  }
142  }
143  else {
144  if (bufParamsL->data_type == DSPLIB_FLOAT32) {
145  pKerPrivArgs->execute = DSPLIB_lud_sol_exec_ci<float>;
146  status = DSPLIB_lud_sol_init_ci<float>(handle, bufParamsP, bufParamsL, bufParamsU, bufParamsB, bufParamsX,
147  bufParamsVecScratch, bufParamsScratchTrans, pKerInitArgs);
148  }
149  else if (bufParamsL->data_type == DSPLIB_FLOAT64) {
150  pKerPrivArgs->execute = DSPLIB_lud_sol_exec_ci<double>;
151  status = DSPLIB_lud_sol_init_ci<double>(handle, bufParamsP, bufParamsL, bufParamsU, bufParamsB, bufParamsX,
152  bufParamsVecScratch, bufParamsScratchTrans, pKerInitArgs);
153  }
154  else {
155  status = DSPLIB_ERR_INVALID_TYPE;
156  }
157  }
158  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
159 
160  return status;
161 }
162 
164  void *restrict pP,
165  void *restrict pL,
166  void *restrict pU,
167  void *restrict pB,
168  void *restrict pX,
169  void *restrict pVecScratch,
170  void *restrict pScratchTemp)
171 {
172  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
173 
174  DSPLIB_STATUS status;
175 
176  DSPLIB_lud_sol_PrivArgs *pKerPrivArgs = (DSPLIB_lud_sol_PrivArgs *) handle;
177 
178  DSPLIB_DEBUGPRINTFN(0, "order: %d\n", pKerPrivArgs->order);
179 
180  status = pKerPrivArgs->execute(handle, pP, pL, pU, pB, pX, pVecScratch, pScratchTemp);
181 
182  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
183 
184  return status;
185 }
186 
187 /* ======================================================================== */
188 /* End of file: DSPLIB_lud_sol.cpp */
189 /* ======================================================================== */
template DSPLIB_STATUS DSPLIB_lud_sol_exec_ci< float >(DSPLIB_kernelHandle handle, void *restrict pP, void *restrict pL, void *restrict pU, void *restrict pB, void *restrict pX, void *restrict pVecScratch, void *restrict pScratchTrans)
template DSPLIB_STATUS DSPLIB_lud_sol_init_ci< float >(DSPLIB_kernelHandle handle, const DSPLIB_bufParams2D_t *bufParamsP, const DSPLIB_bufParams2D_t *bufParamsL, const DSPLIB_bufParams2D_t *bufParamsU, const DSPLIB_bufParams1D_t *bufParamsB, const DSPLIB_bufParams1D_t *bufParamsX, const DSPLIB_bufParams2D_t *bufParamsVecScratch, const DSPLIB_bufParams2D_t *bufParamsScratchTrans, const DSPLIB_lud_solInitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_lud_sol_exec_ci< double >(DSPLIB_kernelHandle handle, void *restrict pP, void *restrict pL, void *restrict pU, void *restrict pB, void *restrict pX, void *restrict pVecScratch, void *restrict pScratchTrans)
template DSPLIB_STATUS DSPLIB_lud_sol_init_ci< double >(DSPLIB_kernelHandle handle, const DSPLIB_bufParams2D_t *bufParamsP, const DSPLIB_bufParams2D_t *bufParamsL, const DSPLIB_bufParams2D_t *bufParamsU, const DSPLIB_bufParams1D_t *bufParamsB, const DSPLIB_bufParams1D_t *bufParamsX, const DSPLIB_bufParams2D_t *bufParamsVecScratch, const DSPLIB_bufParams2D_t *bufParamsScratchTrans, const DSPLIB_lud_solInitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_lud_sol_exec_cn< float >(DSPLIB_kernelHandle handle, void *restrict pP, void *restrict pL, void *restrict pU, void *restrict pB, void *restrict pX, void *restrict pVecScratch, void *restrict pScratchTrans)
DSPLIB_STATUS DSPLIB_lud_sol_init_cn(DSPLIB_kernelHandle handle, const DSPLIB_bufParams2D_t *bufParamsP, const DSPLIB_bufParams2D_t *bufParamsL, const DSPLIB_bufParams2D_t *bufParamsU, const DSPLIB_bufParams1D_t *bufParamsB, const DSPLIB_bufParams1D_t *bufParamsX, const DSPLIB_bufParams2D_t *bufParamsVecScratch, const DSPLIB_bufParams2D_t *bufParamsScratchTrans, const DSPLIB_lud_solInitArgs *pKerInitArgs)
This function is the initialization function for the natural C implementation of the kernel....
template DSPLIB_STATUS DSPLIB_lud_sol_exec_cn< double >(DSPLIB_kernelHandle handle, void *restrict pP, void *restrict pL, void *restrict pU, void *restrict pB, void *restrict pX, void *restrict pVecScratch, void *restrict pScratchTrans)
Header file for kernel's internal use. For the kernel's interface, please see DSPLIB_lud_sol.
#define DSPLIB_DEBUGPRINTFN(N, fmt,...)
Definition: DSPLIB_types.h:83
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
@ DSPLIB_FUNCTION_NATC
Definition: DSPLIB_types.h:176
@ DSPLIB_UINT16
@ DSPLIB_FLOAT32
@ DSPLIB_FLOAT64
@ DSPLIB_ERR_INVALID_DIMENSION
Definition: DSPLIB_types.h:156
@ DSPLIB_SUCCESS
Definition: DSPLIB_types.h:152
@ DSPLIB_ERR_NULL_POINTER
Definition: DSPLIB_types.h:157
@ DSPLIB_ERR_INVALID_TYPE
Definition: DSPLIB_types.h:155
DSPLIB_STATUS DSPLIB_lud_sol_exec(DSPLIB_kernelHandle handle, void *restrict pP, void *restrict pL, void *restrict pU, void *restrict pB, void *restrict pX, void *restrict pVecScratch, void *restrict pScratchTemp)
This function is the main kernel compute function.
DSPLIB_STATUS DSPLIB_lud_sol_init(DSPLIB_kernelHandle handle, const DSPLIB_bufParams2D_t *bufParamsP, const DSPLIB_bufParams2D_t *bufParamsL, const DSPLIB_bufParams2D_t *bufParamsU, const DSPLIB_bufParams1D_t *bufParamsB, const DSPLIB_bufParams1D_t *bufParamsX, const DSPLIB_bufParams2D_t *bufParamsVecScratch, const DSPLIB_bufParams2D_t *bufParamsScratchTrans, const DSPLIB_lud_solInitArgs *pKerInitArgs)
This function should be called before the DSPLIB_lud_sol_exec function is called. This function takes...
int32_t DSPLIB_lud_sol_getHandleSize(DSPLIB_lud_solInitArgs *pKerInitArgs)
This is a query function to calculate the size of internal handle.
DSPLIB_STATUS DSPLIB_lud_sol_init_checkParams(DSPLIB_kernelHandle handle, const DSPLIB_bufParams2D_t *bufParamsP, const DSPLIB_bufParams2D_t *bufParamsL, const DSPLIB_bufParams2D_t *bufParamsU, const DSPLIB_bufParams1D_t *bufParamsB, const DSPLIB_bufParams1D_t *bufParamsX, const DSPLIB_bufParams2D_t *bufParamsVecScratch, const DSPLIB_bufParams2D_t *bufParamsScratchTrans, const DSPLIB_lud_solInitArgs *pKerInitArgs)
This function checks the validity of the parameters passed to DSPLIB_lud_sol_init function....
DSPLIB_STATUS DSPLIB_lud_sol_exec_checkParams(DSPLIB_kernelHandle handle, void *restrict pP, void *restrict pL, void *restrict pU, void *restrict pB, void *restrict pX, void *restrict pVecScratch, void *restrict pScratchTrans)
This function checks the validity of the parameters passed to DSPLIB_lud_sol_exec function....
A structure for a 1 dimensional buffer descriptor.
uint32_t data_type
Values are of type DSPLIB_data_type_e.
A structure for a 2 dimensional buffer descriptor.
uint32_t data_type
Values are of type DSPLIB_data_type_e.
int32_t stride_y
Stride in Y dimension in bytes.
uint32_t dim_x
Width of buffer in X dimension in elements.
uint32_t dim_y
Height of buffer in Y dimension in elements.
Structure containing the parameters to initialize the kernel.
int8_t funcStyle
Variant of the function refer to DSPLIB_FUNCTION_STYLE
Structure that is reserved for internal use by the kernel.
int32_t strideOrder
Stride between rows of input and output data matrix
pFxnDSPLIB_lud_sol_exec execute
Function pointer to point to the right execution variant between DSPLIB_lud_sol_exec_cn and DSPLIB_lu...
int32_t order
Size of input buffer for different batches DSPLIB_lud_sol_init that will be retrieved and used by DSP...
int32_t strideP
Stride between rows of input data matrix P
int32_t strideVec
Stride between rows of scratch data matrix