DSPLIB User Guide
DSPLIB_qrd_solver.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_qrd_solver_priv.h"
24 
26 {
27  int32_t privBufSize = sizeof(DSPLIB_qrd_solver_PrivArgs);
28 
29  DSPLIB_DEBUGPRINTFN(0, "privBufSize: %d\n", privBufSize);
30 
31  return privBufSize;
32 }
33 
35  DSPLIB_bufParams2D_t *bufParamsQ,
36  DSPLIB_bufParams2D_t *bufParamsR,
37  DSPLIB_bufParams1D_t *bufParamsB,
38  DSPLIB_bufParams1D_t *bufParamsY,
39  DSPLIB_bufParams1D_t *bufParamsX,
40  const DSPLIB_qrdSolverInitArgs *pKerInitArgs)
41 {
42  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering Function");
43 
45 
46  if (handle == NULL) {
47  status = DSPLIB_ERR_NULL_POINTER;
48  }
49 
50  if (status == DSPLIB_SUCCESS) {
51 
52  /* Condition change */
53  if (((bufParamsQ->data_type != DSPLIB_FLOAT32) && (bufParamsQ->data_type != DSPLIB_FLOAT64)) ||
54  ((bufParamsR->data_type != DSPLIB_FLOAT32) && (bufParamsR->data_type != DSPLIB_FLOAT64))) {
55  status = DSPLIB_ERR_INVALID_TYPE;
56  }
57  else if (bufParamsQ->data_type != bufParamsX->data_type || bufParamsR->data_type != bufParamsB->data_type ||
58  bufParamsB->data_type != bufParamsX->data_type) {
59  status = DSPLIB_ERR_INVALID_TYPE;
60  }
61  else if (bufParamsQ->dim_x != bufParamsQ->dim_y || bufParamsR->dim_x != bufParamsR->dim_y ) {
63  }
64 
65  else {
66  /* Do nothing */
67  }
68  }
69 
70  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
71 
72  return status;
73 }
74 
76  void *restrict pQ,
77  void *restrict pR,
78  void *restrict pB,
79  void *restrict pY,
80  void *restrict pX,
81  void *restrict pD,
82  void *restrict pR1)
83 {
84  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
85 
86  DSPLIB_STATUS status;
87 
88  if ((pQ == NULL) || (pR == NULL) || (pB == NULL) || (pY == NULL) || (pX == NULL) || (pD == NULL) || (pR1 == NULL)) {
89  status = DSPLIB_ERR_NULL_POINTER;
90  }
91  else {
92  status = DSPLIB_SUCCESS;
93  }
94  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
95 
96  return status;
97 }
98 
100  DSPLIB_bufParams2D_t *bufParamsQ,
101  DSPLIB_bufParams2D_t *bufParamsR,
102  DSPLIB_bufParams1D_t *bufParamsB,
103  DSPLIB_bufParams1D_t *bufParamsY,
104  DSPLIB_bufParams1D_t *bufParamsX,
105  const DSPLIB_qrdSolverInitArgs *pKerInitArgs)
106 {
107  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
108 
109  DSPLIB_STATUS status = DSPLIB_SUCCESS;
110  DSPLIB_qrd_solver_PrivArgs *pKerPrivArgs = (DSPLIB_qrd_solver_PrivArgs *) handle;
111 
112  pKerPrivArgs->widthR = bufParamsR->dim_x;
113  pKerPrivArgs->heightR = bufParamsR->dim_y;
114  pKerPrivArgs->strideQ = bufParamsQ->stride_y;
115  pKerPrivArgs->strideR = bufParamsR->stride_y;
116 
117  DSPLIB_DEBUGPRINTFN(0, "pKerInitArgs->funcStyle: %d bufParamsX->data_type: %d\n", pKerInitArgs->funcStyle,
118  bufParamsX->data_type);
119 
120  if (pKerInitArgs->funcStyle == DSPLIB_FUNCTION_NATC) {
121  if ((bufParamsQ->data_type == DSPLIB_FLOAT32) && (bufParamsR->data_type == DSPLIB_FLOAT32) &&
122  (bufParamsX->data_type == DSPLIB_FLOAT32)) {
124  status = DSPLIB_qrd_solver_init_cn<float>(handle, bufParamsQ, bufParamsR, bufParamsB, bufParamsY, bufParamsX,
125  pKerInitArgs);
126  }
127  else if ((bufParamsQ->data_type == DSPLIB_FLOAT64) && (bufParamsR->data_type == DSPLIB_FLOAT64) &&
128  (bufParamsX->data_type == DSPLIB_FLOAT64)) {
130  status = DSPLIB_qrd_solver_init_cn<double>(handle, bufParamsQ, bufParamsR, bufParamsB, bufParamsY, bufParamsX,
131  pKerInitArgs);
132  }
133 
134  else {
135  status = DSPLIB_ERR_INVALID_TYPE;
136  }
137  }
138  else {
139  if ((bufParamsQ->data_type == DSPLIB_FLOAT32) && (bufParamsR->data_type == DSPLIB_FLOAT32) &&
140  (bufParamsX->data_type == DSPLIB_FLOAT32)) {
142  status = DSPLIB_qrd_solver_init_ci<float>(handle, bufParamsQ, bufParamsR, bufParamsB, bufParamsY, bufParamsX,
143  pKerInitArgs);
144  }
145  else if ((bufParamsQ->data_type == DSPLIB_FLOAT64) && (bufParamsR->data_type == DSPLIB_FLOAT64) &&
146  (bufParamsX->data_type == DSPLIB_FLOAT64)) {
148  status = DSPLIB_qrd_solver_init_ci<double>(handle, bufParamsQ, bufParamsR, bufParamsB, bufParamsY, bufParamsX,
149  pKerInitArgs);
150  }
151  else {
152  status = DSPLIB_ERR_INVALID_TYPE;
153  }
154  }
155  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
156 
157  return status;
158 
159 }
160 
162  void *restrict pQ,
163  void *restrict pR,
164  void *restrict pB,
165  void *restrict pY,
166  void *restrict pX,
167  void *restrict pD,
168  void *restrict pR1)
169 {
170  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
171 
172  DSPLIB_STATUS status;
173 
174  DSPLIB_qrd_solver_PrivArgs *pKerPrivArgs = (DSPLIB_qrd_solver_PrivArgs *) handle;
175 
176  DSPLIB_DEBUGPRINTFN(0, "widthR: %d heightR: %d strideQ: %d strideR: %d\n", pKerPrivArgs->widthR,
177  pKerPrivArgs->heightR, pKerPrivArgs->strideQ, pKerPrivArgs->strideR);
178 
179  status = pKerPrivArgs->execute(handle, pQ, pR, pB, pY, pX, pD, pR1);
180 
181  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
182 
183  return status;
184 }
185 /* ======================================================================== */
186 /* End of file: DSPLIB_qrd_solver.cpp */
187 /* ======================================================================== */
template DSPLIB_STATUS DSPLIB_qrd_solver_init_ci< float >(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsQ, DSPLIB_bufParams2D_t *bufParamsR, DSPLIB_bufParams1D_t *bufParamsB, DSPLIB_bufParams1D_t *bufParamsY, DSPLIB_bufParams1D_t *bufParamsX, const DSPLIB_qrdSolverInitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_qrd_solver_init_ci< double >(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsQ, DSPLIB_bufParams2D_t *bufParamsR, DSPLIB_bufParams1D_t *bufParamsB, DSPLIB_bufParams1D_t *bufParamsY, DSPLIB_bufParams1D_t *bufParamsX, const DSPLIB_qrdSolverInitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_qrd_solver_exec_ci< float >(DSPLIB_kernelHandle handle, void *restrict pQ, void *restrict pR, void *restrict pB, void *restrict pY, void *restrict pX, void *restrict pD, void *restrict pR1)
template DSPLIB_STATUS DSPLIB_qrd_solver_exec_ci< double >(DSPLIB_kernelHandle handle, void *restrict pQ, void *restrict pR, void *restrict pB, void *restrict pY, void *restrict pX, void *restrict pD, void *restrict pR1)
template DSPLIB_STATUS DSPLIB_qrd_solver_exec_cn< double >(DSPLIB_kernelHandle handle, void *restrict pQ, void *restrict pR, void *restrict pB, void *restrict pY, void *restrict pX, void *restrict pD, void *restrict pR1)
template DSPLIB_STATUS DSPLIB_qrd_solver_init_cn< double >(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsQ, DSPLIB_bufParams2D_t *bufParamsR, DSPLIB_bufParams1D_t *bufParamsB, DSPLIB_bufParams1D_t *bufParamsY, DSPLIB_bufParams1D_t *bufParamsX, const DSPLIB_qrdSolverInitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_qrd_solver_init_cn< float >(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsQ, DSPLIB_bufParams2D_t *bufParamsR, DSPLIB_bufParams1D_t *bufParamsB, DSPLIB_bufParams1D_t *bufParamsY, DSPLIB_bufParams1D_t *bufParamsX, const DSPLIB_qrdSolverInitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_qrd_solver_exec_cn< float >(DSPLIB_kernelHandle handle, void *restrict pQ, void *restrict pR, void *restrict pB, void *restrict pY, void *restrict pX, void *restrict pD, void *restrict pR1)
Header file for kernel's internal use. For the kernel's interface, please see DSPLIB_qrd_solver.
#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_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_qrd_solver_exec(DSPLIB_kernelHandle handle, void *restrict pQ, void *restrict pR, void *restrict pB, void *restrict pY, void *restrict pX, void *restrict pD, void *restrict pR1)
This function is the main kernel compute function.
DSPLIB_STATUS DSPLIB_qrd_solver_exec_checkParams(DSPLIB_kernelHandle handle, void *restrict pQ, void *restrict pR, void *restrict pB, void *restrict pY, void *restrict pX, void *restrict pD, void *restrict pR1)
This function checks the validity of the parameters passed to DSPLIB_qrd_solver_exec function....
DSPLIB_STATUS DSPLIB_qrd_solver_init_checkParams(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsQ, DSPLIB_bufParams2D_t *bufParamsR, DSPLIB_bufParams1D_t *bufParamsB, DSPLIB_bufParams1D_t *bufParamsY, DSPLIB_bufParams1D_t *bufParamsX, const DSPLIB_qrdSolverInitArgs *pKerInitArgs)
This function checks the validity of the parameters passed to DSPLIB_qrd_solver_init function....
int32_t DSPLIB_qrd_solver_getHandleSize(DSPLIB_qrdSolverInitArgs *pKerInitArgs)
This is a query function to calculate the size of internal handle.
DSPLIB_STATUS DSPLIB_qrd_solver_init(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsQ, DSPLIB_bufParams2D_t *bufParamsR, DSPLIB_bufParams1D_t *bufParamsB, DSPLIB_bufParams1D_t *bufParamsY, DSPLIB_bufParams1D_t *bufParamsX, const DSPLIB_qrdSolverInitArgs *pKerInitArgs)
This function should be called before the DSPLIB_qrd_solver_exec function is called....
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 strideR
Stride between rows of R output data matrix
int32_t strideQ
Stride between rows of Q output data matrix
pFxnDSPLIB_qrd_solver_exec execute
Function pointer to point to the right execution variant between DSPLIB_qrd_solver_exec_cn and DSPLIB...
uint32_t heightR
Height of input data matrix
uint32_t widthR
Size of input buffer for different batches DSPLIB_qrd_solver_init that will be retrieved and used by ...