DSPLIB User Guide
DSPLIB_cholesky_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 
24 
26 {
27  int32_t privBufSize = sizeof(DSPLIB_cholesky_solver_PrivArgs);
28  return privBufSize;
29 }
30 
32  DSPLIB_bufParams2D_t *bufParamsU,
33  DSPLIB_bufParams2D_t *bufParamsScratch,
34  DSPLIB_bufParams1D_t *bufParamsY,
35  DSPLIB_bufParams1D_t *bufParamsB,
36  DSPLIB_bufParams1D_t *bufParamsX,
37  DSPLIB_bufParams1D_t *bufParamsDiv,
38  const DSPLIB_cholesky_solver_InitArgs *pKerInitArgs)
39 {
41 
42  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
43  if (handle == NULL) {
44  status = DSPLIB_ERR_NULL_POINTER;
45  }
46 
47  if (status == DSPLIB_SUCCESS) {
48  if ((bufParamsU->data_type != DSPLIB_FLOAT32) && (bufParamsU->data_type != DSPLIB_FLOAT64)) {
49  status = DSPLIB_ERR_INVALID_TYPE;
50  DSPLIB_DEBUGPRINTFN(0, "status: %d\n", status);
51  }
52  else if ((bufParamsY->data_type != bufParamsU->data_type) || (bufParamsB->data_type != bufParamsU->data_type) ||
53  (bufParamsX->data_type != bufParamsU->data_type) || (bufParamsDiv->data_type != bufParamsU->data_type)) {
54  status = DSPLIB_ERR_INVALID_TYPE;
55  DSPLIB_DEBUGPRINTFN(0, "status: %d\n", status);
56  }
57  else {
58  /* Nothing to do here */
59  }
60  }
61 
62  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
63  return status;
64 }
65 
67  DSPLIB_bufParams2D_t *bufParamsU,
68  DSPLIB_bufParams2D_t *bufParamsScratch,
69  DSPLIB_bufParams1D_t *bufParamsY,
70  DSPLIB_bufParams1D_t *bufParamsB,
71  DSPLIB_bufParams1D_t *bufParamsX,
72  DSPLIB_bufParams1D_t *bufParamsDiv,
73  const DSPLIB_cholesky_solver_InitArgs *pKerInitArgs)
74 {
75 
76  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
77 
80 
81  pKerPrivArgs->order = pKerInitArgs->order;
82  pKerPrivArgs->stride = pKerInitArgs->stride;
83  pKerPrivArgs->strideCn = pKerInitArgs->strideCn;
84 
85  DSPLIB_DEBUGPRINTFN(0, "pKerPrivArgs->order: %d pKerPrivArgs->stride: %d pKerPrivArgs->strideCn: %d\n",
86  pKerPrivArgs->order, pKerPrivArgs->stride, pKerPrivArgs->strideCn);
87  DSPLIB_DEBUGPRINTFN(0, "bufParamsU->data_type: %d d\n", bufParamsU->data_type);
88 
89  if (pKerInitArgs->funcStyle == DSPLIB_FUNCTION_NATC) {
90  if (bufParamsU->data_type == DSPLIB_FLOAT32) {
92  }
93  else if (bufParamsU->data_type == DSPLIB_FLOAT64) {
95  }
96  else {
97  status = DSPLIB_ERR_INVALID_TYPE;
98  DSPLIB_DEBUGPRINTFN(0, "status: %d\n", status);
99  }
100  }
101  else {
102  if (bufParamsU->data_type == DSPLIB_FLOAT32) {
104  status = DSPLIB_cholesky_solver_init_ci<float>(handle, bufParamsU, bufParamsScratch, bufParamsY, bufParamsB,
105  bufParamsX, bufParamsDiv, pKerInitArgs);
106  }
107  else if (bufParamsU->data_type == DSPLIB_FLOAT64) {
109  status = DSPLIB_cholesky_solver_init_ci<double>(handle, bufParamsU, bufParamsScratch, bufParamsY, bufParamsB,
110  bufParamsX, bufParamsDiv, pKerInitArgs);
111  }
112  else {
113  status = DSPLIB_ERR_INVALID_TYPE;
114  DSPLIB_DEBUGPRINTFN(0, "status: %d\n", status);
115  }
116  }
117 
118  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
119  return status;
120 }
121 
123  const void *restrict pU,
124  const void *restrict pScratch,
125  const void *restrict pY,
126  const void *restrict pB,
127  const void *restrict pX,
128  const void *restrict pDiv)
129 {
130 
131  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
132  DSPLIB_STATUS status;
133 
134  if ((pU == NULL) || (pScratch == NULL) || (pY == NULL) || (pB == NULL) || (pX == NULL) || (pDiv == NULL)) {
135  status = DSPLIB_ERR_NULL_POINTER;
136  DSPLIB_DEBUGPRINTFN(0, "status: %d\n", status);
137  }
138  else {
139  status = DSPLIB_SUCCESS;
140  }
141 
142  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
143  return status;
144 }
145 
147  void *restrict pU,
148  void *restrict pScratch,
149  void *restrict pY,
150  void *restrict pB,
151  void *restrict pX,
152  void *restrict pDiv)
153 {
154  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
155 
156  DSPLIB_STATUS status;
157 
159 
160  DSPLIB_DEBUGPRINTFN(0,"pKerPrivArgs->stride: %d pKerPrivArgs->order: %d\n",
161  pKerPrivArgs->stride, pKerPrivArgs->order);
162 
163  status = pKerPrivArgs->execute(handle, pU, pScratch, pY, pB, pX, pDiv);
164 
165  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
166  return status;
167 }
168 
169 /* ======================================================================== */
170 /* End of file: DSPLIB_cholesky_solver.cpp */
171 /* ======================================================================== */
template DSPLIB_STATUS DSPLIB_cholesky_solver_exec_ci< float >(DSPLIB_kernelHandle handle, void *restrict pU, void *restrict pScratch, void *restrict pY, void *restrict pB, void *restrict pX, void *restrict pDiv)
template DSPLIB_STATUS DSPLIB_cholesky_solver_init_ci< float >(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsU, DSPLIB_bufParams2D_t *bufParamsScratch, DSPLIB_bufParams1D_t *bufParamsY, DSPLIB_bufParams1D_t *bufParamsB, DSPLIB_bufParams1D_t *bufParamsX, DSPLIB_bufParams1D_t *bufParamsDiv, const DSPLIB_cholesky_solver_InitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_cholesky_solver_init_ci< double >(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsU, DSPLIB_bufParams2D_t *bufParamsScratch, DSPLIB_bufParams1D_t *bufParamsY, DSPLIB_bufParams1D_t *bufParamsB, DSPLIB_bufParams1D_t *bufParamsX, DSPLIB_bufParams1D_t *bufParamsDiv, const DSPLIB_cholesky_solver_InitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_cholesky_solver_exec_ci< double >(DSPLIB_kernelHandle handle, void *restrict pU, void *restrict pScratch, void *restrict pY, void *restrict pB, void *restrict pX, void *restrict pDiv)
template DSPLIB_STATUS DSPLIB_cholesky_solver_exec_cn< double >(DSPLIB_kernelHandle handle, void *restrict pU, void *restrict pScratch, void *restrict pY, void *restrict pB, void *restrict pX, void *restrict pDiv)
template DSPLIB_STATUS DSPLIB_cholesky_solver_exec_cn< float >(DSPLIB_kernelHandle handle, void *restrict pU, void *restrict pScratch, void *restrict pY, void *restrict pB, void *restrict pX, void *restrict pDiv)
Header file for kernel's internal use. For the kernel's interface, please see DSPLIB_cholesky_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_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_cholesky_solver_init(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsU, DSPLIB_bufParams2D_t *bufParamsScratch, DSPLIB_bufParams1D_t *bufParamsY, DSPLIB_bufParams1D_t *bufParamsB, DSPLIB_bufParams1D_t *bufParamsX, DSPLIB_bufParams1D_t *bufParamsDiv, const DSPLIB_cholesky_solver_InitArgs *pKerInitArgs)
This function should be called before the DSPLIB_cholesky_solver_exec function is called....
DSPLIB_STATUS DSPLIB_cholesky_solver_exec(DSPLIB_kernelHandle handle, void *restrict pU, void *restrict pScratch, void *restrict pY, void *restrict pB, void *restrict pX, void *restrict pDiv)
This function is the main kernel compute function.
DSPLIB_STATUS DSPLIB_cholesky_solver_init_checkParams(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsU, DSPLIB_bufParams2D_t *bufParamsScratch, DSPLIB_bufParams1D_t *bufParamsY, DSPLIB_bufParams1D_t *bufParamsB, DSPLIB_bufParams1D_t *bufParamsX, DSPLIB_bufParams1D_t *bufParamsDiv, const DSPLIB_cholesky_solver_InitArgs *pKerInitArgs)
This function checks the validity of the parameters passed to DSPLIB_cholesky_solver_init function....
DSPLIB_STATUS DSPLIB_cholesky_solver_exec_checkParams(DSPLIB_kernelHandle handle, const void *restrict pU, const void *restrict pScratch, const void *restrict pY, const void *restrict pB, const void *restrict pX, const void *restrict pDiv)
This function checks the validity of the parameters passed to DSPLIB_cholesky_solver_exec function....
int32_t DSPLIB_cholesky_solver_getHandleSize(DSPLIB_cholesky_solver_InitArgs *pKerInitArgs)
This is a query function to calculate the size of internal handle.
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.
Structure containing the parameters to initialize the kernel.
int32_t stride
stride of input/output data in ci
int8_t funcStyle
Variant of the function refer to DSPLIB_FUNCTION_STYLE
int32_t strideCn
stride of input/output data in cn
int32_t order
order of input data
Structure that is reserved for internal use by the kernel.
int32_t order
Order of input buffer for different batches DSPLIB_cholesky_solver_init that will be retrieved and us...
pFxnDSPLIB_cholesky_solver_exec execute
Function pointer to point to the right execution variant between DSPLIB_cholesky_solver_exec_cn and D...