FFTLIB User Guide
FFTLIB_FFT_dftLarge_ixX_cxX_oxX.cpp
Go to the documentation of this file.
1 /******************************************************************************
2 * *
3 * module name :FFTLIB *
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 
24 
27 {
28  int32_t privBufSize = sizeof(FFTLIB_FFT_dftLarge_ixX_cxX_oxX_PrivArgs);
29  return privBufSize ;
30 }
31 
33  FFTLIB_kernelHandle handle,
34  const FFTLIB_bufParams1D_t * bufParamsX,
35  const FFTLIB_bufParams1D_t * bufParamsW,
36  const FFTLIB_bufParams1D_t * bufParamsY,
37  const FFTLIB_FFT_dftLarge_ixX_cxX_oxX_InitArgs *pKerInitArgs)
38 {
39  FFTLIB_STATUS status = FFTLIB_SUCCESS ;
40  FFTLIB_bufParams1D_t bufParamsXLocal, bufParamsYLocal, bufParamsWLocal;
41  FFTLIB_bufParams2D_t bufParamsMatrixData, bufParamsMatrixW;
43 
44  if(handle == NULL) {
45  status = FFTLIB_ERR_NULL_POINTER;
46  } else {
47  pKerPrivArgs = (FFTLIB_FFT_dftLarge_ixX_cxX_oxX_PrivArgs *)handle;
48 
49  if (bufParamsX->data_type == FFTLIB_INT16) {
51  &bufParamsXLocal,
52  &bufParamsWLocal,
53  &bufParamsYLocal);
54  } else if (bufParamsX->data_type == FFTLIB_INT32) {
56  &bufParamsXLocal,
57  &bufParamsWLocal,
58  &bufParamsYLocal);
59  } else {
61  }
62  }
63 
64  if (status == FFTLIB_SUCCESS) {
65  if (bufParamsX->dim_x != bufParamsXLocal.dim_x) {
67  } else if (bufParamsY->dim_x != bufParamsYLocal.dim_x) {
69  } else if (bufParamsW->dim_x != bufParamsWLocal.dim_x) {
71  } else if ((bufParamsX->data_type != bufParamsW->data_type) ||
72  (bufParamsX->data_type != bufParamsY->data_type) ) {
73  status = FFTLIB_ERR_INVALID_TYPE;
74  } else {
75  bufParamsMatrixData.dim_x = pKerInitArgs->fftSize*2;
76  bufParamsMatrixData.dim_y = pKerInitArgs->batchSize;
77  bufParamsMatrixData.stride_y = pKerInitArgs->fftSize*2*FFTLIB_sizeof(bufParamsX->data_type);
78  bufParamsMatrixData.data_type = bufParamsX->data_type;
79  bufParamsMatrixW.dim_x = pKerInitArgs->fftSize*2;
80  bufParamsMatrixW.dim_y = pKerInitArgs->fftSize*2;
81  bufParamsMatrixW.stride_y = pKerInitArgs->fftSize*2*FFTLIB_sizeof(bufParamsW->data_type);
82  bufParamsMatrixW.data_type = bufParamsW->data_type;
83  pKerPrivArgs->matrixMatrixMultiplyInitArgs.shift = pKerInitArgs->shiftVector[0];
86  &bufParamsMatrixData,
87  &bufParamsMatrixW,
88  &bufParamsMatrixData,
89  &pKerPrivArgs->matrixMatrixMultiplyInitArgs);
90  }
91  }
92 
93  return status;
94 }
95 
97  FFTLIB_kernelHandle handle,
98  const void *restrict pX,
99  const void *restrict pW,
100  const void *restrict pY)
101 {
102  FFTLIB_STATUS status;
103 
104  if ((pX == NULL) || (pW == NULL) || (pY == NULL) ) {
105  status = FFTLIB_ERR_NULL_POINTER;
106  } else {
107  status = FFTLIB_SUCCESS ;
108  }
109 
110  return status;
111 }
112 
114  const FFTLIB_FFT_dftLarge_ixX_cxX_oxX_InitArgs * pKerInitArgs,
115  FFTLIB_bufParams1D_t * bufParamsX,
116  FFTLIB_bufParams1D_t * bufParamsW,
117  FFTLIB_bufParams1D_t * bufParamsY)
118 {
119  FFTLIB_STATUS status ;
120 
121  if (bufParamsX->data_type == FFTLIB_INT16) {
123  bufParamsX,
124  bufParamsW,
125  bufParamsY);
126  } else if (bufParamsX->data_type == FFTLIB_INT32) {
128  bufParamsX,
129  bufParamsW,
130  bufParamsY);
131  } else {
133  }
134 
135  return status ;
136 }
137 
139  const FFTLIB_FFT_dftLarge_ixX_cxX_oxX_InitArgs * pKerInitArgs,
140  void *pW,
141  const FFTLIB_bufParams1D_t * bufParamsW)
142 {
143  FFTLIB_STATUS status ;
144 
145  if (bufParamsW->data_type == FFTLIB_INT16) {
146  status = FFTLIB_FFT_dftLarge_ixX_cxX_oxX_twGen<int16_t>(pKerInitArgs,
147  pW,
148  bufParamsW);
149  } else if (bufParamsW->data_type == FFTLIB_INT32) {
150  status = FFTLIB_FFT_dftLarge_ixX_cxX_oxX_twGen<int32_t>(pKerInitArgs,
151  pW,
152  bufParamsW);
153  } else {
155  }
156 
157  return status ;
158 }
159 
161  FFTLIB_kernelHandle handle,
162  const FFTLIB_bufParams1D_t * bufParamsX,
163  const FFTLIB_bufParams1D_t * bufParamsW,
164  const FFTLIB_bufParams1D_t * bufParamsY,
165  const FFTLIB_FFT_dftLarge_ixX_cxX_oxX_InitArgs *pKerInitArgs)
166 {
167  FFTLIB_STATUS status ;
170  FFTLIB_bufParams2D_t bufParamsMatrixData, bufParamsMatrixW;
171 
172  pKerPrivArgs->matrixMatrixMultiplyInitArgs.shift =
173  pKerInitArgs->shiftVector[0];
175  pKerInitArgs->funcStyle;
176  pKerPrivArgs->initArgs = *pKerInitArgs;
177  bufParamsMatrixData.dim_x = pKerInitArgs->fftSize*2;
178  bufParamsMatrixData.dim_y = pKerInitArgs->batchSize;
179  bufParamsMatrixData.stride_y = pKerInitArgs->fftSize*2*FFTLIB_sizeof(bufParamsX->data_type);
180  bufParamsMatrixData.data_type = bufParamsX->data_type;
181  bufParamsMatrixW.dim_x = pKerInitArgs->fftSize*2;
182  bufParamsMatrixW.dim_y = pKerInitArgs->fftSize*2;
183  bufParamsMatrixW.stride_y = pKerInitArgs->fftSize*2*FFTLIB_sizeof(bufParamsW->data_type);
184  bufParamsMatrixW.data_type = bufParamsW->data_type;
187  &bufParamsMatrixData,
188  &bufParamsMatrixW,
189  &bufParamsMatrixData,
190  &pKerPrivArgs->matrixMatrixMultiplyInitArgs);
191 
192  return status;
193 }
194 
196  FFTLIB_kernelHandle handle,
197  const void *restrict pX,
198  const void *restrict pW,
199  void *restrict pY)
200 {
201  FFTLIB_STATUS status ;
202 
205 
208  pX,
209  pW,
210  pY);
211  return status ;
212 }
template FFTLIB_STATUS FFTLIB_FFT_dftLarge_ixX_cxX_oxX_twGen< int32_t >(const FFTLIB_FFT_dftLarge_ixX_cxX_oxX_InitArgs *pKerInitArgs, void *restrict pW, const FFTLIB_bufParams1D_t *bufParamsW)
template FFTLIB_STATUS FFTLIB_FFT_dftLarge_ixX_cxX_oxX_getSizes< FFTLIB_INT16 >(const FFTLIB_FFT_dftLarge_ixX_cxX_oxX_InitArgs *pKerInitArgs, FFTLIB_bufParams1D_t *bufParamsX, FFTLIB_bufParams1D_t *bufParamsW, FFTLIB_bufParams1D_t *bufParamsY)
template FFTLIB_STATUS FFTLIB_FFT_dftLarge_ixX_cxX_oxX_twGen< int16_t >(const FFTLIB_FFT_dftLarge_ixX_cxX_oxX_InitArgs *pKerInitArgs, void *restrict pW, const FFTLIB_bufParams1D_t *bufParamsW)
template FFTLIB_STATUS FFTLIB_FFT_dftLarge_ixX_cxX_oxX_getSizes< FFTLIB_INT32 >(const FFTLIB_FFT_dftLarge_ixX_cxX_oxX_InitArgs *pKerInitArgs, FFTLIB_bufParams1D_t *bufParamsX, FFTLIB_bufParams1D_t *bufParamsW, FFTLIB_bufParams1D_t *bufParamsY)
Header file for kernel's internal use. For the kernel's interface, please see FFTLIB_FFT_dftLarge_ixX...
FFTLIB_STATUS FFTLIB_LINALG_matrixMatrixMultiply_ixX_ixX_oxX_exec(FFTLIB_kernelHandle handle, const void *src0, const void *src1, void *dst)
This function is the main compute function, and performs matrix-matrix multiplication.
FFTLIB_STATUS FFTLIB_LINALG_matrixMatrixMultiply_ixX_ixX_oxX_init_checkParams(FFTLIB_kernelHandle handle, const FFTLIB_bufParams2D_t *src0_addr, const FFTLIB_bufParams2D_t *src1_addr, const FFTLIB_bufParams2D_t *dst_addr, const FFTLIB_LINALG_matrixMatrixMultiply_ixX_ixX_oxX_InitArgs *pKerInitArgs)
This function checks the parameters and should be called before kernel executuon. It can be called on...
FFTLIB_STATUS FFTLIB_LINALG_matrixMatrixMultiply_ixX_ixX_oxX_init(FFTLIB_kernelHandle handle, const FFTLIB_bufParams2D_t *src0_addr, const FFTLIB_bufParams2D_t *src1_addr, const FFTLIB_bufParams2D_t *dst_addr, const FFTLIB_LINALG_matrixMatrixMultiply_ixX_ixX_oxX_InitArgs *pKerInitArgs)
This function call is required to initialize the handle. In this function most of the one time operat...
@ FFTLIB_INT16
@ FFTLIB_INT32
static int32_t FFTLIB_sizeof(uint32_t type)
Inline function returns number of bytes per element given a type of _FFTLIB_data_type_e.
void * FFTLIB_kernelHandle
Handle type for FFTLIB operations.
Definition: FFTLIB_types.h:217
FFTLIB_STATUS_NAME
The enumeration of all status codes.
Definition: FFTLIB_types.h:172
@ FFTLIB_ERR_NOT_IMPLEMENTED
Definition: FFTLIB_types.h:179
@ FFTLIB_ERR_INVALID_TYPE
Definition: FFTLIB_types.h:176
@ FFTLIB_ERR_NULL_POINTER
Definition: FFTLIB_types.h:178
@ FFTLIB_ERR_INVALID_DIMENSION
Definition: FFTLIB_types.h:177
@ FFTLIB_SUCCESS
Definition: FFTLIB_types.h:173
FFTLIB_STATUS FFTLIB_FFT_dftLarge_ixX_cxX_oxX_exec_checkParams(FFTLIB_kernelHandle handle, const void *restrict pX, const void *restrict pW, const void *restrict pY)
This function checks the validity of the parameters passed to FFTLIB_FFT_dftLarge_ixX_cxX_oxX_exec fu...
FFTLIB_STATUS FFTLIB_FFT_dftLarge_ixX_cxX_oxX_twGen(const FFTLIB_FFT_dftLarge_ixX_cxX_oxX_InitArgs *pKerInitArgs, void *pW, const FFTLIB_bufParams1D_t *bufParamsW)
This is a utility function that generates the DFT computational matrix into the provided buffer.
FFTLIB_STATUS FFTLIB_FFT_dftLarge_ixX_cxX_oxX_getSizes(const FFTLIB_FFT_dftLarge_ixX_cxX_oxX_InitArgs *pKerInitArgs, FFTLIB_bufParams1D_t *bufParamsX, FFTLIB_bufParams1D_t *bufParamsW, FFTLIB_bufParams1D_t *bufParamsY)
This is a query function to calculate the sizes of input, output and the DFT computational matrix buf...
int32_t FFTLIB_FFT_dftLarge_ixX_cxX_oxX_getHandleSize(FFTLIB_FFT_dftLarge_ixX_cxX_oxX_InitArgs *pKerInitArgs)
This is a query function to calculate the size of internal handle.
FFTLIB_STATUS FFTLIB_FFT_dftLarge_ixX_cxX_oxX_init_checkParams(FFTLIB_kernelHandle handle, const FFTLIB_bufParams1D_t *bufParamsX, const FFTLIB_bufParams1D_t *bufParamsW, const FFTLIB_bufParams1D_t *bufParamsY, const FFTLIB_FFT_dftLarge_ixX_cxX_oxX_InitArgs *pKerInitArgs)
This function checks the validity of the parameters passed to FFTLIB_FFT_dftLarge_ixX_cxX_oxX_init fu...
FFTLIB_STATUS FFTLIB_FFT_dftLarge_ixX_cxX_oxX_init(FFTLIB_kernelHandle handle, const FFTLIB_bufParams1D_t *bufParamsX, const FFTLIB_bufParams1D_t *bufParamsW, const FFTLIB_bufParams1D_t *bufParamsY, const FFTLIB_FFT_dftLarge_ixX_cxX_oxX_InitArgs *pKerInitArgs)
This function should be called before the FFTLIB_FFT_dftLarge_ixX_cxX_oxX_exec function is called....
FFTLIB_STATUS FFTLIB_FFT_dftLarge_ixX_cxX_oxX_exec(FFTLIB_kernelHandle handle, const void *restrict pX, const void *restrict pW, void *restrict pY)
This function is the main kernel compute function.
Structure containing the parameters for DFT computation.
int8_t funcStyle
Variant of the function refer to FFTLIB_FUNCTION_STYLE.
uint32_t shiftVector[FFTLIB_FFT_DFTLARGE_IXX_CXX_OXX_NUMSHIFTS]
Array containing the bit-shift values to be used for internal computation.
uint32_t batchSize
Size of the batch in terms of number of channels of DFT's.
uint32_t fftSize
Size of each channel's data in terms of number of complex points.
Structure that is reserved for internal use by the kernel.
FFTLIB_LINALG_matrixMatrixMultiply_ixX_ixX_oxX_PrivArgs matrixMatrixMultiplyPrivArgs
Structure to maintain the internal use parameters of FFTLIB_LINALG_matrixMatrixMultiply_ixX_ixX_oxX k...
FFTLIB_LINALG_matrixMatrixMultiply_ixX_ixX_oxX_InitArgs matrixMatrixMultiplyInitArgs
Structure to hold the initialization parameters of FFTLIB_LINALG_matrixMatrixMultiply_ixX_ixX_oxX ker...
FFTLIB_FFT_dftLarge_ixX_cxX_oxX_InitArgs initArgs
Structure holding initialization parameters
A structure for a 1 dimensional buffer descriptor.
uint32_t data_type
Values are of type FFTLIB_data_type_e.
uint32_t dim_x
Width of buffer in X dimension in elements.
A structure for a 2 dimensional buffer descriptor.
uint32_t dim_y
Height of buffer in Y dimension in elements.
uint32_t dim_x
Width of buffer in X dimension in elements.
int32_t stride_y
Stride in Y dimension in bytes.
uint32_t data_type
Values are of type FFTLIB_data_type_e.