Commit 46c5dc03 authored by Maximillian Bensch's avatar Maximillian Bensch
Browse files

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

- similar to cufftGetSize()
parent 0edfa5d2
......@@ -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);
cl_int clFFT_GetSize(clFFT_Plan Plan, size_t* workSize, cl_uint batchSize);
#ifdef __cplusplus
}
#endif
......
......@@ -526,3 +526,25 @@ void clFFT_DumpPlan( clFFT_Plan Plan, FILE *file)
}
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;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment