| 45 | |
| 46 | template < typename T > |
| 47 | int transform( size_t* lengths, const size_t *inStrides, const size_t *outStrides, size_t batch_size, |
| 48 | clfftLayout in_layout, clfftLayout out_layout, |
| 49 | clfftResultLocation place, clfftPrecision precision, clfftDirection dir, |
| 50 | cl_device_type deviceType, cl_int deviceId, cl_int platformId, bool printInfo, |
| 51 | cl_uint command_queue_flags, cl_uint profile_count, |
| 52 | std::auto_ptr< clfftSetupData > setupData ) |
| 53 | { |
| 54 | // Our command line does not specify what dimension FFT we wish to transform; we decode |
| 55 | // this from the lengths that the user specifies for X, Y, Z. A length of one means that |
| 56 | // The user does not want that dimension. |
| 57 | |
| 58 | const size_t max_dimensions = 3; |
| 59 | size_t strides[ 4 ]; |
| 60 | size_t o_strides[ 4 ]; |
| 61 | size_t fftVectorSize = 0; |
| 62 | size_t fftVectorSizePadded = 0; |
| 63 | size_t fftBatchSize = 0; |
| 64 | size_t outfftVectorSize = 0; |
| 65 | size_t outfftVectorSizePadded = 0; |
| 66 | size_t outfftBatchSize = 0; |
| 67 | size_t size_of_input_buffers_in_bytes = 0; |
| 68 | size_t size_of_output_buffers_in_bytes = 0; |
| 69 | cl_uint number_of_output_buffers = 0; |
| 70 | clfftDim dim = CLFFT_1D; |
| 71 | cl_mem input_cl_mem_buffers [2] = { NULL, NULL }; |
| 72 | cl_mem output_cl_mem_buffers[2] = { NULL, NULL }; |
| 73 | std::vector< cl_device_id > device_id; |
| 74 | cl_context context; |
| 75 | cl_command_queue queue; |
| 76 | clfftPlanHandle plan_handle; |
| 77 | |
| 78 | for (unsigned u = 0; u < max_dimensions; ++u) { |
| 79 | if (0 != lengths[u]) |
| 80 | continue; |
| 81 | lengths[u] = 1; |
| 82 | } |
| 83 | |
| 84 | if( lengths[ 1 ] > 1 ) |
| 85 | { |
| 86 | dim = CLFFT_2D; |
| 87 | } |
| 88 | if( lengths[ 2 ] > 1 ) |
| 89 | { |
| 90 | dim = CLFFT_3D; |
| 91 | } |
| 92 | |
| 93 | strides[ 0 ] = inStrides[0]; |
| 94 | strides[ 1 ] = inStrides[1]; |
| 95 | strides[ 2 ] = inStrides[2]; |
| 96 | strides[ 3 ] = inStrides[3]; |
| 97 | |
| 98 | o_strides[ 0 ] = outStrides[0]; |
| 99 | o_strides[ 1 ] = outStrides[1]; |
| 100 | o_strides[ 2 ] = outStrides[2]; |
| 101 | o_strides[ 3 ] = outStrides[3]; |
| 102 | |
| 103 | fftVectorSize = lengths[0] * lengths[1] * lengths[2]; |
| 104 | fftVectorSizePadded = strides[3]; |
nothing calls this directly
no test coverage detected