Skip to content
Snippets Groups Projects
Commit a9efa1be authored by Bernd Machenschalk's avatar Bernd Machenschalk
Browse files

Merge branch 'add-clFFT_GetSize-MR' into 'master'

Add clFFT_GetSize() for getting the estimated size of a plan

See merge request !5
parents 0edfa5d2 46c5dc03
No related branches found
No related tags found
1 merge request!5Add clFFT_GetSize() for getting the estimated size of a plan
...@@ -194,6 +194,8 @@ cl_int clFFT_1DTwistPlannar(clFFT_Plan Plan, cl_command_queue queue, cl_mem arra ...@@ -194,6 +194,8 @@ cl_int clFFT_1DTwistPlannar(clFFT_Plan Plan, cl_command_queue queue, cl_mem arra
void clFFT_DumpPlan( clFFT_Plan plan, FILE *file); void clFFT_DumpPlan( clFFT_Plan plan, FILE *file);
cl_int clFFT_GetSize(clFFT_Plan Plan, size_t* workSize, cl_uint batchSize);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -526,3 +526,25 @@ void clFFT_DumpPlan( clFFT_Plan Plan, FILE *file) ...@@ -526,3 +526,25 @@ void clFFT_DumpPlan( clFFT_Plan Plan, FILE *file)
} }
fprintf(out, "%s\n", plan->kernel_string->c_str()); fprintf(out, "%s\n", plan->kernel_string->c_str());
} }
cl_int
clFFT_GetSize(clFFT_Plan Plan, size_t* workSize, cl_uint batchSize)
{
if ( workSize == NULL ) {
return CL_INVALID_VALUE;
}
cl_fft_plan *plan = (cl_fft_plan *) Plan;
*workSize = 0;
// from precomputeSinCosLUTs() called in clFFT_CreatePlanAdv()
if (plan->twiddleMethod == clFFT_TaylorLUT || plan->twiddleMethod == clFFT_BigLUT) {
*workSize += ( plan->N1 + plan->N2 ) * 2 * sizeof(float);
}
// Additional alloc's from allocateTemporaryBufferInterleaved(), called in clFFT_ExecuteInterleaved()
// or allocateTemporaryBufferPlannar() called in clFFT_ExecutePlannar()
if(plan->temp_buffer_needed) {
size_t tmpLength = plan->n.x * plan->n.y * plan->n.z * batchSize * 2 * sizeof(cl_float);
*workSize += tmpLength;
}
return CL_SUCCESS;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment