17 #define TOTAL_DMA_CHANNELS (2)
20 #define FFTLIB_FFT1DBATCHED_16X512_CYCLES (12904)
21 #define FFTLIB_FFT1DATCHED_512X512_CYCLES (FFTLIB_FFT1DBATCHED_16X512_CYCLES) * (512 / 16)
22 #define DSPLIB_MAT_TRANS_CYCLES ((NUM_POINTS * NUM_CHANNELS) / 4)
24 #define ESITMATED_TOTAL_CYCLE_COUNT ((2 * FFTLIB_FFT1DATCHED_512X512_CYCLES) + DSPLIB_MAT_TRANS_CYCLES)
26 void TISP_fft2d_test_cn(
float *pX,
float *pW,
float *pTemp,
float *pY,
size_t numPoints,
size_t numChannels);
34 #if defined(HOST_EMULATION)
49 #elif __C7X_VEC_SIZE_BITS__ == 512
51 Sciclient_ConfigPrms_t sciClientCfg;
52 Sciclient_configPrmsInit(&sciClientCfg);
53 retVal = Sciclient_init(&sciClientCfg);
55 printf(
"Sciclient Init Failed \n");
90 for (uint32_t i = 0; i < numChannels * numPoints * 2; i++) {
91 input[i] = (float) rand() / (float) (RAND_MAX / (2 * 8)) - 8;
92 inputCn[i] = input[i];
98 printf(
"\n------------------------------------------------");
100 printf(
"\n------------------------------------------------\n");
102 printf(
"\nCreating Graph using smart pointers and rtos task in DDR:\n");
103 printf(
"\nDDR-->L2-->1DBatchedFFT-->L2-->MatrixTranspose-->L2-->DDR-->L2-->1DBatchedFFT-->L2-->DDR\n");
107 auto k0 = std::make_unique<TISP::FFTLIB::fft1dBatched<float, TISP::DMA_IN>>(pInputBlock, pTempBlock, numPoints,
110 auto k1 = std::make_unique<TISP::DSPLIB::matTrans<double, TISP::DMA_OUT>>(
111 (
double *) pTempBlock, (
double *) pOutputBlock, blockWidth >> 1, blockHeight, blockWidth *
sizeof(double) >> 1,
112 blockHeight *
sizeof(
double));
114 auto myOpVec0 = make_unique<TISP::opVec>();
116 myOpVec0->push_back(std::move(k0));
117 myOpVec0->push_back(std::move(k1));
119 auto s0 = std::make_unique<TISP::SuperNode::i2d_to_o2dTranspose<double, double>>(
120 std::move(myOpVec0), (
double *) input, (
double *) tempOut, (
double *) pInputBlock, (
double *) pOutputBlock,
121 numPoints, numChannels, blockWidth >> 1, blockHeight, (numPoints) *
sizeof(
double), numChannels *
sizeof(double),
124 auto k2 = std::make_unique<TISP::FFTLIB::fft1dBatched<float, TISP::DMA_IN_OUT>>(pInputBlock, pOutputBlock,
125 numChannels, blockHeight);
127 auto myOpVec1 = std::make_unique<TISP::opVec>();
129 myOpVec1->push_back(std::move(k2));
131 auto s1 = std::make_unique<TISP::SuperNode::i2d_to_o2d<float, float>>(
132 std::move(myOpVec1), tempOut, output, pInputBlock, pOutputBlock, numChannels << 1, numPoints, numChannels << 1,
133 blockHeight, (numChannels << 1) *
sizeof(
float), (numChannels << 1) *
sizeof(
float), (
TOTAL_DMA_CHANNELS));
141 mySuperNodeVec->push_back(std::move(s0));
142 mySuperNodeVec->push_back(std::move(s1));
148 void *myGraph = mySuperNodeVec;
156 printf(
"\nExecuting 2D FFt %d times\n", NUM_REPS);
158 #if (!HOST_EMULATION)
159 uint64_t startTime, endTime;
160 startTime = (__get_GTSC(1), __STSC);
163 for (int32_t i = 0; i < NUM_REPS; i++) {
169 #if (!HOST_EMULATION)
170 endTime = (__get_GTSC(1), __STSC);
171 uint64_t totalTime = (endTime - startTime) / (NUM_REPS);
172 printf(
"Average cycles to execute graph = %llu\n", totalTime);
176 printf(
"\nMemory performance of 2D FFT: %.2f GB/sec\n", (8 *
NUM_POINTS *
NUM_CHANNELS * 2) / ((
float) totalTime));
185 delete (mySuperNodeVec);
204 printf(
"\nRunning Natc for 2D FFT\n");
207 int32_t status = TI_compare_mem_2D_float((
void *) output, (
void *) refOut, 0, (
double) powf(2, -2), numChannels << 1,
208 numPoints, (numChannels << 1) *
sizeof(
float),
sizeof(
float));
210 if (status == TI_TEST_KERNEL_PASS) {
211 printf(
"Opt and Ref match! PASSED! \n");
214 printf(
"Opt and Ref DON'T match! FAILED!!! \n");
void TISP_fft2d_test_cn(float *pX, float *pW, float *pTemp, float *pY, size_t numPoints, size_t numChannels)
void execute_graph(void *myGraph)
Udma_DrvObjectInt appUdmaDrvObj
#define ESITMATED_TOTAL_CYCLE_COUNT
void delete_graph(void *myGraph)
#define TOTAL_DMA_CHANNELS
void App_dmautilsClecInitDru(void)
static Udma_DrvHandle setUdmaDrvHandle(Udma_DrvObjectInt &udmaDrvObj)
static void graph(const opVec &myOpVec)
This function takes in alias of the opeVec (list of nodes) and iterates through all the nodes calling...
std::vector< std::unique_ptr< TISP::SuperNode::superNode > > superNodeVec
Udma_DrvHandle appDrvHandle
void appC7xClecInitDru(void)
int32_t test_sciclientDmscGetVersion(char *version_str, uint32_t version_str_size)